diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs index fe152cfa..cc7239ce 100644 --- a/SabreTools.Library/DatFiles/DatFile.cs +++ b/SabreTools.Library/DatFiles/DatFile.cs @@ -603,7 +603,7 @@ namespace SabreTools.Library.DatFiles _datHeader.Quotes = value; } } - public string RepExt + public string ReplaceExtension { get { @@ -612,7 +612,7 @@ namespace SabreTools.Library.DatFiles _datHeader = new DatHeader(); } - return _datHeader.RepExt; + return _datHeader.ReplaceExtension; } set { @@ -621,10 +621,10 @@ namespace SabreTools.Library.DatFiles _datHeader = new DatHeader(); } - _datHeader.RepExt = value; + _datHeader.ReplaceExtension = value; } } - public string AddExt + public string AddExtension { get { @@ -633,7 +633,7 @@ namespace SabreTools.Library.DatFiles _datHeader = new DatHeader(); } - return _datHeader.AddExt; + return _datHeader.AddExtension; } set { @@ -642,10 +642,10 @@ namespace SabreTools.Library.DatFiles _datHeader = new DatHeader(); } - _datHeader.AddExt = value; + _datHeader.AddExtension = value; } } - public bool RemExt + public bool RemoveExtension { get { @@ -654,7 +654,7 @@ namespace SabreTools.Library.DatFiles _datHeader = new DatHeader(); } - return _datHeader.RemExt; + return _datHeader.RemoveExtension; } set { @@ -663,7 +663,7 @@ namespace SabreTools.Library.DatFiles _datHeader = new DatHeader(); } - _datHeader.RemExt = value; + _datHeader.RemoveExtension = value; } } public bool GameName @@ -1553,6 +1553,15 @@ namespace SabreTools.Library.DatFiles _datHeader = (DatHeader)datFile._datHeader.Clone(); } + /// + /// Create a new DatFile from an existing DatHeader + /// + /// + public DatFile(DatHeader datHeader) + { + _datHeader = (DatHeader)datHeader.Clone(); + } + #endregion #region Converting and Updating diff --git a/SabreTools.Library/DatFiles/DatHeader.cs b/SabreTools.Library/DatFiles/DatHeader.cs index 1b5c15f9..abc145e1 100644 --- a/SabreTools.Library/DatFiles/DatHeader.cs +++ b/SabreTools.Library/DatFiles/DatHeader.cs @@ -184,17 +184,17 @@ namespace SabreTools.Library.DatFiles get { return _quotes; } set { _quotes = value; } } - public string RepExt + public string ReplaceExtension { get { return _repExt; } set { _repExt = value; } } - public string AddExt + public string AddExtension { get { return _addExt; } set { _addExt = value; } } - public bool RemExt + public bool RemoveExtension { get { return _remExt; } set { _remExt = value; } diff --git a/SabreTools.Library/DatFiles/Missfile.cs b/SabreTools.Library/DatFiles/Missfile.cs index 35838234..9a2ac902 100644 --- a/SabreTools.Library/DatFiles/Missfile.cs +++ b/SabreTools.Library/DatFiles/Missfile.cs @@ -269,20 +269,20 @@ namespace SabreTools.Library.DatFiles else { name = (UseGame ? rom.MachineName : rom.Name); - if (RepExt != "" || RemExt) + if (ReplaceExtension != "" || RemoveExtension) { - if (RemExt) + if (RemoveExtension) { - RepExt = ""; + ReplaceExtension = ""; } string dir = Path.GetDirectoryName(name); dir = (dir.StartsWith(Path.DirectorySeparatorChar.ToString()) ? dir.Remove(0, 1) : dir); - name = Path.Combine(dir, Path.GetFileNameWithoutExtension(name) + RepExt); + name = Path.Combine(dir, Path.GetFileNameWithoutExtension(name) + ReplaceExtension); } - if (AddExt != "") + if (AddExtension != "") { - name += AddExt; + name += AddExtension; } if (!UseGame && GameName) { diff --git a/SabreTools/SabreTools.Inits.cs b/SabreTools/SabreTools.Inits.cs index 8945d6fc..0038c221 100644 --- a/SabreTools/SabreTools.Inits.cs +++ b/SabreTools/SabreTools.Inits.cs @@ -24,23 +24,8 @@ namespace SabreTools /// /// List of input filenames /// /* Normal DAT header info */ - /// New filename - /// New name - /// New description - /// New category - /// New version - /// New author - /// New email - /// New homepage - /// New URL - /// New comment - /// String representing the forcepacking flag - /// True if cloneof, romof, and sampleof fields should be omitted from output, false otherwise - /// True if scene-named sets have the date stripped from the beginning, false otherwise - /// DatFormat to be used for outputting the DAT + /// All DatHeader info to be used /// /* Standard DFD info */ - /// True to enable reading a directory like a Romba depot, false otherwise - /// True to enable SuperDAT-style reading, false otherwise /// Hash flag saying what hashes should not be calculated /// True if the date should be omitted from the DAT, false otherwise /// True if archives should be treated as files, false otherwise @@ -51,28 +36,12 @@ namespace SabreTools /// Name of the directory to create a temp folder in (blank is default temp directory) /// Name of the directory to output the DAT to (blank is the current directory) /// True if files should be copied to the temp directory before hashing, false otherwise - /// Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise /// True if CHDs should be treated like regular files, false otherwise private static void InitDatFromDir(List inputs, /* Normal DAT header info */ - string filename, - string name, - string description, - string category, - string version, - string author, - string email, - string homepage, - string url, - string comment, - string forcepack, - bool excludeOf, - bool sceneDateStrip, - DatFormat datFormat, + DatHeader datHeader, /* Standard DFD info */ - bool romba, - bool superdat, Hash omitFromScan, bool removeDateFromAutomaticName, bool archivesAsFiles, @@ -84,31 +53,12 @@ namespace SabreTools string tempDir, string outDir, bool copyFiles, - string headerToCheckAgainst, bool chdsAsFiles) { - ForcePacking fp = Utilities.GetForcePacking(forcepack); - // Create a new DATFromDir object and process the inputs - DatFile basedat = new DatFile + DatFile basedat = new DatFile(datHeader) { - FileName = filename, - Name = name, - Description = description, - Category = category, - Version = version, Date = DateTime.Now.ToString("yyyy-MM-dd"), - Author = author, - Email = email, - Homepage = homepage, - Url = url, - Comment = comment, - ForcePacking = fp, - DatFormat = (datFormat == 0 ? DatFormat.Logiqx : datFormat), - Romba = romba, - ExcludeOf = excludeOf, - SceneDateStrip = sceneDateStrip, - Type = (superdat ? "SuperDAT" : ""), }; // For each input directory, create a DAT @@ -121,7 +71,7 @@ namespace SabreTools string basePath = Path.GetFullPath(path); bool success = datdata.PopulateFromDir(basePath, omitFromScan, removeDateFromAutomaticName, archivesAsFiles, - skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, copyFiles, headerToCheckAgainst, chdsAsFiles); + skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, copyFiles, datHeader.Header, chdsAsFiles); // If it was a success, write the DAT out if (success) @@ -269,36 +219,7 @@ namespace SabreTools /// List of input filenames /// List of base filenames /// /* Normal DAT header info */ - /// New filename - /// New name - /// New description - /// New rootdir - /// New category - /// New version - /// New date - /// New author - /// New email - /// New homepage - /// New URL - /// New comment - /// New header - /// True to set SuperDAT type, false otherwise - /// None, Split, Full - /// None, Obsolete, Required, Ignore - /// None, Zip, Unzip - /// True if cloneof, romof, and sampleof fields should be omitted from output, false otherwise - /// True if scene-named sets have the date stripped from the beginning, false otherwise - /// 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 - /// Generic postfix to be added to each line - /// Add quotes to each item - /// Replace all extensions with another - /// Add an extension to all items - /// Remove all extensions - /// Add the dat name as a directory prefix - /// Output files in romba format + /// All DatHeader info to be used /// /* Merging and Diffing info */ /// Non-zero flag for diffing mode, zero otherwise /// True if the cascade-diffed files should overwrite their inputs, false otherwise @@ -312,44 +233,12 @@ namespace SabreTools /// True to clean the game names to WoD standard, false otherwise (default) /// True if we should remove non-ASCII characters from output, false otherwise (default) /// True if descriptions should be used as names, false otherwise (default) - /// Dedupe type to use for DAT processing - /// StripHash that represents the hash(es) that you want to remove from the output private static void InitUpdate( List inputPaths, List basePaths, /* Normal DAT header info */ - string filename, - string name, - string description, - string rootdir, - string category, - string version, - string date, - string author, - string email, - string homepage, - string url, - string comment, - string header, - bool superdat, - string forcemerge, - string forcend, - string forcepack, - bool excludeOf, - bool sceneDateStrip, - DatFormat datFormat, - - /* Missfile-specific DAT info */ - bool usegame, - string prefix, - string postfix, - bool quotes, - string repext, - string addext, - bool remext, - bool datprefix, - bool romba, + DatHeader datHeader, /* Merging and Diffing info */ UpdateMode updateMode, @@ -365,85 +254,52 @@ namespace SabreTools string outDir, bool clean, bool remUnicode, - bool descAsName, - DedupeType dedup, - Hash stripHash) + bool descAsName) { - // Set the special flags - ForceMerging fm = Utilities.GetForceMerging(forcemerge); - ForceNodump fn = Utilities.GetForceNodump(forcend); - ForcePacking fp = Utilities.GetForcePacking(forcepack); - // Normalize the extensions - addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext); - repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext); + datHeader.AddExtension = (datHeader.AddExtension == "" || datHeader.AddExtension.StartsWith(".") + ? datHeader.AddExtension + : "." + datHeader.AddExtension); + datHeader.ReplaceExtension = (datHeader.ReplaceExtension == "" || datHeader.ReplaceExtension.StartsWith(".") + ? datHeader.ReplaceExtension + : "." + datHeader.ReplaceExtension); // If we're in a special update mode and the names aren't set, set defaults if (updateMode != 0) { // Get the values that will be used - if (date == "") + if (datHeader.Date == "") { - date = DateTime.Now.ToString("yyyy-MM-dd"); + datHeader.Date = DateTime.Now.ToString("yyyy-MM-dd"); } - if (name == "") + if (datHeader.Name == "") { - name = (updateMode != 0 ? "DiffDAT" : "MergeDAT") + (superdat ? "-SuperDAT" : "") + (dedup != DedupeType.None ? "-deduped" : ""); + datHeader.Name = (updateMode != 0 ? "DiffDAT" : "MergeDAT") + + (datHeader.Type == "SuperDAT" ? "-SuperDAT" : "") + + (datHeader.DedupeRoms != DedupeType.None ? "-deduped" : ""); } - if (description == "") + if (datHeader.Description == "") { - description = (updateMode != 0 ? "DiffDAT" : "MergeDAT") + (superdat ? "-SuperDAT" : "") + (dedup != DedupeType.None ? " - deduped" : ""); + datHeader.Description = (updateMode != 0 ? "DiffDAT" : "MergeDAT") + + (datHeader.Type == "SuperDAT" ? "-SuperDAT" : "") + + (datHeader.DedupeRoms != DedupeType.None ? " - deduped" : ""); if (!bare) { - description += " (" + date + ")"; + datHeader.Description += " (" + datHeader.Date + ")"; } } - if (category == "" && updateMode != 0) + if (datHeader.Category == "" && updateMode != 0) { - category = "DiffDAT"; + datHeader.Category = "DiffDAT"; } - if (author == "") + if (datHeader.Author == "") { - author = "SabreTools"; + datHeader.Author = "SabreTools"; } } // Populate the DatData object - DatFile userInputDat = new DatFile - { - FileName = filename, - Name = name, - Description = description, - RootDir = rootdir, - Category = category, - Version = version, - Date = date, - Author = author, - Email = email, - Homepage = homepage, - Url = url, - Comment = comment, - Header = header, - Type = (superdat ? "SuperDAT" : null), - ForceMerging = fm, - ForceNodump = fn, - ForcePacking = fp, - DedupeRoms = dedup, - ExcludeOf = excludeOf, - SceneDateStrip = sceneDateStrip, - DatFormat = datFormat, - StripHash = stripHash, - - UseGame = usegame, - Prefix = prefix, - Postfix = postfix, - Quotes = quotes, - RepExt = repext, - AddExt = addext, - RemExt = remext, - GameName = datprefix, - Romba = romba, - }; + DatFile userInputDat = new DatFile(datHeader); userInputDat.DetermineUpdateType(inputPaths, basePaths, outDir, updateMode, inplace, skip, bare, clean, remUnicode, descAsName, filter, splitType); diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs index faf832b0..2293ee3c 100644 --- a/SabreTools/SabreTools.cs +++ b/SabreTools/SabreTools.cs @@ -90,33 +90,22 @@ namespace SabreTools chdsAsFiles = false, cleanGameNames = false, copyFiles = false, - datPrefix = false, delete = false, depot = false, descAsName = false, - excludeOf = false, hashOnly = false, inplace = false, inverse = false, nostore = false, quickScan = false, - quotes = false, - remext = false, removeDateFromAutomaticName = false, removeUnicode = false, - romba = false, - sceneDateStrip = false, showBaddumpColumn = false, showNodumpColumn = false, shortname = false, - superdat = false, skip = false, - updateDat = false, - usegame = true; - DatFormat datFormat = 0x0; - DedupeType dedup = DedupeType.None; + updateDat = false; Hash omitFromScan = Hash.DeepHashes; // TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually - Hash stripHash = 0x0; OutputFormat outputFormat = OutputFormat.Folder; SkipFileType skipFileType = SkipFileType.None; SplittingMode splittingMode = SplittingMode.None; @@ -129,28 +118,9 @@ namespace SabreTools rar = 1, sevenzip = 1, zip = 1; - string addext = "", - author = null, - category = null, - comment = null, - date = null, - description = null, - email = null, - filename = null, - forcemerge = "", - forcend = "", - forcepack = "", - header = null, - homepage = null, - name = null, - outDir = null, - postfix = "", - prefix = "", - repext = "", - rootdir = null, - tempDir = "", - url = null, - version = null; + string outDir = null, + tempDir = ""; + DatHeader datHeader = new DatHeader(); Filter filter = new Filter(); List basePaths = new List(); List datfiles = new List(); @@ -291,7 +261,7 @@ namespace SabreTools descAsName = true; break; case "dedup": - dedup = DedupeType.Full; + datHeader.DedupeRoms = DedupeType.Full; break; case "delete": delete = true; @@ -333,10 +303,10 @@ namespace SabreTools archivesAsFiles = true; break; case "game-dedup": - dedup = DedupeType.Game; + datHeader.DedupeRoms = DedupeType.Game; break; case "game-prefix": - datPrefix = true; + datHeader.GameName = true; break; case "hash-only": hashOnly = true; @@ -387,73 +357,73 @@ namespace SabreTools nostore = true; break; case "output-all": - datFormat |= DatFormat.ALL; + datHeader.DatFormat |= DatFormat.ALL; break; case "output-am": - datFormat |= DatFormat.AttractMode; + datHeader.DatFormat |= DatFormat.AttractMode; break; case "output-cmp": - datFormat |= DatFormat.ClrMamePro; + datHeader.DatFormat |= DatFormat.ClrMamePro; break; case "output-csv": - datFormat |= DatFormat.CSV; + datHeader.DatFormat |= DatFormat.CSV; break; case "output-dc": - datFormat |= DatFormat.DOSCenter; + datHeader.DatFormat |= DatFormat.DOSCenter; break; case "of-as-game": filter.IncludeOfInGame = true; break; case "output-lr": - datFormat |= DatFormat.Listroms; + datHeader.DatFormat |= DatFormat.Listroms; break; case "output-miss": - datFormat |= DatFormat.MissFile; + datHeader.DatFormat |= DatFormat.MissFile; break; case "output-md5": - datFormat |= DatFormat.RedumpMD5; + datHeader.DatFormat |= DatFormat.RedumpMD5; break; case "output-ol": - datFormat |= DatFormat.OfflineList; + datHeader.DatFormat |= DatFormat.OfflineList; break; case "output-rc": - datFormat |= DatFormat.RomCenter; + datHeader.DatFormat |= DatFormat.RomCenter; break; case "output-sd": - datFormat |= DatFormat.SabreDat; + datHeader.DatFormat |= DatFormat.SabreDat; break; case "output-sfv": - datFormat |= DatFormat.RedumpSFV; + datHeader.DatFormat |= DatFormat.RedumpSFV; break; case "output-sha1": - datFormat |= DatFormat.RedumpSHA1; + datHeader.DatFormat |= DatFormat.RedumpSHA1; break; case "output-sha256": - datFormat |= DatFormat.RedumpSHA256; + datHeader.DatFormat |= DatFormat.RedumpSHA256; break; case "output-sha384": - datFormat |= DatFormat.RedumpSHA384; + datHeader.DatFormat |= DatFormat.RedumpSHA384; break; case "output-sha512": - datFormat |= DatFormat.RedumpSHA512; + datHeader.DatFormat |= DatFormat.RedumpSHA512; break; case "output-sl": - datFormat |= DatFormat.SoftwareList; + datHeader.DatFormat |= DatFormat.SoftwareList; break; case "output-tsv": - datFormat |= DatFormat.TSV; + datHeader.DatFormat |= DatFormat.TSV; break; case "output-xml": - datFormat |= DatFormat.Logiqx; + datHeader.DatFormat |= DatFormat.Logiqx; break; case "quotes": - quotes = true; + datHeader.Quotes = true; break; case "quick": quickScan = true; break; case "roms": - usegame = false; + datHeader.UseGame = false; break; case "reverse-base-name": updateMode |= UpdateMode.ReverseBaseReplace; @@ -462,25 +432,25 @@ namespace SabreTools updateMode |= UpdateMode.DiffReverseCascade; break; case "rem-md5": - stripHash |= Hash.MD5; + datHeader.StripHash |= Hash.MD5; break; case "rem-ext": - remext = true; + datHeader.RemoveExtension = true; break; case "romba": - romba = true; + datHeader.Romba = true; break; case "rem-sha1": - stripHash |= Hash.SHA1; + datHeader.StripHash |= Hash.SHA1; break; case "rem-sha256": - stripHash |= Hash.SHA256; + datHeader.StripHash |= Hash.SHA256; break; case "rem-sha384": - stripHash |= Hash.SHA384; + datHeader.StripHash |= Hash.SHA384; break; case "rem-sha512": - stripHash |= Hash.SHA512; + datHeader.StripHash |= Hash.SHA512; break; case "rem-uni": removeUnicode = true; @@ -498,10 +468,10 @@ namespace SabreTools zip = 0; break; case "superdat": - superdat = true; + datHeader.Type = "SuperDAT"; break; case "scene-date-strip": - sceneDateStrip = true; + datHeader.SceneDateStrip = true; break; case "skip": skip = true; @@ -561,7 +531,7 @@ namespace SabreTools updateDat = true; break; case "exclude-of": - excludeOf = true; + datHeader.ExcludeOf = true; break; // User inputs @@ -569,25 +539,25 @@ namespace SabreTools sevenzip = (int)feat.Value.GetValue() == Int32.MinValue ? (int)feat.Value.GetValue() : 1; break; case "-add-ext": - addext = (string)feat.Value.GetValue(); + datHeader.AddExtension = (string)feat.Value.GetValue(); break; case "author": - author = (string)feat.Value.GetValue(); + datHeader.Author = (string)feat.Value.GetValue(); break; case "base-dat": basePaths.AddRange((List)feat.Value.GetValue()); break; case "category": - category = (string)feat.Value.GetValue(); + datHeader.Category = (string)feat.Value.GetValue(); break; case "comment": - comment = (string)feat.Value.GetValue(); + datHeader.Comment = (string)feat.Value.GetValue(); break; case "crc": filter.CRCs.AddRange((List)feat.Value.GetValue()); break; case "date": - date = (string)feat.Value.GetValue(); + datHeader.Date = (string)feat.Value.GetValue(); break; case "dat": if (!File.Exists((string)feat.Value.GetValue()) && !Directory.Exists((string)feat.Value.GetValue())) @@ -599,10 +569,10 @@ namespace SabreTools datfiles.AddRange((List)feat.Value.GetValue()); break; case "desc": - description = (string)feat.Value.GetValue(); + datHeader.Description = (string)feat.Value.GetValue(); break; case "email": - email = (string)feat.Value.GetValue(); + datHeader.Email = (string)feat.Value.GetValue(); break; case "exta": exta.AddRange((List)feat.Value.GetValue()); @@ -611,16 +581,16 @@ namespace SabreTools extb.AddRange((List)feat.Value.GetValue()); break; case "filename": - filename = (string)feat.Value.GetValue(); + datHeader.FileName = (string)feat.Value.GetValue(); break; case "forcemerge": - forcemerge = (string)feat.Value.GetValue(); + datHeader.ForceMerging = Utilities.GetForceMerging((string)feat.Value.GetValue()); break; case "forcend": - forcend = (string)feat.Value.GetValue(); + datHeader.ForceNodump = Utilities.GetForceNodump((string)feat.Value.GetValue()); break; case "forcepack": - forcepack = (string)feat.Value.GetValue(); + datHeader.ForcePacking = Utilities.GetForcePacking((string)feat.Value.GetValue()); break; case "game-name": filter.GameNames.AddRange((List)feat.Value.GetValue()); @@ -632,10 +602,10 @@ namespace SabreTools gz = (int)feat.Value.GetValue() == Int32.MinValue ? (int)feat.Value.GetValue() : 1; break; case "header": - header = (string)feat.Value.GetValue(); + datHeader.Header = (string)feat.Value.GetValue(); break; case "homepage": - homepage = (string)feat.Value.GetValue(); + datHeader.Homepage = (string)feat.Value.GetValue(); break; case "status": filter.ItemStatuses |= Utilities.GetItemStatus((string)feat.Value.GetValue()); @@ -647,7 +617,7 @@ namespace SabreTools Globals.MaxThreads = (int)feat.Value.GetValue() == Int32.MinValue ? (int)feat.Value.GetValue() : Globals.MaxThreads; break; case "name": - name = (string)feat.Value.GetValue(); + datHeader.Name = (string)feat.Value.GetValue(); break; case "not-crc": filter.NotCRCs.AddRange((List)feat.Value.GetValue()); @@ -686,13 +656,13 @@ namespace SabreTools outDir = (string)feat.Value.GetValue(); break; case "postfix": - postfix = (string)feat.Value.GetValue(); + datHeader.Postfix = (string)feat.Value.GetValue(); break; case "prefix": - prefix = (string)feat.Value.GetValue(); + datHeader.Prefix = (string)feat.Value.GetValue(); break; case "root": - rootdir = (string)feat.Value.GetValue(); + datHeader.RootDir = (string)feat.Value.GetValue(); break; case "rar": rar = (int)feat.Value.GetValue() == Int32.MinValue ? (int)feat.Value.GetValue() : 1; @@ -701,7 +671,7 @@ namespace SabreTools filter.Root = (string)feat.Value.GetValue(); break; case "rep-ext": - repext = (string)feat.Value.GetValue(); + datHeader.ReplaceExtension = (string)feat.Value.GetValue(); break; case "rom-name": filter.RomNames.AddRange((List)feat.Value.GetValue()); @@ -734,10 +704,10 @@ namespace SabreTools tempDir = (string)feat.Value.GetValue(); break; case "url": - url = (string)feat.Value.GetValue(); + datHeader.Url = (string)feat.Value.GetValue(); break; case "version": - version = (string)feat.Value.GetValue(); + datHeader.Version = (string)feat.Value.GetValue(); break; case "zip": zip = (int)feat.Value.GetValue() == Int32.MinValue ? (int)feat.Value.GetValue() : 1; @@ -760,9 +730,8 @@ namespace SabreTools // Create a DAT from a directory or set of directories if (datFromDir) { - InitDatFromDir(inputs, filename, name, description, category, version, author, email, homepage, url, comment, - forcepack, excludeOf, sceneDateStrip, datFormat, romba, superdat, omitFromScan, removeDateFromAutomaticName, archivesAsFiles, - skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, outDir, copyFiles, header, chdsAsFiles); + InitDatFromDir(inputs, datHeader, omitFromScan, removeDateFromAutomaticName, archivesAsFiles, + skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, outDir, copyFiles, chdsAsFiles); } // If we're in header extract and remove mode @@ -781,34 +750,32 @@ namespace SabreTools else if (sort) { InitSort(datfiles, inputs, outDir, depot, quickScan, addFileDates, delete, inverse, - outputFormat, romba, sevenzip, gz, rar, zip, updateDat, header, splitType, chdsAsFiles); + outputFormat, datHeader.Romba, sevenzip, gz, rar, zip, updateDat, datHeader.Header, splitType, chdsAsFiles); } // Split a DAT by the split type else if (split) { - InitSplit(inputs, outDir, inplace, datFormat, splittingMode, exta, extb, shortname, basedat); + InitSplit(inputs, outDir, inplace, datHeader.DatFormat, splittingMode, exta, extb, shortname, basedat); } // Get statistics on input files else if (stats) { - InitStats(inputs, filename, outDir, filter.Single, showBaddumpColumn, showNodumpColumn, statDatFormat); + InitStats(inputs, datHeader.FileName, outDir, filter.Single, showBaddumpColumn, showNodumpColumn, statDatFormat); } // Convert, update, merge, diff, and filter a DAT or folder of DATs else if (update) { - InitUpdate(inputs, basePaths, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header, - superdat, forcemerge, forcend, forcepack, excludeOf, sceneDateStrip, datFormat, usegame, prefix, postfix, quotes, repext, addext, remext, - datPrefix, romba, updateMode, inplace, skip, removeDateFromAutomaticName, filter, splitType, outDir, cleanGameNames, removeUnicode, - descAsName, dedup, stripHash); + InitUpdate(inputs, basePaths, datHeader, updateMode, inplace, skip, removeDateFromAutomaticName, filter, + splitType, outDir, cleanGameNames, removeUnicode, descAsName); } // If we're using the verifier else if (verify) { - InitVerify(datfiles, inputs, depot, hashOnly, quickScan, header, splitType, chdsAsFiles); + InitVerify(datfiles, inputs, depot, hashOnly, quickScan, datHeader.Header, splitType, chdsAsFiles); } // If nothing is set, show the help