[SabreTools, DatFile] Make method signatures cleaner

This commit is contained in:
Matt Nadareski
2017-12-05 18:04:11 -08:00
parent 4b85ea8edd
commit 2dda5ce062
5 changed files with 122 additions and 290 deletions

View File

@@ -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();
}
/// <summary>
/// Create a new DatFile from an existing DatHeader
/// </summary>
/// <param name="datHeader"></param>
public DatFile(DatHeader datHeader)
{
_datHeader = (DatHeader)datHeader.Clone();
}
#endregion
#region Converting and Updating

View File

@@ -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; }

View File

@@ -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)
{

View File

@@ -24,23 +24,8 @@ namespace SabreTools
/// </summary>
/// <param name="inputs">List of input filenames</param>
/// /* Normal DAT header info */
/// <param name="filename">New filename</param>
/// <param name="name">New name</param>
/// <param name="description">New description</param>
/// <param name="category">New category</param>
/// <param name="version">New version</param>
/// <param name="author">New author</param>
/// <param name="email">New email</param>
/// <param name="homepage">New homepage</param>
/// <param name="url">New URL</param>
/// <param name="comment">New comment</param>
/// <param name="forcepack">String representing the forcepacking flag</param>
/// <param name="excludeOf">True if cloneof, romof, and sampleof fields should be omitted from output, false otherwise</param>
/// <param name="sceneDateStrip">True if scene-named sets have the date stripped from the beginning, false otherwise</param>
/// <param name="datFormat">DatFormat to be used for outputting the DAT</param>
/// <param name="datHeader">All DatHeader info to be used</param>
/// /* Standard DFD info */
/// <param name="romba">True to enable reading a directory like a Romba depot, false otherwise</param>
/// <param name="superdat">True to enable SuperDAT-style reading, false otherwise</param>
/// <param name="omitFromScan">Hash flag saying what hashes should not be calculated</param>
/// <param name="removeDateFromAutomaticName">True if the date should be omitted from the DAT, false otherwise</param>
/// <param name="archivesAsFiles">True if archives should be treated as files, false otherwise</param>
@@ -51,28 +36,12 @@ namespace SabreTools
/// <param name="tempDir">Name of the directory to create a temp folder in (blank is default temp directory)</param>
/// <param name="outDir">Name of the directory to output the DAT to (blank is the current directory)</param>
/// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
private static void InitDatFromDir(List<string> 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
/// <param name="inputPaths">List of input filenames</param>
/// <param name="basePaths">List of base filenames</param>
/// /* Normal DAT header info */
/// <param name="filename">New filename</param>
/// <param name="name">New name</param>
/// <param name="description">New description</param>
/// <param name="rootdir">New rootdir</param>
/// <param name="category">New category</param>
/// <param name="version">New version</param>
/// <param name="date">New date</param>
/// <param name="author">New author</param>
/// <param name="email">New email</param>
/// <param name="homepage">New homepage</param>
/// <param name="url">New URL</param>
/// <param name="comment">New comment</param>
/// <param name="header">New header</param>
/// <param name="superdat">True to set SuperDAT type, false otherwise</param>
/// <param name="forcemerge">None, Split, Full</param>
/// <param name="forcend">None, Obsolete, Required, Ignore</param>
/// <param name="forcepack">None, Zip, Unzip</param>
/// <param name="excludeOf">True if cloneof, romof, and sampleof fields should be omitted from output, false otherwise</param>
/// <param name="sceneDateStrip">True if scene-named sets have the date stripped from the beginning, false otherwise</param>
/// <param name="datFormat">Non-zero flag for output format, zero otherwise for default</param>
/// /* Missfile-specific DAT info */
/// <param name="usegame">True if games are to be used in output, false if roms are</param>
/// <param name="prefix">Generic prefix to be added to each line</param>
/// <param name="postfix">Generic postfix to be added to each line</param>
/// <param name="quotes">Add quotes to each item</param>
/// <param name="repext">Replace all extensions with another</param>
/// <param name="addext">Add an extension to all items</param>
/// <param name="remext">Remove all extensions</param>
/// <param name="datprefix">Add the dat name as a directory prefix</param>
/// <param name="romba">Output files in romba format</param>
/// <param name="datHeader">All DatHeader info to be used</param>
/// /* Merging and Diffing info */
/// <param name="updateMode">Non-zero flag for diffing mode, zero otherwise</param>
/// <param name="inplace">True if the cascade-diffed files should overwrite their inputs, false otherwise</param>
@@ -312,44 +233,12 @@ namespace SabreTools
/// <param name="clean">True to clean the game names to WoD standard, false otherwise (default)</param>
/// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param>
/// <param name="descAsName">True if descriptions should be used as names, false otherwise (default)</param>
/// <param name="dedup">Dedupe type to use for DAT processing</param>
/// <param name="stripHash">StripHash that represents the hash(es) that you want to remove from the output</param>
private static void InitUpdate(
List<string> inputPaths,
List<string> 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);

View File

@@ -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<string> basePaths = new List<string>();
List<string> datfiles = new List<string>();
@@ -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<string>)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<string>)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<string>)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<string>)feat.Value.GetValue());
@@ -611,16 +581,16 @@ namespace SabreTools
extb.AddRange((List<string>)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<string>)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<string>)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<string>)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