Make JSON handling internally a bit easier

This commit is contained in:
Matt Nadareski
2023-01-16 22:15:45 -08:00
parent 3f2adfcf62
commit f564fb6e9e
2 changed files with 1 additions and 17 deletions

View File

@@ -16,32 +16,20 @@ namespace Test
/// <param name="path">File or directory path</param>
/// <param name="json">Enable JSON output, if supported</param>
/// <param name="debug">Enable debug output</param>
#if NET6_0_OR_GREATER
public static void PrintPathInfo(string path, bool json, bool debug)
#else
public static void PrintPathInfo(string path, bool debug)
#endif
{
Console.WriteLine($"Checking possible path: {path}");
// Check if the file or directory exists
if (File.Exists(path))
{
#if NET6_0_OR_GREATER
PrintFileInfo(path, json, debug);
#else
PrintFileInfo(path, debug);
#endif
}
else if (Directory.Exists(path))
{
foreach (string file in Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories))
{
#if NET6_0_OR_GREATER
PrintFileInfo(file, json, debug);
#else
PrintFileInfo(file, debug);
#endif
}
}
else
@@ -53,11 +41,7 @@ namespace Test
/// <summary>
/// Print information for a single file, if possible
/// </summary>
#if NET6_0_OR_GREATER
private static void PrintFileInfo(string file, bool json, bool debug)
#else
private static void PrintFileInfo(string file, bool debug)
#endif
{
Console.WriteLine($"Attempting to print info for {file}");

View File

@@ -48,7 +48,7 @@ namespace Test
#if NET6_0_OR_GREATER
Printer.PrintPathInfo(inputPath, options.Json, options.Debug);
#else
Printer.PrintPathInfo(inputPath, options.Debug);
Printer.PrintPathInfo(inputPath, false, options.Debug);
#endif
// Scanning