diff --git a/Test/Printer.cs b/Test/Printer.cs index 4d8f322c..05283f0e 100644 --- a/Test/Printer.cs +++ b/Test/Printer.cs @@ -15,22 +15,21 @@ namespace Test /// /// File or directory path /// Enable JSON output, if supported - /// Output directory path /// Enable debug output - public static void PrintPathInfo(string path, bool json, string outputDirectory, bool debug) + public static void PrintPathInfo(string path, bool json, bool debug) { Console.WriteLine($"Checking possible path: {path}"); // Check if the file or directory exists if (File.Exists(path)) { - PrintFileInfo(path, json, outputDirectory, debug); + PrintFileInfo(path, json, debug); } else if (Directory.Exists(path)) { foreach (string file in Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories)) { - PrintFileInfo(file, json, outputDirectory, debug); + PrintFileInfo(file, json, debug); } } else @@ -42,7 +41,7 @@ namespace Test /// /// Print information for a single file, if possible /// - private static void PrintFileInfo(string file, bool json, string outputDirectory, bool debug) + private static void PrintFileInfo(string file, bool json, bool debug) { Console.WriteLine($"Attempting to print info for {file}"); @@ -257,18 +256,8 @@ namespace Test string serializedData = wrapper.ExportJSON(); Console.WriteLine(serializedData); - // Create the output filename - string filename = $"info-{DateTime.Now:yyyy-MM-dd_HHmmss}.json"; - - // If we have an output directory - if (!string.IsNullOrWhiteSpace(outputDirectory)) - { - Directory.CreateDirectory(outputDirectory); - filename = Path.Combine(outputDirectory, filename); - } - // Write the output data - using (var sw = new StreamWriter(File.OpenWrite(filename))) + using (var sw = new StreamWriter(File.OpenWrite($"info-{DateTime.Now:yyyy-MM-dd_HHmmss}.json"))) { sw.WriteLine(serializedData); } @@ -281,18 +270,8 @@ namespace Test StringBuilder builder = wrapper.PrettyPrint(); Console.WriteLine(builder); - // Create the output filename - string filename = $"info-{DateTime.Now:yyyy-MM-dd_HHmmss}.txt"; - - // If we have an output directory - if (!string.IsNullOrWhiteSpace(outputDirectory)) - { - Directory.CreateDirectory(outputDirectory); - filename = Path.Combine(outputDirectory, filename); - } - // Write the output data - using (var sw = new StreamWriter(File.OpenWrite(filename))) + using (var sw = new StreamWriter(File.OpenWrite($"info-{DateTime.Now:yyyy-MM-dd_HHmmss}.txt"))) { sw.WriteLine(builder.ToString()); } diff --git a/Test/Program.cs b/Test/Program.cs index df49a103..6a3467f6 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -139,7 +139,7 @@ namespace Test foreach (string inputPath in inputPaths) { if (info) - Printer.PrintPathInfo(inputPath, json, outputPath, debug); + Printer.PrintPathInfo(inputPath, json, debug); else if (extract) Extractor.ExtractPath(inputPath, outputPath); else @@ -171,7 +171,7 @@ namespace Test Console.WriteLine("-j, --json Print executable info as JSON"); #endif Console.WriteLine("-x, --extract Extract archive formats (Requires -o)"); - Console.WriteLine("-o, --outdir [PATH] Set output path for information and extraction"); + Console.WriteLine("-o, --outdir [PATH] Set output path for extraction (Requires -x)"); } } }