diff --git a/RombaSharp/Partials/RombaSharp_Inits.cs b/RombaSharp/Partials/RombaSharp_Inits.cs index b52f4e2b..f4105a10 100644 --- a/RombaSharp/Partials/RombaSharp_Inits.cs +++ b/RombaSharp/Partials/RombaSharp_Inits.cs @@ -254,7 +254,7 @@ namespace SabreTools FileName = Path.GetFileName(inputs[0]) + " Dir2Dat", Name = Path.GetFileName(inputs[0]) + " Dir2Dat", Description = Path.GetFileName(inputs[0]) + " Dir2Dat", - OutputFormat = OutputFormat.Logiqx, + DatFormat = DatFormat.Logiqx, Files = new SortedDictionary>(), }; diff --git a/SabreTools.Helper/Data/Build.cs b/SabreTools.Helper/Data/Build.cs index 70988611..6fc60e03 100644 --- a/SabreTools.Helper/Data/Build.cs +++ b/SabreTools.Helper/Data/Build.cs @@ -148,15 +148,15 @@ namespace SabreTools.Helper.Data helptext.Add(" -?, -h, --help Show this help"); // Convert - helptext.Add(" -cv, --convert Enable conversion of input files to TZip"); + helptext.Add(" -cv, --convert Enable conversion of input files to TZip"); helptext.Add(" -dat= DAT to be used as a filter for conversion"); helptext.Add(" -out= Output directory"); helptext.Add(" -t=, --temp= Set the temporary directory to use"); - helptext.Add(" -del, --delete Delete input files [DO NOT USE]"); + helptext.Add(" -del, --delete Delete input files [DO NOT USE]"); helptext.Add(" -tgz Enable TorrentGZ output"); helptext.Add(" -r, --romba Enable Romba depot dir output"); - helptext.Add(" -7z={0} Set scanning level for 7z archives"); - helptext.Add(" -gz={2} Set scanning level for GZip archives"); + helptext.Add(" -7z={0} Set scanning level for 7z archives"); + helptext.Add(" -gz={2} Set scanning level for GZip archives"); helptext.Add(" -rar={2} Set scanning level for RAR archives"); helptext.Add(" -zip={0} Set scanning level for ZIP archives"); @@ -353,6 +353,12 @@ namespace SabreTools.Helper.Data helptext.Add(" -h=, --header= Set a header skipper to use, blank means all"); // Additional Notes + helptext.Add(""); + helptext.Add("Archive scanning levels:"); + helptext.Add(" 0 Hash archive and contents"); + helptext.Add(" 1 Only hash contents"); + helptext.Add(" 2 Only hash archive"); + helptext.Add(""); helptext.Add("Filenames and directories can't start with a reserved string"); helptext.Add("unless prefixed by 'input='"); @@ -401,9 +407,9 @@ namespace SabreTools.Helper.Data // Additional Notes helptext.Add(""); helptext.Add("Archive scanning levels:"); - helptext.Add(" 0 Hash archive and contents"); - helptext.Add(" 1 Only hash contents"); - helptext.Add(" 2 Only hash archive"); + helptext.Add(" 0 Hash archive and contents"); + helptext.Add(" 1 Only hash contents"); + helptext.Add(" 2 Only hash archive"); break; default: helptext.Add(Resources.Resources.Default_Desc); diff --git a/SabreTools.Helper/Data/Enums.cs b/SabreTools.Helper/Data/Enums.cs index 5c5589a1..9913a982 100644 --- a/SabreTools.Helper/Data/Enums.cs +++ b/SabreTools.Helper/Data/Enums.cs @@ -188,7 +188,7 @@ /// /// Determine which format to output Stats to /// - public enum StatOutputFormat + public enum StatDatFormat { None = 0, HTML = 1, diff --git a/SabreTools.Helper/Data/Flags.cs b/SabreTools.Helper/Data/Flags.cs index 61741fc8..6d57d917 100644 --- a/SabreTools.Helper/Data/Flags.cs +++ b/SabreTools.Helper/Data/Flags.cs @@ -118,7 +118,7 @@ namespace SabreTools.Helper.Data /// Determines the DAT output format /// [Flags] - public enum OutputFormat + public enum DatFormat { Logiqx = 0x0001, ClrMamePro = 0x0002, diff --git a/SabreTools.Helper/Dats/DatFile.cs b/SabreTools.Helper/Dats/DatFile.cs index 8ca2e63a..5922e42d 100644 --- a/SabreTools.Helper/Dats/DatFile.cs +++ b/SabreTools.Helper/Dats/DatFile.cs @@ -39,7 +39,7 @@ namespace SabreTools.Helper.Dats private ForceMerging _forceMerging; private ForceNodump _forceNodump; private ForcePacking _forcePacking; - private OutputFormat _outputFormat; + private DatFormat _datFormat; private bool _excludeOf; private bool _mergeRoms; private SortedDictionary> _files; @@ -156,10 +156,10 @@ namespace SabreTools.Helper.Dats get { return _forcePacking; } set { _forcePacking = value; } } - public OutputFormat OutputFormat + public DatFormat DatFormat { - get { return _outputFormat; } - set { _outputFormat = value; } + get { return _datFormat; } + set { _datFormat = value; } } public bool ExcludeOf { @@ -714,7 +714,7 @@ namespace SabreTools.Helper.Dats ForceNodump = _forceNodump, ForcePacking = _forcePacking, ExcludeOf = _excludeOf, - OutputFormat = _outputFormat, + DatFormat = _datFormat, MergeRoms = _mergeRoms, Files = _files, SortedBy = _sortedBy, @@ -760,7 +760,7 @@ namespace SabreTools.Helper.Dats ForceNodump = _forceNodump, ForcePacking = _forcePacking, ExcludeOf = _excludeOf, - OutputFormat = _outputFormat, + DatFormat = _datFormat, MergeRoms = _mergeRoms, Files = new SortedDictionary>(), SortedBy = SortedBy.Default, @@ -901,7 +901,7 @@ namespace SabreTools.Helper.Dats innerDatdata.Parse(inputFileName, 0, 0, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, logger, true, clean, softlist, - keepext: ((innerDatdata.OutputFormat & OutputFormat.TSV) != 0 || (innerDatdata.OutputFormat & OutputFormat.CSV) != 0)); + keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0)); // If we have roms, output them if (innerDatdata.Files.Count != 0) @@ -922,7 +922,7 @@ namespace SabreTools.Helper.Dats innerDatdata.Files = null; innerDatdata.Parse(file, 0, 0, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, logger, true, clean, softlist, - keepext: ((innerDatdata.OutputFormat & OutputFormat.TSV) != 0 || (innerDatdata.OutputFormat & OutputFormat.CSV) != 0)); + keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0)); // If we have roms, output them if (innerDatdata.Files != null && innerDatdata.Files.Count != 0) @@ -976,7 +976,7 @@ namespace SabreTools.Helper.Dats logger.User("Adding DAT: " + input.Split('¬')[0]); datHeaders[i] = new DatFile { - OutputFormat = (OutputFormat != 0 ? OutputFormat : 0), + DatFormat = (DatFormat != 0 ? DatFormat : 0), Files = new SortedDictionary>(), MergeRoms = MergeRoms, }; @@ -1422,7 +1422,7 @@ namespace SabreTools.Helper.Dats FileName = (String.IsNullOrEmpty(FileName) ? (keepext ? Path.GetFileName(filename) : Path.GetFileNameWithoutExtension(filename)) : FileName); // If the output type isn't set already, get the internal output type - OutputFormat = (OutputFormat == 0 ? FileTools.GetOutputFormat(filename, logger) : OutputFormat); + DatFormat = (DatFormat == 0 ? FileTools.GetDatFormat(filename, logger) : DatFormat); // Make sure there's a dictionary to read to if (Files == null) @@ -1431,28 +1431,28 @@ namespace SabreTools.Helper.Dats } // Now parse the correct type of DAT - switch (FileTools.GetOutputFormat(filename, logger)) + switch (FileTools.GetDatFormat(filename, logger)) { - case OutputFormat.ClrMamePro: - case OutputFormat.DOSCenter: + case DatFormat.ClrMamePro: + case DatFormat.DOSCenter: ParseCMP(filename, sysid, srcid, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, logger, keep, clean); break; - case OutputFormat.Logiqx: - case OutputFormat.OfflineList: - case OutputFormat.SabreDat: - case OutputFormat.SoftwareList: + case DatFormat.Logiqx: + case DatFormat.OfflineList: + case DatFormat.SabreDat: + case DatFormat.SoftwareList: ParseGenericXML(filename, sysid, srcid, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, logger, keep, clean, softlist); break; - case OutputFormat.RedumpMD5: + case DatFormat.RedumpMD5: ParseRedumpMD5(filename, sysid, srcid, romname, md5, trim, single, root, logger, clean); break; - case OutputFormat.RedumpSFV: + case DatFormat.RedumpSFV: ParseRedumpSFV(filename, sysid, srcid, romname, crc, trim, single, root, logger, clean); break; - case OutputFormat.RedumpSHA1: + case DatFormat.RedumpSHA1: ParseRedumpSHA1(filename, sysid, srcid, romname, sha1, trim, single, root, logger, clean); break; - case OutputFormat.RomCenter: + case DatFormat.RomCenter: ParseRC(filename, sysid, srcid, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, logger, clean); break; default: @@ -4908,7 +4908,7 @@ namespace SabreTools.Helper.Dats matched.FileName = "fixDat_" + matched.FileName; matched.Name = "fixDat_" + matched.Name; matched.Description = "fixDat_" + matched.Description; - matched.OutputFormat = OutputFormat.Logiqx; + matched.DatFormat = DatFormat.Logiqx; // Now that all files are parsed, get only files found in directory bool found = false; @@ -4993,7 +4993,7 @@ namespace SabreTools.Helper.Dats Url = this.Url, Comment = this.Comment, Files = new SortedDictionary>(), - OutputFormat = this.OutputFormat, + DatFormat = this.DatFormat, }; DatFile datdataB = new DatFile { @@ -5009,7 +5009,7 @@ namespace SabreTools.Helper.Dats Url = this.Url, Comment = this.Comment, Files = new SortedDictionary>(), - OutputFormat = this.OutputFormat, + DatFormat = this.DatFormat, }; // If roms is empty, return false @@ -5124,7 +5124,7 @@ namespace SabreTools.Helper.Dats ForceMerging = this.ForceMerging, ForceNodump = this.ForceNodump, ForcePacking = this.ForcePacking, - OutputFormat = this.OutputFormat, + DatFormat = this.DatFormat, MergeRoms = this.MergeRoms, Files = new SortedDictionary>(), }; @@ -5146,7 +5146,7 @@ namespace SabreTools.Helper.Dats ForceMerging = this.ForceMerging, ForceNodump = this.ForceNodump, ForcePacking = this.ForcePacking, - OutputFormat = this.OutputFormat, + DatFormat = this.DatFormat, MergeRoms = this.MergeRoms, Files = new SortedDictionary>(), }; @@ -5168,7 +5168,7 @@ namespace SabreTools.Helper.Dats ForceMerging = this.ForceMerging, ForceNodump = this.ForceNodump, ForcePacking = this.ForcePacking, - OutputFormat = this.OutputFormat, + DatFormat = this.DatFormat, MergeRoms = this.MergeRoms, Files = new SortedDictionary>(), }; @@ -5190,7 +5190,7 @@ namespace SabreTools.Helper.Dats ForceMerging = this.ForceMerging, ForceNodump = this.ForceNodump, ForcePacking = this.ForcePacking, - OutputFormat = this.OutputFormat, + DatFormat = this.DatFormat, MergeRoms = this.MergeRoms, Files = new SortedDictionary>(), }; @@ -5213,7 +5213,7 @@ namespace SabreTools.Helper.Dats ForceMerging = this.ForceMerging, ForceNodump = this.ForceNodump, ForcePacking = this.ForcePacking, - OutputFormat = this.OutputFormat, + DatFormat = this.DatFormat, MergeRoms = this.MergeRoms, Files = new SortedDictionary>(), }; @@ -5372,7 +5372,7 @@ namespace SabreTools.Helper.Dats ForceMerging = this.ForceMerging, ForceNodump = this.ForceNodump, ForcePacking = this.ForcePacking, - OutputFormat = this.OutputFormat, + DatFormat = this.DatFormat, MergeRoms = this.MergeRoms, Files = new SortedDictionary>(), }; @@ -5394,7 +5394,7 @@ namespace SabreTools.Helper.Dats ForceMerging = this.ForceMerging, ForceNodump = this.ForceNodump, ForcePacking = this.ForcePacking, - OutputFormat = this.OutputFormat, + DatFormat = this.DatFormat, MergeRoms = this.MergeRoms, Files = new SortedDictionary>(), }; @@ -5416,7 +5416,7 @@ namespace SabreTools.Helper.Dats ForceMerging = this.ForceMerging, ForceNodump = this.ForceNodump, ForcePacking = this.ForcePacking, - OutputFormat = this.OutputFormat, + DatFormat = this.DatFormat, MergeRoms = this.MergeRoms, Files = new SortedDictionary>(), }; @@ -5559,13 +5559,13 @@ namespace SabreTools.Helper.Dats /// Output the stats for the Dat in a human-readable format /// /// StreamWriter representing the output file or stream for the statistics - /// Set the statistics output format to use + /// Set the statistics output format to use /// Logger object for file and console writing /// True if numbers should be recalculated for the DAT, false otherwise (default) /// Number of games to use, -1 means recalculate games (default) /// True if baddumps should be included in output, false otherwise (default) /// True if nodumps should be included in output, false otherwise (default) - public void OutputStats(StreamWriter sw, StatOutputFormat statOutputFormat, Logger logger, bool recalculate = false, long game = -1, bool baddumpCol = false, bool nodumpCol = false) + public void OutputStats(StreamWriter sw, StatDatFormat statDatFormat, Logger logger, bool recalculate = false, long game = -1, bool baddumpCol = false, bool nodumpCol = false) { // If we're supposed to recalculate the statistics, do so if (recalculate) @@ -5603,9 +5603,9 @@ namespace SabreTools.Helper.Dats // Now write it out to file as well string line = ""; - switch (statOutputFormat) + switch (statDatFormat) { - case StatOutputFormat.CSV: + case StatDatFormat.CSV: line = "\"" + FileName + "\"," + "\"" + Style.GetBytesReadable(TotalSize) + "\"," + "\"" + (game == -1 ? Files.Count : game) + "\"," @@ -5626,7 +5626,7 @@ namespace SabreTools.Helper.Dats line += "\n"; break; - case StatOutputFormat.HTML: + case StatDatFormat.HTML: line = "\t\t\t" + HttpUtility.HtmlEncode(FileName.Remove(0, 5)) : ">" + HttpUtility.HtmlEncode(FileName)) + "" @@ -5649,7 +5649,7 @@ namespace SabreTools.Helper.Dats line += "\n"; break; - case StatOutputFormat.None: + case StatDatFormat.None: default: line = @"'" + FileName + @"': -------------------------------------------------- @@ -5670,7 +5670,7 @@ namespace SabreTools.Helper.Dats line += " Roms with Nodump status: " + NodumpCount + "\n"; } break; - case StatOutputFormat.TSV: + case StatDatFormat.TSV: line = "\"" + FileName + "\"\t" + "\"" + Style.GetBytesReadable(TotalSize) + "\"\t" + "\"" + (game == -1 ? Files.Count : game) + "\"\t" @@ -5737,9 +5737,9 @@ namespace SabreTools.Helper.Dats } // If the DAT has no output format, default to XML - if (OutputFormat == 0) + if (DatFormat == 0) { - OutputFormat = OutputFormat.Logiqx; + DatFormat = DatFormat.Logiqx; } // Make sure that the three essential fields are filled in @@ -5780,7 +5780,7 @@ namespace SabreTools.Helper.Dats if (stats) { StreamWriter sw = new StreamWriter(new MemoryStream()); - OutputStats(sw, StatOutputFormat.None, logger, recalculate: (RomCount + DiskCount == 0), baddumpCol: true, nodumpCol: true); + OutputStats(sw, StatDatFormat.None, logger, recalculate: (RomCount + DiskCount == 0), baddumpCol: true, nodumpCol: true); sw.Dispose(); } @@ -5788,20 +5788,20 @@ namespace SabreTools.Helper.Dats BucketByGame(MergeRoms, norename, logger); // Get the outfile name - Dictionary outfiles = Style.CreateOutfileNames(outDir, this, overwrite); + Dictionary outfiles = Style.CreateOutfileNames(outDir, this, overwrite); try { - foreach (OutputFormat outputFormat in outfiles.Keys) + foreach (DatFormat datFormat in outfiles.Keys) { - string outfile = outfiles[outputFormat]; + string outfile = outfiles[datFormat]; logger.User("Opening file for writing: " + outfile); FileStream fs = File.Create(outfile); StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(true)); // Write out the header - WriteHeader(sw, outputFormat, logger); + WriteHeader(sw, datFormat, logger); // Write out each of the machines and roms int depth = 2, last = -1; @@ -5832,13 +5832,13 @@ namespace SabreTools.Helper.Dats // If we have a different game and we're not at the start of the list, output the end of last item if (lastgame != null && lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant()) { - depth = WriteEndGame(sw, outputFormat, rom, splitpath, newsplit, lastgame, depth, out last, logger); + depth = WriteEndGame(sw, datFormat, rom, splitpath, newsplit, lastgame, depth, out last, logger); } // If we have a new game, output the beginning of the new item if (lastgame == null || lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant()) { - depth = WriteStartGame(sw, outputFormat, rom, newsplit, lastgame, depth, last, logger); + depth = WriteStartGame(sw, datFormat, rom, newsplit, lastgame, depth, last, logger); } // If we have a "null" game (created by DATFromDir or something similar), log it to file @@ -5851,10 +5851,10 @@ namespace SabreTools.Helper.Dats logger.Verbose("Empty folder found: " + rom.Machine.Name); // If we're in a mode that doesn't allow for actual empty folders, add the blank info - if (outputFormat != OutputFormat.CSV - && outputFormat != OutputFormat.MissFile - && outputFormat != OutputFormat.SabreDat - && outputFormat != OutputFormat.TSV) + if (datFormat != DatFormat.CSV + && datFormat != DatFormat.MissFile + && datFormat != DatFormat.SabreDat + && datFormat != DatFormat.TSV) { rom.Name = (rom.Name == "null" ? "-" : rom.Name); ((Rom)rom).Size = Constants.SizeZero; @@ -5873,7 +5873,7 @@ namespace SabreTools.Helper.Dats } // Now, output the rom data - WriteRomData(sw, outputFormat, rom, lastgame, depth, logger, ignoreblanks); + WriteRomData(sw, datFormat, rom, lastgame, depth, logger, ignoreblanks); // Set the new data to compare against splitpath = newsplit; @@ -5882,7 +5882,7 @@ namespace SabreTools.Helper.Dats } // Write the file footer out - WriteFooter(sw, outputFormat, depth, logger); + WriteFooter(sw, datFormat, depth, logger); logger.Verbose("File written!" + Environment.NewLine); sw.Dispose(); @@ -5902,17 +5902,17 @@ namespace SabreTools.Helper.Dats /// Write out DAT header using the supplied StreamWriter /// /// StreamWriter to output to - /// Output format to write to + /// Output format to write to /// Logger object for file and console output /// True if the data was written, false on error - private bool WriteHeader(StreamWriter sw, OutputFormat outputFormat, Logger logger) + private bool WriteHeader(StreamWriter sw, DatFormat datFormat, Logger logger) { try { string header = ""; - switch (outputFormat) + switch (datFormat) { - case OutputFormat.ClrMamePro: + case DatFormat.ClrMamePro: header = "clrmamepro (\n" + "\tname \"" + Name + "\"\n" + "\tdescription \"" + Description + "\"\n" + @@ -5930,11 +5930,11 @@ namespace SabreTools.Helper.Dats (ForceMerging == ForceMerging.Split ? "\tforcemerging split\n" : "") + ")\n"; break; - case OutputFormat.CSV: + case DatFormat.CSV: header = "\"File Name\",\"Internal Name\",\"Description\",\"Game Name\",\"Game Description\",\"Type\",\"" + "Rom Name\",\"Disk Name\",\"Size\",\"CRC\",\"MD5\",\"SHA1\",\"Nodump\"\n"; break; - case OutputFormat.DOSCenter: + case DatFormat.DOSCenter: header = "DOSCenter (\n" + "\tName: " + Name + "\n" + "\tDescription: " + Description + "\n" + @@ -5945,7 +5945,7 @@ namespace SabreTools.Helper.Dats "\tComment: " + Comment + "\n" + ")\n"; break; - case OutputFormat.Logiqx: + case DatFormat.Logiqx: header = "\n" + "\n\n" + "\n" + @@ -5975,11 +5975,11 @@ namespace SabreTools.Helper.Dats : "") + "\t\n"; break; - case OutputFormat.TSV: + case DatFormat.TSV: header = "\"File Name\"\t\"Internal Name\"\t\"Description\"\t\"Game Name\"\t\"Game Description\"\t\"Type\"\t\"" + "Rom Name\"\t\"Disk Name\"\t\"Size\"\t\"CRC\"\t\"MD5\"\t\"SHA1\"\t\"Nodump\"\n"; break; - case OutputFormat.OfflineList: + case DatFormat.OfflineList: header = "\n" + "\n" + "\t\n" @@ -6023,7 +6023,7 @@ namespace SabreTools.Helper.Dats + "\t\n" + "\t\n"; break; - case OutputFormat.RomCenter: + case DatFormat.RomCenter: header = "[CREDITS]\n" + "author=" + Author + "\n" + "version=" + Version + "\n" + @@ -6037,7 +6037,7 @@ namespace SabreTools.Helper.Dats "version=" + Description + "\n" + "[GAMES]\n"; break; - case OutputFormat.SabreDat: + case DatFormat.SabreDat: header = "\n" + "\n\n" + "\n" + @@ -6065,7 +6065,7 @@ namespace SabreTools.Helper.Dats "\t\n" + "\t\n"; break; - case OutputFormat.SoftwareList: + case DatFormat.SoftwareList: header = "\n" + "\n\n" + " /// StreamWriter to output to - /// Output format to write to + /// Output format to write to /// RomData object to be output /// Split path representing the parent game (SabreDAT only) /// The name of the last game to be output @@ -6106,7 +6106,7 @@ namespace SabreTools.Helper.Dats /// Last known depth to cycle back from (SabreDAT only) /// Logger object for file and console output /// The new depth of the tag - private int WriteStartGame(StreamWriter sw, OutputFormat outputFormat, DatItem rom, List newsplit, string lastgame, int depth, int last, Logger logger) + private int WriteStartGame(StreamWriter sw, DatFormat datFormat, DatItem rom, List newsplit, string lastgame, int depth, int last, Logger logger) { try { @@ -6117,9 +6117,9 @@ namespace SabreTools.Helper.Dats } string state = ""; - switch (outputFormat) + switch (datFormat) { - case OutputFormat.ClrMamePro: + case DatFormat.ClrMamePro: state += "game (\n\tname \"" + rom.Machine.Name + "\"\n" + (ExcludeOf ? "" : (String.IsNullOrEmpty(rom.Machine.RomOf) ? "" : "\tromof \"" + rom.Machine.RomOf + "\"\n") + @@ -6130,10 +6130,10 @@ namespace SabreTools.Helper.Dats (String.IsNullOrEmpty(rom.Machine.Year) ? "" : "\tyear " + rom.Machine.Year + "\n") + (String.IsNullOrEmpty(rom.Machine.Manufacturer) ? "" : "\tmanufacturer \"" + rom.Machine.Manufacturer + "\"\n"); break; - case OutputFormat.DOSCenter: + case DatFormat.DOSCenter: state += "game (\n\tname \"" + rom.Machine.Name + ".zip\"\n"; break; - case OutputFormat.Logiqx: + case DatFormat.Logiqx: state += "\t" + HttpUtility.HtmlEncode(rom.Machine.Year) + "\n") + (String.IsNullOrEmpty(rom.Machine.Manufacturer) ? "" : "\t\t" + HttpUtility.HtmlEncode(rom.Machine.Manufacturer) + "\n"); break; - case OutputFormat.SabreDat: + case DatFormat.SabreDat: for (int i = (last == -1 ? 0 : last); i < newsplit.Count; i++) { for (int j = 0; j < depth - last + i - (lastgame == null ? 1 : 0); j++) @@ -6165,7 +6165,7 @@ namespace SabreTools.Helper.Dats } depth = depth - (last == -1 ? 0 : last) + newsplit.Count; break; - case OutputFormat.SoftwareList: + case DatFormat.SoftwareList: state += "\t /// StreamWriter to output to - /// Output format to write to + /// Output format to write to /// RomData object to be output /// Split path representing last kwown parent game (SabreDAT only) /// Split path representing the parent game (SabreDAT only) @@ -6215,7 +6215,7 @@ namespace SabreTools.Helper.Dats /// Last known depth to cycle back from (SabreDAT only) /// Logger object for file and console output /// The new depth of the tag - private int WriteEndGame(StreamWriter sw, OutputFormat outputFormat, DatItem rom, List splitpath, List newsplit, string lastgame, int depth, out int last, Logger logger) + private int WriteEndGame(StreamWriter sw, DatFormat datFormat, DatItem rom, List splitpath, List newsplit, string lastgame, int depth, out int last, Logger logger) { last = 0; @@ -6223,19 +6223,19 @@ namespace SabreTools.Helper.Dats { string state = ""; - switch (outputFormat) + switch (datFormat) { - case OutputFormat.ClrMamePro: - case OutputFormat.DOSCenter: + case DatFormat.ClrMamePro: + case DatFormat.DOSCenter: state += (String.IsNullOrEmpty(rom.Machine.SampleOf) ? "" : "\tsampleof \"" + rom.Machine.SampleOf + "\"\n") + ")\n"; break; - case OutputFormat.Logiqx: + case DatFormat.Logiqx: state += "\t\n"; break; - case OutputFormat.OfflineList: + case DatFormat.OfflineList: state += "\t\t\n"; break; - case OutputFormat.SabreDat: + case DatFormat.SabreDat: if (splitpath != null) { for (int i = 0; i < newsplit.Count && i < splitpath.Count; i++) @@ -6265,7 +6265,7 @@ namespace SabreTools.Helper.Dats depth = 2 + last; } break; - case OutputFormat.SoftwareList: + case DatFormat.SoftwareList: state += "\t\n\n"; break; } @@ -6286,14 +6286,14 @@ namespace SabreTools.Helper.Dats /// Write out RomData using the supplied StreamWriter /// /// StreamWriter to output to - /// Output format to write to + /// Output format to write to /// RomData object to be output /// The name of the last game to be output /// Current depth to output file at (SabreDAT only) /// Logger object for file and console output /// True if blank roms should be skipped on output, false otherwise (default) /// True if the data was written, false on error - private bool WriteRomData(StreamWriter sw, OutputFormat outputFormat, DatItem rom, string lastgame, int depth, Logger logger, bool ignoreblanks = false) + private bool WriteRomData(StreamWriter sw, DatFormat datFormat, DatItem rom, string lastgame, int depth, Logger logger, bool ignoreblanks = false) { // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip if (ignoreblanks @@ -6306,9 +6306,9 @@ namespace SabreTools.Helper.Dats try { string state = "", name = "", pre = "", post = ""; - switch (outputFormat) + switch (datFormat) { - case OutputFormat.ClrMamePro: + case DatFormat.ClrMamePro: switch (rom.Type) { case ItemType.Archive: @@ -6357,7 +6357,7 @@ namespace SabreTools.Helper.Dats } break; - case OutputFormat.CSV: + case DatFormat.CSV: // CSV should only output Rom and Disk if (rom.Type != ItemType.Disk && rom.Type != ItemType.Rom) { @@ -6435,7 +6435,7 @@ namespace SabreTools.Helper.Dats state += pre + inline + post + "\n"; } break; - case OutputFormat.DOSCenter: + case DatFormat.DOSCenter: switch (rom.Type) { case ItemType.Archive: @@ -6454,7 +6454,7 @@ namespace SabreTools.Helper.Dats break; } break; - case OutputFormat.Logiqx: + case DatFormat.Logiqx: switch (rom.Type) { case ItemType.Archive: @@ -6502,7 +6502,7 @@ namespace SabreTools.Helper.Dats break; } break; - case OutputFormat.MissFile: + case DatFormat.MissFile: // Missfile should only output Rom and Disk if (rom.Type != ItemType.Disk && rom.Type != ItemType.Rom) { @@ -6608,7 +6608,7 @@ namespace SabreTools.Helper.Dats state += pre + name + post + "\n"; } break; - case OutputFormat.OfflineList: + case DatFormat.OfflineList: state += "\t\t\n" + "\t\t\t1\n" + "\t\t\t1\n" @@ -6656,7 +6656,7 @@ namespace SabreTools.Helper.Dats + "\t\t\t0\n" + "\t\t\n"; break; - case OutputFormat.RedumpMD5: + case DatFormat.RedumpMD5: if (rom.Type == ItemType.Rom) { state += ((Rom)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; @@ -6666,13 +6666,13 @@ namespace SabreTools.Helper.Dats state += ((Disk)rom).MD5 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } break; - case OutputFormat.RedumpSFV: + case DatFormat.RedumpSFV: if (rom.Type == ItemType.Rom) { state += (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + " " + ((Rom)rom).CRC + "\n"; } break; - case OutputFormat.RedumpSHA1: + case DatFormat.RedumpSHA1: if (rom.Type == ItemType.Rom) { state += ((Rom)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; @@ -6682,7 +6682,7 @@ namespace SabreTools.Helper.Dats state += ((Disk)rom).SHA1 + " *" + (GameName ? rom.Machine.Name + Path.DirectorySeparatorChar : "") + rom.Name + "\n"; } break; - case OutputFormat.RomCenter: + case DatFormat.RomCenter: if (rom.Type == ItemType.Rom) { state += "¬" + (String.IsNullOrEmpty(rom.Machine.CloneOf) ? "" : HttpUtility.HtmlEncode(rom.Machine.CloneOf)) + @@ -6704,7 +6704,7 @@ namespace SabreTools.Helper.Dats } break; - case OutputFormat.SabreDat: + case DatFormat.SabreDat: string prefix = ""; for (int i = 0; i < depth; i++) { @@ -6763,7 +6763,7 @@ namespace SabreTools.Helper.Dats break; } break; - case OutputFormat.SoftwareList: + case DatFormat.SoftwareList: state += "\t\t\n"; foreach (Tuple kvp in rom.Features) @@ -6838,7 +6838,7 @@ namespace SabreTools.Helper.Dats state += "\t\t\n"; break; - case OutputFormat.TSV: + case DatFormat.TSV: // TSV should only output Rom and Disk if (rom.Type != ItemType.Disk && rom.Type != ItemType.Rom) { @@ -6934,11 +6934,11 @@ namespace SabreTools.Helper.Dats /// Write out DAT footer using the supplied StreamWriter /// /// StreamWriter to output to - /// Output format to write to + /// Output format to write to /// Current depth to output file at (SabreDAT only) /// Logger object for file and console output /// True if the data was written, false on error - private bool WriteFooter(StreamWriter sw, OutputFormat outputFormat, int depth, Logger logger) + private bool WriteFooter(StreamWriter sw, DatFormat datFormat, int depth, Logger logger) { try { @@ -6947,16 +6947,16 @@ namespace SabreTools.Helper.Dats // If we have roms, output the full footer if (Files != null && Files.Count > 0) { - switch (outputFormat) + switch (datFormat) { - case OutputFormat.ClrMamePro: - case OutputFormat.DOSCenter: + case DatFormat.ClrMamePro: + case DatFormat.DOSCenter: footer = ")\n"; break; - case OutputFormat.Logiqx: + case DatFormat.Logiqx: footer = "\t\n\n"; break; - case OutputFormat.OfflineList: + case DatFormat.OfflineList: footer = "\t\t" + "\t\n" + "\t\n" @@ -6967,7 +6967,7 @@ namespace SabreTools.Helper.Dats + "\t\n" + ""; break; - case OutputFormat.SabreDat: + case DatFormat.SabreDat: for (int i = depth - 1; i >= 2; i--) { // Print out the number of tabs and the end folder @@ -6979,7 +6979,7 @@ namespace SabreTools.Helper.Dats } footer += "\t\n\n"; break; - case OutputFormat.SoftwareList: + case DatFormat.SoftwareList: footer = "\t\n\n\n"; break; } @@ -6988,13 +6988,13 @@ namespace SabreTools.Helper.Dats // Otherwise, output the abbreviated form else { - switch (outputFormat) + switch (datFormat) { - case OutputFormat.Logiqx: - case OutputFormat.SabreDat: + case DatFormat.Logiqx: + case DatFormat.SabreDat: footer = "\n"; break; - case OutputFormat.OfflineList: + case DatFormat.OfflineList: footer = "\t\n" + "\t\n" + "\t\t\n" @@ -7004,7 +7004,7 @@ namespace SabreTools.Helper.Dats + "\t\n" + ""; break; - case OutputFormat.SoftwareList: + case DatFormat.SoftwareList: footer = "\n"; break; } @@ -7103,12 +7103,12 @@ namespace SabreTools.Helper.Dats /// True if single DAT stats are output, false otherwise /// True if baddumps should be included in output, false otherwise /// True if nodumps should be included in output, false otherwise - /// Set the statistics output format to use + /// Set the statistics output format to use /// Logger object for file and console output public static void OutputStats(List inputs, string reportName, bool single, bool baddumpCol, - bool nodumpCol, StatOutputFormat statOutputFormat, Logger logger) + bool nodumpCol, StatDatFormat statDatFormat, Logger logger) { - reportName += OutputStatsGetExtension(statOutputFormat); + reportName += OutputStatsGetExtension(statDatFormat); StreamWriter sw = new StreamWriter(File.Open(reportName, FileMode.Create, FileAccess.Write)); // Make sure we have all files @@ -7133,7 +7133,7 @@ namespace SabreTools.Helper.Dats .ToList(); // Write the header, if any - OutputStatsWriteHeader(sw, statOutputFormat, baddumpCol, nodumpCol); + OutputStatsWriteHeader(sw, statDatFormat, baddumpCol, nodumpCol); // Init all total variables long totalSize = 0; @@ -7170,7 +7170,7 @@ namespace SabreTools.Helper.Dats if (lastdir != null && thisdir != lastdir) { // Output separator if needed - OutputStatsWriteMidSeparator(sw, statOutputFormat, baddumpCol, nodumpCol); + OutputStatsWriteMidSeparator(sw, statDatFormat, baddumpCol, nodumpCol); DatFile lastdirdat = new DatFile { @@ -7184,13 +7184,13 @@ namespace SabreTools.Helper.Dats BaddumpCount = dirBaddump, NodumpCount = dirNodump, }; - lastdirdat.OutputStats(sw, statOutputFormat, logger, game: dirGame, baddumpCol: baddumpCol, nodumpCol: nodumpCol); + lastdirdat.OutputStats(sw, statDatFormat, logger, game: dirGame, baddumpCol: baddumpCol, nodumpCol: nodumpCol); // Write the mid-footer, if any - OutputStatsWriteMidFooter(sw, statOutputFormat, baddumpCol, nodumpCol); + OutputStatsWriteMidFooter(sw, statDatFormat, baddumpCol, nodumpCol); // Write the header, if any - OutputStatsWriteMidHeader(sw, statOutputFormat, baddumpCol, nodumpCol); + OutputStatsWriteMidHeader(sw, statDatFormat, baddumpCol, nodumpCol); // Reset the directory stats dirSize = 0; @@ -7214,7 +7214,7 @@ namespace SabreTools.Helper.Dats logger.User("Adding stats for file '" + filename.Item1 + "'\n", false); if (single) { - datdata.OutputStats(sw, statOutputFormat, logger, baddumpCol: baddumpCol, nodumpCol: nodumpCol); + datdata.OutputStats(sw, statDatFormat, logger, baddumpCol: baddumpCol, nodumpCol: nodumpCol); } // Add single DAT stats to dir @@ -7244,7 +7244,7 @@ namespace SabreTools.Helper.Dats } // Output the directory stats one last time - OutputStatsWriteMidSeparator(sw, statOutputFormat, baddumpCol, nodumpCol); + OutputStatsWriteMidSeparator(sw, statDatFormat, baddumpCol, nodumpCol); if (single) { @@ -7260,14 +7260,14 @@ namespace SabreTools.Helper.Dats BaddumpCount = dirBaddump, NodumpCount = dirNodump, }; - dirdat.OutputStats(sw, statOutputFormat, logger, game: dirGame, baddumpCol: baddumpCol, nodumpCol: nodumpCol); + dirdat.OutputStats(sw, statDatFormat, logger, game: dirGame, baddumpCol: baddumpCol, nodumpCol: nodumpCol); } // Write the mid-footer, if any - OutputStatsWriteMidFooter(sw, statOutputFormat, baddumpCol, nodumpCol); + OutputStatsWriteMidFooter(sw, statDatFormat, baddumpCol, nodumpCol); // Write the header, if any - OutputStatsWriteMidHeader(sw, statOutputFormat, baddumpCol, nodumpCol); + OutputStatsWriteMidHeader(sw, statDatFormat, baddumpCol, nodumpCol); // Reset the directory stats dirSize = 0; @@ -7292,10 +7292,10 @@ namespace SabreTools.Helper.Dats BaddumpCount = totalBaddump, NodumpCount = totalNodump, }; - totaldata.OutputStats(sw, statOutputFormat, logger, game: totalGame, baddumpCol: baddumpCol, nodumpCol: nodumpCol); + totaldata.OutputStats(sw, statDatFormat, logger, game: totalGame, baddumpCol: baddumpCol, nodumpCol: nodumpCol); // Output footer if needed - OutputStatsWriteFooter(sw, statOutputFormat); + OutputStatsWriteFooter(sw, statDatFormat); sw.Flush(); sw.Dispose(); @@ -7307,24 +7307,24 @@ Please check the log folder if the stats scrolled offscreen", false); /// /// Get the proper extension for the stat output format /// - /// StatOutputFormat to get the extension for + /// StatDatFormat to get the extension for /// File extension with leading period - private static string OutputStatsGetExtension(StatOutputFormat statOutputFormat) + private static string OutputStatsGetExtension(StatDatFormat statDatFormat) { string reportExtension = ""; - switch (statOutputFormat) + switch (statDatFormat) { - case StatOutputFormat.CSV: + case StatDatFormat.CSV: reportExtension = ".csv"; break; - case StatOutputFormat.HTML: + case StatDatFormat.HTML: reportExtension = ".html"; break; - case StatOutputFormat.None: + case StatDatFormat.None: default: reportExtension = ".txt"; break; - case StatOutputFormat.TSV: + case StatDatFormat.TSV: reportExtension = ".csv"; break; } @@ -7335,17 +7335,17 @@ Please check the log folder if the stats scrolled offscreen", false); /// Write out the header to the stream, if any exists /// /// StreamWriter representing the output - /// StatOutputFormat representing output format + /// StatDatFormat representing output format /// True if baddumps should be included in output, false otherwise /// True if nodumps should be included in output, false otherwise - private static void OutputStatsWriteHeader(StreamWriter sw, StatOutputFormat statOutputFormat, bool baddumpCol, bool nodumpCol) + private static void OutputStatsWriteHeader(StreamWriter sw, StatDatFormat statDatFormat, bool baddumpCol, bool nodumpCol) { string head = ""; - switch (statOutputFormat) + switch (statDatFormat) { - case StatOutputFormat.CSV: + case StatDatFormat.CSV: break; - case StatOutputFormat.HTML: + case StatDatFormat.HTML: head = @"
@@ -7367,43 +7367,43 @@ Please check the log folder if the stats scrolled offscreen", false); "; break; - case StatOutputFormat.None: + case StatDatFormat.None: default: break; - case StatOutputFormat.TSV: + case StatDatFormat.TSV: break; } sw.Write(head); // Now write the mid header for those who need it - OutputStatsWriteMidHeader(sw, statOutputFormat, baddumpCol, nodumpCol); + OutputStatsWriteMidHeader(sw, statDatFormat, baddumpCol, nodumpCol); } /// /// Write out the mid-header to the stream, if any exists /// /// StreamWriter representing the output - /// StatOutputFormat representing output format + /// StatDatFormat representing output format /// True if baddumps should be included in output, false otherwise /// True if nodumps should be included in output, false otherwise - private static void OutputStatsWriteMidHeader(StreamWriter sw, StatOutputFormat statOutputFormat, bool baddumpCol, bool nodumpCol) + private static void OutputStatsWriteMidHeader(StreamWriter sw, StatDatFormat statDatFormat, bool baddumpCol, bool nodumpCol) { string head = ""; - switch (statOutputFormat) + switch (statDatFormat) { - case StatOutputFormat.CSV: + case StatDatFormat.CSV: head = "\"File Name\",\"Total Size\",\"Games\",\"Roms\",\"Disks\",\"# with CRC\",\"# with MD5\",\"# with SHA-1\"" + (baddumpCol ? ",\"BadDumps\"" : "") + (nodumpCol ? ",\"Nodumps\"" : "") + "\n"; break; - case StatOutputFormat.HTML: + case StatDatFormat.HTML: head = @" " + @"" + (baddumpCol ? "" : "") + (nodumpCol ? "" : "") + "\n"; break; - case StatOutputFormat.None: + case StatDatFormat.None: default: break; - case StatOutputFormat.TSV: + case StatDatFormat.TSV: head = "\"File Name\"\t\"Total Size\"\t\"Games\"\t\"Roms\"\t\"Disks\"\t\"# with CRC\"\t\"# with MD5\"\t\"# with SHA-1\"" + (baddumpCol ? "\t\"BadDumps\"" : "") + (nodumpCol ? "\t\"Nodumps\"" : "") + "\n"; break; @@ -7415,17 +7415,17 @@ Please check the log folder if the stats scrolled offscreen", false); /// Write out the separator to the stream, if any exists /// /// StreamWriter representing the output - /// StatOutputFormat representing output format + /// StatDatFormat representing output format /// True if baddumps should be included in output, false otherwise /// True if nodumps should be included in output, false otherwise - private static void OutputStatsWriteMidSeparator(StreamWriter sw, StatOutputFormat statOutputFormat, bool baddumpCol, bool nodumpCol) + private static void OutputStatsWriteMidSeparator(StreamWriter sw, StatDatFormat statDatFormat, bool baddumpCol, bool nodumpCol) { string mid = ""; - switch (statOutputFormat) + switch (statDatFormat) { - case StatOutputFormat.CSV: + case StatDatFormat.CSV: break; - case StatOutputFormat.HTML: + case StatDatFormat.HTML: mid = "\n"; break; - case StatOutputFormat.None: + case StatDatFormat.None: default: break; } @@ -7446,18 +7446,18 @@ Please check the log folder if the stats scrolled offscreen", false); /// Write out the footer-separator to the stream, if any exists /// /// StreamWriter representing the output - /// StatOutputFormat representing output format + /// StatDatFormat representing output format /// True if baddumps should be included in output, false otherwise /// True if nodumps should be included in output, false otherwise - private static void OutputStatsWriteMidFooter(StreamWriter sw, StatOutputFormat statOutputFormat, bool baddumpCol, bool nodumpCol) + private static void OutputStatsWriteMidFooter(StreamWriter sw, StatDatFormat statDatFormat, bool baddumpCol, bool nodumpCol) { string end = ""; - switch (statOutputFormat) + switch (statDatFormat) { - case StatOutputFormat.CSV: + case StatDatFormat.CSV: end = "\n"; break; - case StatOutputFormat.HTML: + case StatDatFormat.HTML: end = "\n"; break; - case StatOutputFormat.None: + case StatDatFormat.None: default: end = "\n"; break; - case StatOutputFormat.TSV: + case StatDatFormat.TSV: end = "\n"; break; } @@ -7482,24 +7482,24 @@ Please check the log folder if the stats scrolled offscreen", false); /// Write out the footer to the stream, if any exists /// /// StreamWriter representing the output - /// StatOutputFormat representing output format - private static void OutputStatsWriteFooter(StreamWriter sw, StatOutputFormat statOutputFormat) + /// StatDatFormat representing output format + private static void OutputStatsWriteFooter(StreamWriter sw, StatDatFormat statDatFormat) { string end = ""; - switch (statOutputFormat) + switch (statDatFormat) { - case StatOutputFormat.CSV: + case StatDatFormat.CSV: break; - case StatOutputFormat.HTML: + case StatDatFormat.HTML: end = @"
File NameTotal SizeGamesRomsDisks# with CRC# with MD5# with SHA-1BaddumpsNodumps
"; break; - case StatOutputFormat.None: + case StatDatFormat.None: default: break; - case StatOutputFormat.TSV: + case StatDatFormat.TSV: break; } sw.Write(end); diff --git a/SabreTools.Helper/Tools/FileTools.cs b/SabreTools.Helper/Tools/FileTools.cs index ad32668a..cee14e33 100644 --- a/SabreTools.Helper/Tools/FileTools.cs +++ b/SabreTools.Helper/Tools/FileTools.cs @@ -51,9 +51,9 @@ namespace SabreTools.Helper.Tools /// Get what type of DAT the input file is /// /// Name of the file to be parsed - /// The OutputFormat corresponding to the DAT + /// The DatFormat corresponding to the DAT /// There is currently no differentiation between XML and SabreDAT here - public static OutputFormat GetOutputFormat(string filename, Logger logger) + public static DatFormat GetDatFormat(string filename, Logger logger) { // Limit the output formats based on extension string ext = Path.GetExtension(filename).ToLowerInvariant(); @@ -79,15 +79,15 @@ namespace SabreTools.Helper.Tools // Some formats only require the extension to know if (ext == "md5") { - return OutputFormat.RedumpMD5; + return DatFormat.RedumpMD5; } if (ext == "sfv") { - return OutputFormat.RedumpSFV; + return DatFormat.RedumpSFV; } if (ext == "sha1") { - return OutputFormat.RedumpSHA1; + return DatFormat.RedumpSHA1; } // For everything else, we need to read it @@ -104,49 +104,49 @@ namespace SabreTools.Helper.Tools { if (second.StartsWith("DAT information /// True if we ignore existing files (default), false otherwise /// Dictionary of output formats mapped to file names - public static Dictionary CreateOutfileNames(string outDir, DatFile datdata, bool overwrite = true) + public static Dictionary CreateOutfileNames(string outDir, DatFile datdata, bool overwrite = true) { // Create the output dictionary - Dictionary outfileNames = new Dictionary(); + Dictionary outfileNames = new Dictionary(); // Double check the outDir for the end delim if (!outDir.EndsWith(Path.DirectorySeparatorChar.ToString())) @@ -39,117 +39,117 @@ namespace SabreTools.Helper.Tools // Get the extensions from the output type // ClrMamePro - if ((datdata.OutputFormat & OutputFormat.ClrMamePro) != 0) + if ((datdata.DatFormat & DatFormat.ClrMamePro) != 0) { - outfileNames.Add(OutputFormat.ClrMamePro, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite)); + outfileNames.Add(DatFormat.ClrMamePro, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite)); }; // CSV - if ((datdata.OutputFormat & OutputFormat.CSV) != 0) + if ((datdata.DatFormat & DatFormat.CSV) != 0) { - outfileNames.Add(OutputFormat.CSV, CreateOutfileNamesHelper(outDir, ".csv", datdata, overwrite)); + outfileNames.Add(DatFormat.CSV, CreateOutfileNamesHelper(outDir, ".csv", datdata, overwrite)); }; // DOSCenter - if ((datdata.OutputFormat & OutputFormat.DOSCenter) != 0 - && (datdata.OutputFormat & OutputFormat.ClrMamePro) == 0 - && (datdata.OutputFormat & OutputFormat.RomCenter) == 0) + if ((datdata.DatFormat & DatFormat.DOSCenter) != 0 + && (datdata.DatFormat & DatFormat.ClrMamePro) == 0 + && (datdata.DatFormat & DatFormat.RomCenter) == 0) { - outfileNames.Add(OutputFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite)); + outfileNames.Add(DatFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite)); }; - if ((datdata.OutputFormat & OutputFormat.DOSCenter) != 0 - && ((datdata.OutputFormat & OutputFormat.ClrMamePro) != 0 - || (datdata.OutputFormat & OutputFormat.RomCenter) != 0)) + if ((datdata.DatFormat & DatFormat.DOSCenter) != 0 + && ((datdata.DatFormat & DatFormat.ClrMamePro) != 0 + || (datdata.DatFormat & DatFormat.RomCenter) != 0)) { - outfileNames.Add(OutputFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dc.dat", datdata, overwrite)); + outfileNames.Add(DatFormat.DOSCenter, CreateOutfileNamesHelper(outDir, ".dc.dat", datdata, overwrite)); }; // Logiqx XML - if ((datdata.OutputFormat & OutputFormat.Logiqx) != 0) + if ((datdata.DatFormat & DatFormat.Logiqx) != 0) { - outfileNames.Add(OutputFormat.Logiqx, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite)); + outfileNames.Add(DatFormat.Logiqx, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite)); }; // Missfile - if ((datdata.OutputFormat & OutputFormat.MissFile) != 0) + if ((datdata.DatFormat & DatFormat.MissFile) != 0) { - outfileNames.Add(OutputFormat.MissFile, CreateOutfileNamesHelper(outDir, ".txt", datdata, overwrite)); + outfileNames.Add(DatFormat.MissFile, CreateOutfileNamesHelper(outDir, ".txt", datdata, overwrite)); }; // OfflineList - if (((datdata.OutputFormat & OutputFormat.OfflineList) != 0) - && (datdata.OutputFormat & OutputFormat.Logiqx) == 0 - && (datdata.OutputFormat & OutputFormat.SabreDat) == 0 - && (datdata.OutputFormat & OutputFormat.SoftwareList) == 0) + if (((datdata.DatFormat & DatFormat.OfflineList) != 0) + && (datdata.DatFormat & DatFormat.Logiqx) == 0 + && (datdata.DatFormat & DatFormat.SabreDat) == 0 + && (datdata.DatFormat & DatFormat.SoftwareList) == 0) { - outfileNames.Add(OutputFormat.OfflineList, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite)); + outfileNames.Add(DatFormat.OfflineList, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite)); } - if (((datdata.OutputFormat & OutputFormat.OfflineList) != 0 - && ((datdata.OutputFormat & OutputFormat.Logiqx) != 0 - || (datdata.OutputFormat & OutputFormat.SabreDat) != 0 - || (datdata.OutputFormat & OutputFormat.SoftwareList) != 0))) + if (((datdata.DatFormat & DatFormat.OfflineList) != 0 + && ((datdata.DatFormat & DatFormat.Logiqx) != 0 + || (datdata.DatFormat & DatFormat.SabreDat) != 0 + || (datdata.DatFormat & DatFormat.SoftwareList) != 0))) { - outfileNames.Add(OutputFormat.OfflineList, CreateOutfileNamesHelper(outDir, ".ol.xml", datdata, overwrite)); + outfileNames.Add(DatFormat.OfflineList, CreateOutfileNamesHelper(outDir, ".ol.xml", datdata, overwrite)); } // Redump MD5 - if ((datdata.OutputFormat & OutputFormat.RedumpMD5) != 0) + if ((datdata.DatFormat & DatFormat.RedumpMD5) != 0) { - outfileNames.Add(OutputFormat.RedumpMD5, CreateOutfileNamesHelper(outDir, ".md5", datdata, overwrite)); + outfileNames.Add(DatFormat.RedumpMD5, CreateOutfileNamesHelper(outDir, ".md5", datdata, overwrite)); }; // Redump SFV - if ((datdata.OutputFormat & OutputFormat.RedumpSFV) != 0) + if ((datdata.DatFormat & DatFormat.RedumpSFV) != 0) { - outfileNames.Add(OutputFormat.RedumpSFV, CreateOutfileNamesHelper(outDir, ".sfv", datdata, overwrite)); + outfileNames.Add(DatFormat.RedumpSFV, CreateOutfileNamesHelper(outDir, ".sfv", datdata, overwrite)); }; // Redump SHA-1 - if ((datdata.OutputFormat & OutputFormat.RedumpSHA1) != 0) + if ((datdata.DatFormat & DatFormat.RedumpSHA1) != 0) { - outfileNames.Add(OutputFormat.RedumpSHA1, CreateOutfileNamesHelper(outDir, ".sha1", datdata, overwrite)); + outfileNames.Add(DatFormat.RedumpSHA1, CreateOutfileNamesHelper(outDir, ".sha1", datdata, overwrite)); }; // RomCenter - if ((datdata.OutputFormat & OutputFormat.RomCenter) != 0 - && (datdata.OutputFormat & OutputFormat.ClrMamePro) == 0) + if ((datdata.DatFormat & DatFormat.RomCenter) != 0 + && (datdata.DatFormat & DatFormat.ClrMamePro) == 0) { - outfileNames.Add(OutputFormat.RomCenter, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite)); + outfileNames.Add(DatFormat.RomCenter, CreateOutfileNamesHelper(outDir, ".dat", datdata, overwrite)); }; - if ((datdata.OutputFormat & OutputFormat.RomCenter) != 0 - && (datdata.OutputFormat & OutputFormat.ClrMamePro) != 0) + if ((datdata.DatFormat & DatFormat.RomCenter) != 0 + && (datdata.DatFormat & DatFormat.ClrMamePro) != 0) { - outfileNames.Add(OutputFormat.RomCenter, CreateOutfileNamesHelper(outDir, ".rc.dat", datdata, overwrite)); + outfileNames.Add(DatFormat.RomCenter, CreateOutfileNamesHelper(outDir, ".rc.dat", datdata, overwrite)); }; // SabreDAT - if ((datdata.OutputFormat & OutputFormat.SabreDat) != 0 && (datdata.OutputFormat & OutputFormat.Logiqx) == 0) + if ((datdata.DatFormat & DatFormat.SabreDat) != 0 && (datdata.DatFormat & DatFormat.Logiqx) == 0) { - outfileNames.Add(OutputFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite)); + outfileNames.Add(DatFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite)); }; - if ((datdata.OutputFormat & OutputFormat.SabreDat) != 0 && (datdata.OutputFormat & OutputFormat.Logiqx) != 0) + if ((datdata.DatFormat & DatFormat.SabreDat) != 0 && (datdata.DatFormat & DatFormat.Logiqx) != 0) { - outfileNames.Add(OutputFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".sd.xml", datdata, overwrite)); + outfileNames.Add(DatFormat.SabreDat, CreateOutfileNamesHelper(outDir, ".sd.xml", datdata, overwrite)); }; // Software List - if ((datdata.OutputFormat & OutputFormat.SoftwareList) != 0 - && (datdata.OutputFormat & OutputFormat.Logiqx) == 0 - && (datdata.OutputFormat & OutputFormat.SabreDat) == 0) + if ((datdata.DatFormat & DatFormat.SoftwareList) != 0 + && (datdata.DatFormat & DatFormat.Logiqx) == 0 + && (datdata.DatFormat & DatFormat.SabreDat) == 0) { - outfileNames.Add(OutputFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite)); + outfileNames.Add(DatFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".xml", datdata, overwrite)); } - if ((datdata.OutputFormat & OutputFormat.SoftwareList) != 0 - && ((datdata.OutputFormat & OutputFormat.Logiqx) != 0 - || (datdata.OutputFormat & OutputFormat.SabreDat) != 0)) + if ((datdata.DatFormat & DatFormat.SoftwareList) != 0 + && ((datdata.DatFormat & DatFormat.Logiqx) != 0 + || (datdata.DatFormat & DatFormat.SabreDat) != 0)) { - outfileNames.Add(OutputFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".sl.xml", datdata, overwrite)); + outfileNames.Add(DatFormat.SoftwareList, CreateOutfileNamesHelper(outDir, ".sl.xml", datdata, overwrite)); } // TSV - if ((datdata.OutputFormat & OutputFormat.TSV) != 0) + if ((datdata.DatFormat & DatFormat.TSV) != 0) { - outfileNames.Add(OutputFormat.TSV, CreateOutfileNamesHelper(outDir, ".tsv", datdata, overwrite)); + outfileNames.Add(DatFormat.TSV, CreateOutfileNamesHelper(outDir, ".tsv", datdata, overwrite)); }; return outfileNames; diff --git a/SabreTools/Partials/SabreTools_Inits.cs b/SabreTools/Partials/SabreTools_Inits.cs index 81766f9b..6df2bc6d 100644 --- a/SabreTools/Partials/SabreTools_Inits.cs +++ b/SabreTools/Partials/SabreTools_Inits.cs @@ -79,7 +79,7 @@ namespace SabreTools /// New author /// String representing the forcepacking flag /// True if cloneof, romof, and sampleof fields should be omitted from output, false otherwise - /// OutputFormat to be used for outputting the DAT + /// DatFormat to be used for outputting the DAT /// True to enable reading a directory like a Romba depot, false otherwise /// True to enable SuperDAT-style reading, false otherwise /// True to disable getting MD5 hash, false otherwise @@ -103,7 +103,7 @@ namespace SabreTools string author, string forcepack, bool excludeOf, - OutputFormat outputFormat, + DatFormat datFormat, bool romba, bool superdat, bool noMD5, @@ -145,7 +145,7 @@ namespace SabreTools Date = DateTime.Now.ToString("yyyy-MM-dd"), Author = author, ForcePacking = fp, - OutputFormat = (outputFormat == 0 ? OutputFormat.Logiqx : outputFormat), + DatFormat = (datFormat == 0 ? DatFormat.Logiqx : datFormat), Romba = romba, ExcludeOf = excludeOf, Type = (superdat ? "SuperDAT" : ""), @@ -348,10 +348,10 @@ namespace SabreTools /// True to show individual DAT statistics, false otherwise /// True if baddumps should be included in output, false otherwise /// True if nodumps should be included in output, false otherwise - /// Set the statistics output format to use - private static void InitStats(List inputs, string filename, bool single, bool baddumpCol, bool nodumpCol, StatOutputFormat statOutputFormat) + /// Set the statistics output format to use + private static void InitStats(List inputs, string filename, bool single, bool baddumpCol, bool nodumpCol, StatDatFormat statDatFormat) { - DatFile.OutputStats(inputs, (String.IsNullOrEmpty(filename) ? "report" : filename), single, baddumpCol, nodumpCol, statOutputFormat, _logger); + DatFile.OutputStats(inputs, (String.IsNullOrEmpty(filename) ? "report" : filename), single, baddumpCol, nodumpCol, statDatFormat, _logger); } /// @@ -412,7 +412,7 @@ namespace SabreTools /// None, Obsolete, Required, Ignore /// None, Zip, Unzip /// True if cloneof, romof, and sampleof fields should be omitted from output, false otherwise - /// Non-zero flag for output format, zero otherwise for default + /// Non-zero flag for output format, zero otherwise for default /// /* Missfile-specific DAT info */ /// True if games are to be used in output, false if roms are /// Generic prefix to be added to each line @@ -471,7 +471,7 @@ namespace SabreTools string forcend, string forcepack, bool excludeOf, - OutputFormat outputFormat, + DatFormat datFormat, /* Missfile-specific DAT info */ bool usegame, @@ -646,7 +646,7 @@ namespace SabreTools ForcePacking = fp, MergeRoms = dedup, ExcludeOf = excludeOf, - OutputFormat = outputFormat, + DatFormat = datFormat, UseGame = usegame, Prefix = prefix, diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs index 888440ad..d490627f 100644 --- a/SabreTools/SabreTools.cs +++ b/SabreTools/SabreTools.cs @@ -95,8 +95,8 @@ namespace SabreTools updateDat = false, // SimpleSort usegame = true; DiffMode diffMode = 0x0; - OutputFormat outputFormat = 0x0; - StatOutputFormat statOutputFormat = StatOutputFormat.None; + DatFormat datFormat = 0x0; + StatDatFormat statDatFormat = StatDatFormat.None; // User inputs int gz = 2, // SimpleSort @@ -222,7 +222,7 @@ namespace SabreTools break; case "-csv": case "--csv": - statOutputFormat = StatOutputFormat.CSV; + statDatFormat = StatDatFormat.CSV; break; case "-dd": case "--dedup": @@ -266,7 +266,7 @@ namespace SabreTools break; case "-html": case "--html": - statOutputFormat = StatOutputFormat.HTML; + statDatFormat = StatDatFormat.HTML; break; case "-ip": case "--inplace": @@ -290,59 +290,59 @@ namespace SabreTools break; case "-oa": case "--output-all": - outputFormat |= OutputFormat.ALL; + datFormat |= DatFormat.ALL; break; case "-oc": case "--output-cmp": - outputFormat |= OutputFormat.ClrMamePro; + datFormat |= DatFormat.ClrMamePro; break; case "-ocsv": case "--output-csv": - outputFormat |= OutputFormat.CSV; + datFormat |= DatFormat.CSV; break; case "-od": case "--output-dc": - outputFormat |= OutputFormat.DOSCenter; + datFormat |= DatFormat.DOSCenter; break; case "-om": case "--output-miss": - outputFormat |= OutputFormat.MissFile; + datFormat |= DatFormat.MissFile; break; case "-omd5": case "--output-md5": - outputFormat |= OutputFormat.RedumpMD5; + datFormat |= DatFormat.RedumpMD5; break; case "-ool": case "--output-ol": - outputFormat |= OutputFormat.OfflineList; + datFormat |= DatFormat.OfflineList; break; case "-or": case "--output-rc": - outputFormat |= OutputFormat.RomCenter; + datFormat |= DatFormat.RomCenter; break; case "-os": case "--output-sd": - outputFormat |= OutputFormat.SabreDat; + datFormat |= DatFormat.SabreDat; break; case "-osfv": case "--output-sfv": - outputFormat |= OutputFormat.RedumpSFV; + datFormat |= DatFormat.RedumpSFV; break; case "-osha1": case "--output-sha1": - outputFormat |= OutputFormat.RedumpSHA1; + datFormat |= DatFormat.RedumpSHA1; break; case "-osl": case "--output-sl": - outputFormat |= OutputFormat.SoftwareList; + datFormat |= DatFormat.SoftwareList; break; case "-otsv": case "--output-tsv": - outputFormat |= OutputFormat.TSV; + datFormat |= DatFormat.TSV; break; case "-ox": case "--output-xml": - outputFormat |= OutputFormat.Logiqx; + datFormat |= DatFormat.Logiqx; break; case "-q": case "--quotes": @@ -398,7 +398,7 @@ namespace SabreTools break; case "-tsv": case "--tsv": - statOutputFormat = StatOutputFormat.TSV; + statDatFormat = StatDatFormat.TSV; break; case "-ud": case "--update": @@ -957,7 +957,7 @@ namespace SabreTools author, forcepack, excludeOf, - outputFormat, + datFormat, romba, superdat, noMD5, @@ -1008,14 +1008,14 @@ namespace SabreTools // Get statistics on input files else if (stats) { - InitStats(inputs, filename, single, showBaddumpColumn, showNodumpColumn, statOutputFormat); + InitStats(inputs, filename, single, showBaddumpColumn, showNodumpColumn, statDatFormat); } // Convert, update, merge, diff, and filter a DAT or folder of DATs else if (update) { InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header, - superdat, forcemerge, forcend, forcepack, excludeOf, outputFormat, usegame, prefix, + superdat, forcemerge, forcend, forcepack, excludeOf, datFormat, usegame, prefix, postfix, quotes, repext, addext, remext, datPrefix, romba, merge, diffMode, inplace, skip, removeDateFromAutomaticName, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, status, trim, single, root, outDir, cleanGameNames, softlist, dedup, maxParallelism); }