mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[Flags] ExternalSplitType -> SplittingMode
This commit is contained in:
@@ -4736,16 +4736,16 @@ namespace SabreTools.Library.DatFiles
|
||||
/// <param name="inputs">List of inputs to be used</param>
|
||||
/// <param name="outDir">Output directory for the split files</param>
|
||||
/// <param name="inplace">True if files should be written to the source folders, false otherwise</param>
|
||||
/// <param name="splitType">Type of split to perform, if any</param>
|
||||
/// <param name="splittingMode">Type of split to perform, if any</param>
|
||||
/// <param name="exta">First extension to split on (Extension Split only)</param>
|
||||
/// <param name="extb">Second extension to split on (Extension Split only)</param>
|
||||
/// <param name="shortname">True if short filenames should be used, false otherwise (Level Split only)</param>
|
||||
/// <param name="basedat">True if original filenames should be used as the base for output filename, false otherwise (Level Split only)</param>
|
||||
public void DetermineSplitType(List<string> inputs, string outDir, bool inplace, ExternalSplitType splitType,
|
||||
public void DetermineSplitType(List<string> inputs, string outDir, bool inplace, SplittingMode splittingMode,
|
||||
List<string> exta, List<string> extb, bool shortname, bool basedat)
|
||||
{
|
||||
// If we somehow have the "none" split type, return
|
||||
if (splitType == ExternalSplitType.None)
|
||||
if (splittingMode == SplittingMode.None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4766,19 +4766,19 @@ namespace SabreTools.Library.DatFiles
|
||||
outDir = Utilities.GetOutputPath(outDir, file, inplace, splitpath: true);
|
||||
|
||||
// Split and write the DAT
|
||||
if ((splitType & ExternalSplitType.Extension) != 0)
|
||||
if ((splittingMode & SplittingMode.Extension) != 0)
|
||||
{
|
||||
SplitByExtension(outDir, inplace, exta, extb);
|
||||
}
|
||||
if ((splitType & ExternalSplitType.Hash) != 0)
|
||||
if ((splittingMode & SplittingMode.Hash) != 0)
|
||||
{
|
||||
SplitByHash(outDir, inplace);
|
||||
}
|
||||
if ((splitType & ExternalSplitType.Level) != 0)
|
||||
if ((splittingMode & SplittingMode.Level) != 0)
|
||||
{
|
||||
SplitByLevel(outDir, inplace, shortname, basedat);
|
||||
}
|
||||
if ((splitType & ExternalSplitType.Type) != 0)
|
||||
if ((splittingMode & SplittingMode.Type) != 0)
|
||||
{
|
||||
SplitByType(outDir, inplace);
|
||||
}
|
||||
|
||||
@@ -222,20 +222,6 @@ namespace SabreTools.Library.Data
|
||||
ALL = 0xFFFFFFF,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines how the DAT will be split on output
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ExternalSplitType
|
||||
{
|
||||
None = 0x0,
|
||||
|
||||
Extension = 0x01,
|
||||
Hash = Extension << 1,
|
||||
Level = Hash << 1,
|
||||
Type = Level << 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine what hashes to strip from the DAT
|
||||
/// </summary>
|
||||
@@ -271,6 +257,20 @@ namespace SabreTools.Library.Data
|
||||
All = Textfile | HTML | CSV | TSV,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines how the DAT will be split on output
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum SplittingMode
|
||||
{
|
||||
None = 0x0,
|
||||
|
||||
Extension = 0x01,
|
||||
Hash = Extension << 1,
|
||||
Level = Hash << 1,
|
||||
Type = Level << 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines special update modes
|
||||
/// </summary>
|
||||
|
||||
@@ -250,17 +250,17 @@ namespace SabreTools
|
||||
/// <param name="outDir">Output directory for the split files</param>
|
||||
/// <param name="inplace">True if files should be written to the source folders, false otherwise</param>
|
||||
/// <param name="datFormat">DatFormat to be used for outputting the DAT</param>
|
||||
/// <param name="splitType">Type of split to perform, if any</param>
|
||||
/// <param name="splittingMode">Type of split to perform, if any</param>
|
||||
/// <param name="exta">First extension to split on (Extension Split only)</param>
|
||||
/// <param name="extb">Second extension to split on (Extension Split only)</param>
|
||||
/// <param name="shortname">True if short filenames should be used, false otherwise (Level Split only)</param>
|
||||
/// <param name="basedat">True if original filenames should be used as the base for output filename, false otherwise (Level Split only)</param>
|
||||
private static void InitSplit(List<string> inputs, string outDir, bool inplace, DatFormat datFormat,
|
||||
ExternalSplitType splitType, List<string> exta, List<string> extb, bool shortname, bool basedat)
|
||||
SplittingMode splittingMode, List<string> exta, List<string> extb, bool shortname, bool basedat)
|
||||
{
|
||||
DatFile datfile = new DatFile();
|
||||
datfile.DatFormat = datFormat;
|
||||
datfile.DetermineSplitType(inputs, outDir, inplace, splitType, exta, extb, shortname, basedat);
|
||||
datfile.DetermineSplitType(inputs, outDir, inplace, splittingMode, exta, extb, shortname, basedat);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -119,11 +119,11 @@ namespace SabreTools
|
||||
usegame = true;
|
||||
DatFormat datFormat = 0x0;
|
||||
DedupeType dedup = DedupeType.None;
|
||||
ExternalSplitType externalSplitType = ExternalSplitType.None;
|
||||
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;
|
||||
SplitType splitType = SplitType.None;
|
||||
StatReportFormat statDatFormat = StatReportFormat.None;
|
||||
UpdateMode updateMode = UpdateMode.None;
|
||||
@@ -360,7 +360,7 @@ namespace SabreTools
|
||||
break;
|
||||
case "-es":
|
||||
case "--ext":
|
||||
externalSplitType |= ExternalSplitType.Extension;
|
||||
splittingMode |= SplittingMode.Extension;
|
||||
break;
|
||||
case "-f":
|
||||
case "--files":
|
||||
@@ -384,7 +384,7 @@ namespace SabreTools
|
||||
break;
|
||||
case "-hs":
|
||||
case "--hash":
|
||||
externalSplitType |= ExternalSplitType.Hash;
|
||||
splittingMode |= SplittingMode.Hash;
|
||||
break;
|
||||
case "-ic":
|
||||
case "--ignore-chd":
|
||||
@@ -400,7 +400,7 @@ namespace SabreTools
|
||||
break;
|
||||
case "-ls":
|
||||
case "--level":
|
||||
externalSplitType |= ExternalSplitType.Level;
|
||||
splittingMode |= SplittingMode.Level;
|
||||
break;
|
||||
case "-m":
|
||||
case "--merge":
|
||||
@@ -628,7 +628,7 @@ namespace SabreTools
|
||||
break;
|
||||
case "-ts":
|
||||
case "--type":
|
||||
externalSplitType |= ExternalSplitType.Type;
|
||||
splittingMode |= SplittingMode.Type;
|
||||
break;
|
||||
case "-tsv":
|
||||
case "--tsv":
|
||||
@@ -1302,7 +1302,7 @@ namespace SabreTools
|
||||
// Split a DAT by the split type
|
||||
else if (split)
|
||||
{
|
||||
InitSplit(inputs, outDir, inplace, datFormat, externalSplitType, exta, extb, shortname, basedat);
|
||||
InitSplit(inputs, outDir, inplace, datFormat, splittingMode, exta, extb, shortname, basedat);
|
||||
}
|
||||
|
||||
// Get statistics on input files
|
||||
|
||||
Reference in New Issue
Block a user