diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs
index 06152f90..1c53c2e8 100644
--- a/SabreTools.Library/DatFiles/DatFile.cs
+++ b/SabreTools.Library/DatFiles/DatFile.cs
@@ -2,6 +2,7 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
+using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
@@ -452,6 +453,27 @@ namespace SabreTools.Library.DatFiles
_datHeader.ExcludeOf = value;
}
}
+ public bool SceneDateStrip
+ {
+ get
+ {
+ if (_datHeader == null)
+ {
+ _datHeader = new DatHeader();
+ }
+
+ return _datHeader.SceneDateStrip;
+ }
+ set
+ {
+ if (_datHeader == null)
+ {
+ _datHeader = new DatHeader();
+ }
+
+ _datHeader.SceneDateStrip = value;
+ }
+ }
public DedupeType DedupeRoms
{
get
@@ -2441,6 +2463,42 @@ namespace SabreTools.Library.DatFiles
});
}
+ ///
+ /// Strip the dates from the beginning of scene-style set names
+ ///
+ private void StripSceneDatesFromItems()
+ {
+ // Output the logging statement
+ Globals.Logger.User("Stripping scene-style dates");
+
+ // Set the regex pattern to use
+ string pattern = @"([0-9]{2}\.[0-9]{2}\.[0-9]{2}-)(.*?-.*?)";
+
+ // Now process all of the roms
+ List keys = Keys.ToList();
+ Parallel.ForEach(keys, Globals.ParallelOptions, key =>
+ {
+ List items = this[key];
+ for (int j = 0; j < items.Count; j++)
+ {
+ DatItem item = items[j];
+ if (Regex.IsMatch(item.MachineName, pattern))
+ {
+ Regex.Replace(item.MachineName, pattern, "$2");
+ }
+ if (Regex.IsMatch(item.MachineDescription, pattern))
+ {
+ Regex.Replace(item.MachineDescription, pattern, "$2");
+ }
+
+ items[j] = item;
+ }
+
+ Remove(key);
+ AddRange(key, items);
+ });
+ }
+
#endregion
#region Merging/Splitting
@@ -5555,6 +5613,12 @@ namespace SabreTools.Library.DatFiles
StripHashesFromItems();
}
+ // If we are removing scene dates, do that now
+ if (SceneDateStrip)
+ {
+
+ }
+
// Get the outfile names
Dictionary outfiles = Style.CreateOutfileNames(outDir, this, overwrite);
diff --git a/SabreTools.Library/DatFiles/DatHeader.cs b/SabreTools.Library/DatFiles/DatHeader.cs
index 1b0b71b7..fea0c610 100644
--- a/SabreTools.Library/DatFiles/DatHeader.cs
+++ b/SabreTools.Library/DatFiles/DatHeader.cs
@@ -32,6 +32,7 @@ namespace SabreTools.Library.DatFiles
private ForcePacking _forcePacking;
private DatFormat _datFormat;
private bool _excludeOf;
+ private bool _sceneDateStrip;
private DedupeType _dedupeRoms;
private Hash _stripHash;
private bool _oneGameOneRegion;
@@ -148,6 +149,11 @@ namespace SabreTools.Library.DatFiles
get { return _excludeOf; }
set { _excludeOf = value; }
}
+ public bool SceneDateStrip
+ {
+ get { return _sceneDateStrip; }
+ set { _sceneDateStrip = value; }
+ }
public DedupeType DedupeRoms
{
get { return _dedupeRoms; }
diff --git a/SabreTools.Library/README.1ST b/SabreTools.Library/README.1ST
index 79c0a2b1..be7ac9aa 100644
--- a/SabreTools.Library/README.1ST
+++ b/SabreTools.Library/README.1ST
@@ -320,6 +320,11 @@ Options:
If this flag is enabled, then the romof, cloneof, and sampleof tags
will be omitted from the outputted DAT or DATs.
+ -sds, --scene-date-strip Remove date from scene-named sets
+ If this flag is enabled, sets with "scene" names will have the date
+ removed from the beginning. For example "01.01.01-Game_Name-GROUP"
+ would become "Game_Name-Group".
+
-ab, --add-blank Output blank files for folders
If this flag is set, then blank entries will be created for each of
the empty directories in the source. This is useful for tools that
@@ -1027,7 +1032,12 @@ Options:
-xof, --exclude-of Exclude romof, cloneof, sampleof tags
If this flag is enabled, then the romof, cloneof, and sampleof tags
will be omitted from the outputted DAT or DATs.
-
+
+ -sds, --scene-date-strip Remove date from scene-named sets
+ If this flag is enabled, sets with "scene" names will have the date
+ removed from the beginning. For example "01.01.01-Game_Name-GROUP"
+ would become "Game_Name-Group".
+
-clean Clean game names according to WoD standards
Game names will be santitized to remove what the original WoD
standards deemed as unneeded information, such as parenthized or
diff --git a/SabreTools/SabreTools.Help.cs b/SabreTools/SabreTools.Help.cs
index 6e98372b..40a72878 100644
--- a/SabreTools/SabreTools.Help.cs
+++ b/SabreTools/SabreTools.Help.cs
@@ -260,6 +260,11 @@ namespace SabreTools
"Exclude romof, cloneof, sampleof tags",
FeatureType.Flag,
null));
+ datFromDir.AddFeature("scene-date-strip", new Feature(
+ new List() { "-sds", "--scene-date-strip" },
+ "Remove date from scene-named sets",
+ FeatureType.Flag,
+ null));
datFromDir.AddFeature("add-blank", new Feature(
new List() { "-ab", "--add-blank" },
"Output blank files for folders",
@@ -1045,6 +1050,11 @@ namespace SabreTools
"Exclude romof, cloneof, sampleof tags",
FeatureType.Flag,
null));
+ update.AddFeature("scene-date-strip", new Feature(
+ new List() { "-sds", "--scene-date-strip" },
+ "Remove date from scene-named sets",
+ FeatureType.Flag,
+ null));
update.AddFeature("clean", new Feature(
new List() { "-clean", "--clean" },
"Clean game names according to WoD standards",
diff --git a/SabreTools/SabreTools.Inits.cs b/SabreTools/SabreTools.Inits.cs
index 128b8afd..a19c5202 100644
--- a/SabreTools/SabreTools.Inits.cs
+++ b/SabreTools/SabreTools.Inits.cs
@@ -36,6 +36,7 @@ namespace SabreTools
/// 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
/// /* Standard DFD info */
/// True to enable reading a directory like a Romba depot, false otherwise
@@ -66,6 +67,7 @@ namespace SabreTools
string comment,
string forcepack,
bool excludeOf,
+ bool sceneDateStrip,
DatFormat datFormat,
/* Standard DFD info */
@@ -118,6 +120,7 @@ namespace SabreTools
DatFormat = (datFormat == 0 ? DatFormat.Logiqx : datFormat),
Romba = romba,
ExcludeOf = excludeOf,
+ SceneDateStrip = sceneDateStrip,
Type = (superdat ? "SuperDAT" : ""),
};
@@ -465,6 +468,7 @@ namespace SabreTools
/// 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
@@ -521,6 +525,7 @@ namespace SabreTools
string forcend,
string forcepack,
bool excludeOf,
+ bool sceneDateStrip,
DatFormat datFormat,
/* Missfile-specific DAT info */
@@ -709,6 +714,7 @@ namespace SabreTools
ForcePacking = fp,
DedupeRoms = dedup,
ExcludeOf = excludeOf,
+ SceneDateStrip = sceneDateStrip,
DatFormat = datFormat,
StripHash = stripHash,
OneGameOneRegion = oneGameOneRegion,
diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs
index 2d5b85fd..fb6fdc23 100644
--- a/SabreTools/SabreTools.cs
+++ b/SabreTools/SabreTools.cs
@@ -110,6 +110,7 @@ namespace SabreTools
removeDateFromAutomaticName = false,
removeUnicode = false,
romba = false,
+ sceneDateStrip = false,
showBaddumpColumn = false,
showNodumpColumn = false,
shortname = false,
@@ -571,6 +572,10 @@ namespace SabreTools
case "--superdat":
superdat = true;
break;
+ case "-sds":
+ case "--scene-date-strip":
+ sceneDateStrip = true;
+ break;
case "-sf":
case "--skip":
skip = true;
@@ -1241,7 +1246,7 @@ namespace SabreTools
if (datFromDir)
{
InitDatFromDir(inputs, filename, name, description, category, version, author, email, homepage, url, comment,
- forcepack, excludeOf, datFormat, romba, superdat, omitFromScan, removeDateFromAutomaticName, parseArchivesAsFiles,
+ forcepack, excludeOf, sceneDateStrip, datFormat, romba, superdat, omitFromScan, removeDateFromAutomaticName, parseArchivesAsFiles,
enableGzip, skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, outDir, copyFiles, header);
}
@@ -1305,7 +1310,7 @@ namespace SabreTools
else if (update)
{
InitUpdate(inputs, basePaths, 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,
+ superdat, forcemerge, forcend, forcepack, excludeOf, sceneDateStrip, datFormat, usegame, prefix, postfix, quotes, repext, addext, remext,
datPrefix, romba, merge, diffMode, inplace, skip, removeDateFromAutomaticName, filter, oneGameOneRegion, regions,
splitType, trim, single, root, outDir, cleanGameNames, removeUnicode, descAsName, dedup, stripHash);
}