diff --git a/SabreTools.Helper/Objects/Dat/DatFile.cs b/SabreTools.Helper/Objects/Dat/DatFile.cs index 7a3a0b11..a6305b39 100644 --- a/SabreTools.Helper/Objects/Dat/DatFile.cs +++ b/SabreTools.Helper/Objects/Dat/DatFile.cs @@ -1379,17 +1379,6 @@ namespace SabreTools.Helper continue; } // Special cases for item statuses - else if (gc[i] == "good" && attrib != "status" && attrib != "flags") - { - if (item.Type == ItemType.Rom) - { - ((Rom)item).ItemStatus = ItemStatus.Good; - } - else if (item.Type == ItemType.Disk) - { - ((Disk)item).ItemStatus = ItemStatus.Good; - } - } else if (gc[i] == "baddump" && attrib != "status" && attrib != "flags") { if (item.Type == ItemType.Rom) @@ -1412,17 +1401,6 @@ namespace SabreTools.Helper ((Disk)item).ItemStatus = ItemStatus.Nodump; } } - else if (gc[i] == "verified" && attrib != "status" && attrib != "flags") - { - if (item.Type == ItemType.Rom) - { - ((Rom)item).ItemStatus = ItemStatus.Verified; - } - else if (item.Type == ItemType.Disk) - { - ((Disk)item).ItemStatus = ItemStatus.Verified; - } - } // Even number of quotes, not in a quote, not in attribute else if (Regex.Matches(gc[i], "\"").Count % 2 == 0 && !quote && attrib == "") { @@ -3023,7 +3001,7 @@ namespace SabreTools.Helper // Output initial statistics, for kicks if (stats) { - OutputStats(logger, (RomCount + DiskCount == 0)); + OutputStats(logger, logger, (RomCount + DiskCount == 0)); } // Bucket roms by game name and optionally dedupe @@ -4356,9 +4334,10 @@ namespace SabreTools.Helper /// Output the stats for the Dat in a human-readable format /// /// Logger object for file and console writing + /// Logger object for file and console output (statistics) /// True if numbers should be recalculated for the DAT, false otherwise (default) /// Number of games to use, -1 means recalculate games (default) - public void OutputStats(Logger logger, bool recalculate = false, long game = -1) + public void OutputStats(Logger logger, Logger statLogger, bool recalculate = false, long game = -1) { // If we're supposed to recalculate the statistics, do so if (recalculate) @@ -4371,7 +4350,7 @@ namespace SabreTools.Helper { TotalSize = Int64.MaxValue + TotalSize; } - logger.User(" Uncompressed size: " + Style.GetBytesReadable(TotalSize) + @" + statLogger.User(" Uncompressed size: " + Style.GetBytesReadable(TotalSize) + @" Games found: " + (game == -1 ? Files.Count : game) + @" Roms found: " + RomCount + @" Disks found: " + DiskCount + @" @@ -4379,7 +4358,7 @@ namespace SabreTools.Helper Roms with MD5: " + MD5Count + @" Roms with SHA-1: " + SHA1Count + @" Roms with Nodump status: " + NodumpCount + @" -"); +", false); } #endregion @@ -5046,7 +5025,8 @@ namespace SabreTools.Helper /// List of input files and folders /// True if single DAT stats are output, false otherwise /// Logger object for file and console output - public static void OutputStats(List inputs, bool single, Logger logger) + /// Logger object for file and console output (statistics) + public static void OutputStats(List inputs, bool single, Logger logger, Logger statLogger) { // Make sure we have all files List newinputs = new List(); @@ -5078,7 +5058,7 @@ namespace SabreTools.Helper /// Now process each of the input files foreach (string filename in newinputs) { - logger.Verbose("Beginning stat collection for '" + filename + "'"); + logger.Verbose("Beginning stat collection for '" + filename + "'", false); List games = new List(); DatFile datdata = new DatFile(); datdata.Parse(filename, 0, 0, logger); @@ -5087,13 +5067,13 @@ namespace SabreTools.Helper // Output single DAT stats (if asked) if (single) { - logger.User(@"\nFor file '" + filename + @"': ---------------------------------------------------"); - datdata.OutputStats(logger); + statLogger.User(@"\nFor file '" + filename + @"': +--------------------------------------------------", false); + datdata.OutputStats(logger, statLogger); } else { - logger.User("Adding stats for file '" + filename + "'\n"); + logger.User("Adding stats for file '" + filename + "'\n", false); } // Add single DAT stats to totals @@ -5108,7 +5088,7 @@ namespace SabreTools.Helper } // Output total DAT stats - if (!single) { logger.User(""); } + if (!single) { logger.User("", false); } DatFile totaldata = new DatFile { TotalSize = totalSize, @@ -5119,11 +5099,11 @@ namespace SabreTools.Helper SHA1Count = totalSHA1, NodumpCount = totalNodump, }; - logger.User(@"For ALL DATs found ---------------------------------------------------"); - totaldata.OutputStats(logger, game: totalGame); + statLogger.User(@"For ALL DATs found +--------------------------------------------------", false); + totaldata.OutputStats(logger, statLogger, game: totalGame); logger.User(@" -Please check the log folder if the stats scrolled offscreen"); +Please check the log folder if the stats scrolled offscreen", false); } #endregion diff --git a/SabreTools.Helper/Objects/Logger.cs b/SabreTools.Helper/Objects/Logger.cs index 5672c042..11ae5b5d 100644 --- a/SabreTools.Helper/Objects/Logger.cs +++ b/SabreTools.Helper/Objects/Logger.cs @@ -57,7 +57,7 @@ namespace SabreTools.Helper { _log = new StreamWriter(File.Open(_basepath + _filename, FileMode.OpenOrCreate | FileMode.Append)); _log.WriteLine("Logging started " + DateTime.Now); - _log.WriteLine(GetCommandLine()); + _log.WriteLine(Environment.CommandLine); _log.Flush(); } catch @@ -245,8 +245,5 @@ namespace SabreTools.Helper } return true; } - - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - private static extern System.IntPtr GetCommandLine(); } } diff --git a/SabreTools.Helper/Objects/SimpleSort.cs b/SabreTools.Helper/Objects/SimpleSort.cs index 4ed42e7f..9e57f406 100644 --- a/SabreTools.Helper/Objects/SimpleSort.cs +++ b/SabreTools.Helper/Objects/SimpleSort.cs @@ -262,7 +262,7 @@ namespace SabreTools.Helper _logger.ClearBeneath(Constants.HeaderHeight); Console.SetCursorPosition(0, Constants.HeaderHeight + 1); _logger.User("Stats of the matched ROMs:"); - _matched.OutputStats(_logger, true); + _matched.OutputStats(_logger, _logger, true); // Now output the fixdat based on the original input if asked if (_updateDat) diff --git a/SabreTools/Partials/SabreTools_Inits.cs b/SabreTools/Partials/SabreTools_Inits.cs index b0b99bcd..888350c9 100644 --- a/SabreTools/Partials/SabreTools_Inits.cs +++ b/SabreTools/Partials/SabreTools_Inits.cs @@ -288,7 +288,7 @@ namespace SabreTools private static void InitStats(List inputs, bool single) { Logger statlog = new Logger(true, "stats.txt"); - DatFile.OutputStats(inputs, single, statlog); + DatFile.OutputStats(inputs, single, _logger, statlog); statlog.Close(true); }