[SabreTools, DatFile] Add 1G1R skeleton (nw)

This commit is contained in:
Matt Nadareski
2017-02-27 21:53:20 -08:00
parent 08572a26af
commit 5737fd5175
4 changed files with 68 additions and 26 deletions

View File

@@ -31,6 +31,8 @@ namespace SabreTools.Helper.Dats
private bool _excludeOf;
private bool _mergeRoms;
private Hash _stripHash;
private bool _oneGameOneRegion;
private List<string> _regions = new List<string>();
private SortedDictionary<string, List<DatItem>> _files = new SortedDictionary<string, List<DatItem>>();
private SortedBy _sortedBy;
@@ -168,6 +170,16 @@ namespace SabreTools.Helper.Dats
get { return _stripHash; }
set { _stripHash = value; }
}
public bool OneGameOneRegion
{
get { return _oneGameOneRegion; }
set { _oneGameOneRegion = value; }
}
public List<string> Regions
{
get { return _regions; }
set { _regions = value; }
}
public SortedBy SortedBy
{
get { return _sortedBy; }

View File

@@ -8,6 +8,7 @@ namespace SabreTools
{
public partial class SabreTools
{
// TODO: Add 1G1R to the flags for update
public static Help RetrieveHelp()
{
// Create and add the header to the Help object

View File

@@ -459,6 +459,8 @@ namespace SabreTools
/// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param>
/// /* Filtering info */
/// <param name="filter">Pre-populated filter object for DAT filtering</param>
/// <param name="oneGameOneRegion">True if the outputs should be created in 1G1R mode, false otherwise</param>
/// <param name="regions">List of regions in the order they should be used, blank for default</param>
/// /* Trimming info */
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
@@ -514,6 +516,8 @@ namespace SabreTools
/* Filtering info */
Filter filter,
bool oneGameOneRegion,
List<string> regions,
/* Trimming info */
SplitType splitType,
@@ -595,6 +599,35 @@ namespace SabreTools
}
}
// Set the 1G1R regions alphabetically if not already set
if (regions == null || regions.Count == 0)
{
regions = new List<string>()
{
"australia",
"canada",
"china",
"denmark",
"europe",
"finland",
"france",
"germany",
"greece",
"italy",
"japan",
"korea",
"netherlands",
"norway",
"russia",
"spain",
"sweden",
"usa",
"usa, australia",
"usa, europe",
"world",
};
}
// Normalize the extensions
addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext);
repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext);
@@ -653,6 +686,8 @@ namespace SabreTools
ExcludeOf = excludeOf,
DatFormat = datFormat,
StripHash = stripHash,
OneGameOneRegion = oneGameOneRegion,
Regions = regions,
UseGame = usegame,
Prefix = prefix,

View File

@@ -102,6 +102,7 @@ namespace SabreTools
inplace = false,
inverse = false,
merge = false,
oneGameOneRegion = false,
parseArchivesAsFiles = false,
quickScan = false,
quotes = false,
@@ -159,6 +160,7 @@ namespace SabreTools
List<string> exta = new List<string>();
List<string> extb = new List<string>();
List<string> inputs = new List<string>();
List<string> regions = new List<string>();
// Get the first argument as a feature flag
string feature = args[0];
@@ -270,6 +272,10 @@ namespace SabreTools
switch (args[i])
{
// User flags
case "-1g1r":
case "--1g1r":
oneGameOneRegion = true;
break;
case "-ab":
case "--add-blank":
addBlankFilesForEmptyFolder = true;
@@ -776,6 +782,10 @@ namespace SabreTools
case "--root-dir":
root = args[++i];
break;
case "-reg":
case "--region":
regions.Add(args[++i]);
break;
case "-rep":
case "--rep-ext":
repext = args[++i];
@@ -1044,6 +1054,10 @@ namespace SabreTools
case "--root-dir":
root = split[1];
break;
case "-reg":
case "--region":
regions.Add(split[1]);
break;
case "-rep":
case "--rep-ext":
repext = split[1];
@@ -1165,29 +1179,9 @@ namespace SabreTools
// Create a DAT from a directory or set of directories
if (datFromDir)
{
InitDatFromDir(inputs,
filename,
name,
description,
category,
version,
author,
forcepack,
excludeOf,
datFormat,
romba,
superdat,
omitFromScan,
removeDateFromAutomaticName,
parseArchivesAsFiles,
enableGzip,
addBlankFilesForEmptyFolder,
addFileDates,
tempDir,
outDir,
copyFiles,
header,
maxParallelism);
InitDatFromDir(inputs, filename, name, description, category, version, author, forcepack, excludeOf,
datFormat, romba, superdat, omitFromScan, removeDateFromAutomaticName, parseArchivesAsFiles, enableGzip,
addBlankFilesForEmptyFolder, addFileDates, tempDir, outDir, copyFiles, header, maxParallelism);
}
// If we're in header extract and remove mode
@@ -1250,9 +1244,9 @@ namespace SabreTools
else if (update)
{
InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header,
superdat, forcemerge, forcend, forcepack, excludeOf, datFormat, usegame, prefix,
postfix, quotes, repext, addext, remext, datPrefix, romba, merge, diffMode, inplace, skip, removeDateFromAutomaticName,
filter, splitType, trim, single, root, outDir, cleanGameNames, descAsName, dedup, stripHash, maxParallelism);
superdat, forcemerge, forcend, forcepack, excludeOf, datFormat, usegame, prefix, postfix, quotes, repext, addext, remext,
datPrefix, romba, merge, diffMode, inplace, skip, removeDateFromAutomaticName, filter, oneGameOneRegion, regions,
splitType, trim, single, root, outDir, cleanGameNames, descAsName, dedup, stripHash, maxParallelism);
}
// If we're using the verifier