mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SabreTools, DatFile] Use "base" instead of "restore" for level split
This commit is contained in:
@@ -204,7 +204,7 @@ namespace SabreTools.Helper.Data
|
||||
helptext.Add(" -ls, --lvl-split Split a SuperDAT or folder by internal path");
|
||||
helptext.Add(" -out= Output directory");
|
||||
helptext.Add(" -s, --short Use short output names");
|
||||
helptext.Add(" -r, --restore Restore original filename to each output DAT");
|
||||
helptext.Add(" -ba, --base Use source DAT as base name for outputs");
|
||||
|
||||
// Sort
|
||||
helptext.Add(" -ss, --sort Sort input files by a set of DATs");
|
||||
|
||||
@@ -5026,10 +5026,10 @@ namespace SabreTools.Helper.Dats
|
||||
/// <param name="outDir">Name of the directory to write the DATs out to</param>
|
||||
/// <param name="basepath">Parent path for replacement</param>
|
||||
/// <param name="shortname">True if short names should be used, false otherwise</param>
|
||||
/// <param name="restore">True if original filenames should be used as the base for output filename, false otherwise</param>
|
||||
/// <param name="basedat">True if original filenames should be used as the base for output filename, false otherwise</param>
|
||||
/// <param name="logger">Logger object for console and file writing</param>
|
||||
/// <returns>True if split succeeded, false otherwise</returns>
|
||||
public bool SplitByLevel(string outDir, string basepath, bool shortname, bool restore, Logger logger)
|
||||
public bool SplitByLevel(string outDir, string basepath, bool shortname, bool basedat, Logger logger)
|
||||
{
|
||||
// Sanitize the basepath to be more predictable
|
||||
basepath = (basepath.EndsWith(Path.DirectorySeparatorChar.ToString()) ? basepath : basepath + Path.DirectorySeparatorChar);
|
||||
@@ -5052,7 +5052,7 @@ namespace SabreTools.Helper.Dats
|
||||
if (tempDat.Name != null && tempDat.Name != Style.GetDirectoryName(key))
|
||||
{
|
||||
// Process and output the DAT
|
||||
SplitByLevelHelper(tempDat, outDir, shortname, restore, logger);
|
||||
SplitByLevelHelper(tempDat, outDir, shortname, basedat, logger);
|
||||
|
||||
// Reset the DAT for the next items
|
||||
tempDat = (DatFile)CloneHeader();
|
||||
@@ -5079,7 +5079,7 @@ namespace SabreTools.Helper.Dats
|
||||
}
|
||||
|
||||
// Then we write the last DAT out since it would be skipped otherwise
|
||||
SplitByLevelHelper(tempDat, outDir, shortname, restore, logger);
|
||||
SplitByLevelHelper(tempDat, outDir, shortname, basedat, logger);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -257,8 +257,8 @@ namespace SabreTools
|
||||
/// <param name="inputs">List of inputs to be used</param>
|
||||
/// <param name="outDir">Output directory for the split files</param>
|
||||
/// <param name="shortname">True if short filenames should be used, false otherwise</param>
|
||||
/// <param name="restore">True if original filenames should be used as the base for output filename, false otherwise</param>
|
||||
private static void InitLevelSplit(List<string> inputs, string outDir, bool shortname, bool restore)
|
||||
/// <param name="basedat">True if original filenames should be used as the base for output filename, false otherwise</param>
|
||||
private static void InitLevelSplit(List<string> inputs, string outDir, bool shortname, bool basedat)
|
||||
{
|
||||
// Loop over the input files
|
||||
foreach (string input in inputs)
|
||||
@@ -267,7 +267,7 @@ namespace SabreTools
|
||||
{
|
||||
DatFile datFile = new DatFile();
|
||||
datFile.Parse(Path.GetFullPath(input), 0, 0, _logger, softlist: true, keep: true);
|
||||
datFile.SplitByLevel(outDir, Path.GetDirectoryName(input), shortname, restore, _logger);
|
||||
datFile.SplitByLevel(outDir, Path.GetDirectoryName(input), shortname, basedat, _logger);
|
||||
}
|
||||
else if (Directory.Exists(input))
|
||||
{
|
||||
@@ -275,7 +275,7 @@ namespace SabreTools
|
||||
{
|
||||
DatFile datFile = new DatFile();
|
||||
datFile.Parse(Path.GetFullPath(file), 0, 0, _logger, softlist: true, keep: true);
|
||||
datFile.SplitByLevel(outDir, (input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar), shortname, restore, _logger);
|
||||
datFile.SplitByLevel(outDir, (input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar), shortname, basedat, _logger);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -69,6 +69,7 @@ namespace SabreTools
|
||||
// User flags
|
||||
bool addBlankFilesForEmptyFolder = false,
|
||||
addFileDates = false,
|
||||
basedat = false,
|
||||
cleanGameNames = false,
|
||||
copyFiles = false,
|
||||
datPrefix = false,
|
||||
@@ -209,6 +210,10 @@ namespace SabreTools
|
||||
case "--bare":
|
||||
removeDateFromAutomaticName = true;
|
||||
break;
|
||||
case "-ba":
|
||||
case "--base":
|
||||
basedat = true;
|
||||
break;
|
||||
case "-bc":
|
||||
case "--baddump-col":
|
||||
showBaddumpColumn = true;
|
||||
@@ -994,7 +999,7 @@ namespace SabreTools
|
||||
// Split a SuperDAT by lowest available level
|
||||
else if (splitByLevel)
|
||||
{
|
||||
InitLevelSplit(inputs, outDir, shortname, restore);
|
||||
InitLevelSplit(inputs, outDir, shortname, basedat);
|
||||
}
|
||||
|
||||
// Split a DAT by item type
|
||||
|
||||
Reference in New Issue
Block a user