Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CatalogPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static void Process(CatalogOptions options)
{
var key = $"{hex1}{hex2}";

File.AppendAllLines($"{options.OutputFolder}\\{options.Prefix}-{key}.txt", buckets[key]);
File.AppendAllLines(Path.Combine(options.OutputFolder,$"{options.Prefix}-{key}.txt"), buckets[key]);
buckets[key].Clear();
}
}
Expand All @@ -253,7 +253,7 @@ public static void Process(CatalogOptions options)

private static async Task DoXReference(CatalogOptions options)
{
var xrefFolder = $"{options.OutputFolder}\\xref\\";
var xrefFolder = $"{options.OutputFolder}{Path.DirectorySeparatorChar}xref{Path.DirectorySeparatorChar}";

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent approach to path construction. String interpolation with Path.DirectorySeparatorChar is used instead of Path.Combine. For consistency with the rest of the PR and proper OS-safe path handling, use Path.Combine(options.OutputFolder, "xref") and add the trailing separator separately if needed, or better yet, avoid the trailing separator altogether if possible.

Suggested change
var xrefFolder = $"{options.OutputFolder}{Path.DirectorySeparatorChar}xref{Path.DirectorySeparatorChar}";
var xrefFolder = Path.Combine(options.OutputFolder, "xref");

Copilot uses AI. Check for mistakes.
if (!Directory.Exists(xrefFolder))
{
WriteMessage($"Creating new xref folder at {xrefFolder}");
Expand Down Expand Up @@ -283,7 +283,7 @@ private static async Task DoXReference(CatalogOptions options)
foreach (var hex2 in Hex)
{
var key = $"{hex1}{hex2}";
var path = $"{options.OutputFolder}\\{options.Prefix}-{key}.txt";
var path = Path.Combine(options.OutputFolder, $"{options.Prefix}-{key}.txt");

tasks.Add(CalculateXRef(path, options));
}
Expand Down Expand Up @@ -313,8 +313,8 @@ private static async Task DoXReference(CatalogOptions options)
foreach (var hex2 in Hex)
{
var key = $"{hex1}{hex2}";
var mapPath = $"{options.OutputFolder}\\xref\\{options.Prefix}-xref-{key}.tmp";
var outputPath = $"{options.OutputFolder}\\xref\\{options.Prefix}-xref-{key}.txt";
var mapPath = Path.Combine(options.OutputFolder, "xref", $"{options.Prefix}-xref-{key}.tmp");
var outputPath = Path.Combine(options.OutputFolder, "xref", $"{options.Prefix}-xref-{key}.txt");

tasks.Add(OptimiseFile(mapPath, outputPath));
}
Expand Down Expand Up @@ -492,7 +492,7 @@ private static async Task WriteFiles(Dictionary<string, Dictionary<string, int>>
//Loop through each de, lock and write out the lines
foreach (var de in output)
{
var path = $"{options.OutputFolder}\\xref\\{options.Prefix}-xref-{de.Key}.tmp";
var path = Path.Combine(options.OutputFolder, "xref", "${options.Prefix}-xref-{de.Key}.tmp");

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string interpolation syntax is incorrect. The opening quote is a dollar sign followed by a double quote, but should be a dollar sign with the interpolation expression enclosed in curly braces. The variable reference "${options.Prefix}" should be "{options.Prefix}" to properly interpolate the value.

Suggested change
var path = Path.Combine(options.OutputFolder, "xref", "${options.Prefix}-xref-{de.Key}.tmp");
var path = Path.Combine(options.OutputFolder, "xref", $"{options.Prefix}-xref-{de.Key}.tmp");

Copilot uses AI. Check for mistakes.

//https://blog.cdemi.io/async-waiting-inside-c-sharp-locks/
try
Expand Down
4 changes: 2 additions & 2 deletions CutPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public static void Process(CutOptions options)

var fileInfo = new FileInfo(filePath);
var fileName = Path.GetFileNameWithoutExtension(filePath);
var filePathName = $"{currentDirectory}\\{fileName}";
var outputPath = $"{currentDirectory}\\{options.OutputPath}";
var filePathName = Path.Combine(currentDirectory, fileName);
var outputPath = Path.Combine(currentDirectory, options.OutputPath);

//Check that there are no output files
if (!CheckForFiles(new string[] { outputPath }))
Expand Down
10 changes: 5 additions & 5 deletions ExportPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ public static void Process(ExportOptions options)
foreach (var hashesPath in hashFileEntries)
{
var fileName = Path.GetFileNameWithoutExtension(hashesPath);
var plainsPath = $"{currentDirectory}\\{fileName}.plains.txt"; //email:plain
var foundPath = $"{currentDirectory}\\{fileName}.found.txt"; //hash:plain
var leftPath = $"{currentDirectory}\\{IncrementFilename(fileName, "left")}.txt"; //hash
var plainsPath = Path.Combine(currentDirectory, $"{fileName}.plains.txt"); //email:plain
var foundPath = Path.Combine(currentDirectory, $"{fileName}.found.txt"); //hash:plain
var leftPath = Path.Combine(currentDirectory, $"{IncrementFilename(fileName, "left")}.txt"); //hash

//Check that there are no output files
if (!CheckForFiles(new string[] { plainsPath, foundPath, leftPath}))
Expand Down Expand Up @@ -317,14 +317,14 @@ public static void Process(ExportOptions options)
if (removeHashes.Count > 0)
{
var removeHashesFileName = Path.GetFileNameWithoutExtension(options.RemoveHashesPath);
var removeHashesNewPath = $"{currentDirectory}\\{IncrementFilename(removeHashesFileName, "left")}.hash"; //hash
var removeHashesNewPath = Path.Combine(currentDirectory, $"{IncrementFilename(removeHashesFileName, "left")}.hash"); //hash

File.AppendAllLines(removeHashesNewPath, removeHashes);

if (removeWords.Count > 0)
{
var removeWordsFileName = Path.GetFileNameWithoutExtension(options.RemoveWordsPath);
var removeWordsNewPath = $"{currentDirectory}\\{IncrementFilename(removeWordsFileName, "left")}.word"; //word
var removeWordsNewPath = Path.Combine(currentDirectory, $"{IncrementFilename(removeWordsFileName, "left")}.word"); //word

File.AppendAllLines(removeWordsNewPath, removeWords);
}
Expand Down
2 changes: 1 addition & 1 deletion HashPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void Process(HashOptions options)
//Create a version based on the file size, so that the hash and dict are bound together
var fileInfo = new FileInfo(filePath);
var fileName = Path.GetFileNameWithoutExtension(filePath);
var filePathName = $"{currentDirectory}\\{fileName}";
var filePathName = Path.Combine(currentDirectory, fileName);

var lineCount = 0;
var output = new List<string>();
Expand Down
9 changes: 5 additions & 4 deletions LookupPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -123,7 +124,7 @@ public static void Process(LookupOptions options)
//Create a version based on the file size, so that the hash and dict are bound together
var fileInfo = new FileInfo(filePath);
var fileName = Path.GetFileNameWithoutExtension(filePath);
var filePathName = $"{currentDirectory}\\{fileName}";
var filePathName = Path.Combine(currentDirectory, fileName);

var outputHashPath = $"{filePathName}{variation}.hash";
var outputWordPath = $"{filePathName}{variation}.word";
Expand Down Expand Up @@ -207,7 +208,7 @@ public static void Process(LookupOptions options)
foreach (var hex2 in Hex)
{
var key = $"{hex1}{hex2}";
var sourcePath = $"{options.SourceFolder}\\{options.Prefix}-{key}.txt";
var sourcePath = Path.Combine(options.SourceFolder, $"{options.Prefix}-{key}.txt");
DoLookup(key, currentDirectory, variation, sourcePath, lookups, options, rules);

bucketCount++;
Expand Down Expand Up @@ -360,7 +361,7 @@ private static void DoLookup(string key, string currentDirectory, string variati
{
if (lookup.Hashes.Count != lookup.Words.Count) throw new ApplicationException("Hashes count does not match wordlist count.");

var filePathName = $"{currentDirectory}\\{lookup.Filename}";
var filePathName = Path.Combine(currentDirectory, lookup.Filename);

if (options.Export)
{
Expand Down Expand Up @@ -452,7 +453,7 @@ private static List<string> InferWords(List<string> words, LookupOptions options
var key = hash[0].ToString("x2");

//Get the file name
var path = $"{options.SourceFolder}\\xref\\{options.Prefix}-xref-{key}.txt";
var path = Path.Combine(options.SourceFolder, "xref", $"{options.Prefix}-xref-{key}.txt");

//Check if the indexes have been calculated
if (!_inferenceIndex.ContainsKey(key)) _inferenceIndex.Add(key, CalculateInferenceFileIndexes(key, path));
Expand Down
2 changes: 1 addition & 1 deletion MapPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void Process(MapOptions options)
//Create a version based on the file size, so that the hash and dict are bound together
var fileInfo = new FileInfo(filePath);
var fileName = Path.GetFileNameWithoutExtension(filePath);
var filePathName = $"{currentDirectory}\\{fileName}";
var filePathName = Path.Combine(currentDirectory, fileName);

_outputHashPath = $"{filePathName}.{version}.hash";
_outputWordPath = $"{filePathName}.{version}.word";
Expand Down
2 changes: 1 addition & 1 deletion ParsePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void Process(ParseOptions options)

//Create a version based on the file size, so that the hash and dict are bound together
var fileName = Path.GetFileNameWithoutExtension(filePath);
var filePathName = $"{currentDirectory}\\{fileName}";
var filePathName = Path.Combine(currentDirectory, fileName);

var outputPath = $"{filePathName}.parse.txt";
var outputNotParsedPath = $"{filePathName}.noparse.txt";
Expand Down
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private static Assembly LoadPlugin(string name)
{
// Navigate up to the solution root
//var pluginFolder = $"{Directory.GetCurrentDirectory()}\\Plugins\\";
var pluginFolder = $"{AppDomain.CurrentDomain.BaseDirectory}\\Plugins\\{name}\\";
var pluginFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins", name) + Path.DirectorySeparatorChar;

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent approach to path construction. While Path.Combine is used, a trailing directory separator is manually appended using Path.DirectorySeparatorChar. This defeats the purpose of using Path.Combine for OS-safe paths. Consider using Path.Combine for the full path construction and only append the trailing separator if it's truly necessary for the subsequent logic.

Suggested change
var pluginFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins", name) + Path.DirectorySeparatorChar;
var pluginFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins", name);

Copilot uses AI. Check for mistakes.

if (!Directory.Exists(pluginFolder))
{
Expand Down
2 changes: 1 addition & 1 deletion RankPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static void Process(RankOptions options)
}

var fileName = Path.GetFileNameWithoutExtension(filePath);
var filePathName = $"{currentDirectory}\\{fileName}";
var filePathName = Path.Combine(currentDirectory, fileName);

if (lines.Count > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion SortPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void Process(SortOptions options)

//Create a version based on the file size, so that the hash and dict are bound together
var fileName = Path.GetFileNameWithoutExtension(filePath);
var filePathName = $"{currentDirectory}\\{fileName}";
var filePathName = Path.Combine(currentDirectory, fileName);

var outputPath = $"{filePathName}.temp.txt";

Expand Down
2 changes: 1 addition & 1 deletion SplitPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void Process(SplitOptions options)
//Create a version based on the file size, so that the hash and dict are bound together
var fileInfo = new FileInfo(filePath);
var fileName = Path.GetFileNameWithoutExtension(filePath);
var filePathName = $"{currentDirectory}\\{fileName}";
var filePathName = Path.Combine(currentDirectory, fileName);

var lineCount = 0;
var part = 1;
Expand Down
2 changes: 1 addition & 1 deletion SqlPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void Process(SqlOptions options)
WriteMessage($"Processing {sqlPath}.");

var fileName = Path.GetFileNameWithoutExtension(sqlPath);
var filePathName = $"{currentDirectory}\\{fileName}";
var filePathName = Path.Combine(currentDirectory, fileName);
var outputPath = $"{filePathName}.parsed.txt";
var metapath = $"{filePathName}.meta.txt";
var debugPath = $"{filePathName}.debug.txt";
Expand Down
2 changes: 1 addition & 1 deletion ValidatePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void Process(ValidateOptions options)
//Create a version based on the file size, so that the hash and dict are bound together
var fileInfo = new FileInfo(filePath);
var fileName = Path.GetFileNameWithoutExtension(filePath);
var filePathName = $"{currentDirectory}\\{fileName}";
var filePathName = Path.Combine(currentDirectory, fileName);

_outputValidPath = $"{filePathName}.valid{fileInfo.Extension}";
_outputInvalidPath = $"{filePathName}.invalid{fileInfo.Extension}";
Expand Down
Loading