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="inputs">List of inputs to be used</param>
|
||||||
/// <param name="outDir">Output directory for the split files</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="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="exta">First extension to split on (Extension Split only)</param>
|
||||||
/// <param name="extb">Second 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="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>
|
/// <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)
|
List<string> exta, List<string> extb, bool shortname, bool basedat)
|
||||||
{
|
{
|
||||||
// If we somehow have the "none" split type, return
|
// If we somehow have the "none" split type, return
|
||||||
if (splitType == ExternalSplitType.None)
|
if (splittingMode == SplittingMode.None)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4766,19 +4766,19 @@ namespace SabreTools.Library.DatFiles
|
|||||||
outDir = Utilities.GetOutputPath(outDir, file, inplace, splitpath: true);
|
outDir = Utilities.GetOutputPath(outDir, file, inplace, splitpath: true);
|
||||||
|
|
||||||
// Split and write the DAT
|
// Split and write the DAT
|
||||||
if ((splitType & ExternalSplitType.Extension) != 0)
|
if ((splittingMode & SplittingMode.Extension) != 0)
|
||||||
{
|
{
|
||||||
SplitByExtension(outDir, inplace, exta, extb);
|
SplitByExtension(outDir, inplace, exta, extb);
|
||||||
}
|
}
|
||||||
if ((splitType & ExternalSplitType.Hash) != 0)
|
if ((splittingMode & SplittingMode.Hash) != 0)
|
||||||
{
|
{
|
||||||
SplitByHash(outDir, inplace);
|
SplitByHash(outDir, inplace);
|
||||||
}
|
}
|
||||||
if ((splitType & ExternalSplitType.Level) != 0)
|
if ((splittingMode & SplittingMode.Level) != 0)
|
||||||
{
|
{
|
||||||
SplitByLevel(outDir, inplace, shortname, basedat);
|
SplitByLevel(outDir, inplace, shortname, basedat);
|
||||||
}
|
}
|
||||||
if ((splitType & ExternalSplitType.Type) != 0)
|
if ((splittingMode & SplittingMode.Type) != 0)
|
||||||
{
|
{
|
||||||
SplitByType(outDir, inplace);
|
SplitByType(outDir, inplace);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,20 +222,6 @@ namespace SabreTools.Library.Data
|
|||||||
ALL = 0xFFFFFFF,
|
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>
|
/// <summary>
|
||||||
/// Determine what hashes to strip from the DAT
|
/// Determine what hashes to strip from the DAT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -271,6 +257,20 @@ namespace SabreTools.Library.Data
|
|||||||
All = Textfile | HTML | CSV | TSV,
|
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>
|
/// <summary>
|
||||||
/// Determines special update modes
|
/// Determines special update modes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -250,17 +250,17 @@ namespace SabreTools
|
|||||||
/// <param name="outDir">Output directory for the split files</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="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="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="exta">First extension to split on (Extension Split only)</param>
|
||||||
/// <param name="extb">Second 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="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>
|
/// <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,
|
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 datfile = new DatFile();
|
||||||
datfile.DatFormat = datFormat;
|
datfile.DatFormat = datFormat;
|
||||||
datfile.DetermineSplitType(inputs, outDir, inplace, splitType, exta, extb, shortname, basedat);
|
datfile.DetermineSplitType(inputs, outDir, inplace, splittingMode, exta, extb, shortname, basedat);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -119,11 +119,11 @@ namespace SabreTools
|
|||||||
usegame = true;
|
usegame = true;
|
||||||
DatFormat datFormat = 0x0;
|
DatFormat datFormat = 0x0;
|
||||||
DedupeType dedup = DedupeType.None;
|
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 omitFromScan = Hash.DeepHashes; // TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
|
||||||
Hash stripHash = 0x0;
|
Hash stripHash = 0x0;
|
||||||
OutputFormat outputFormat = OutputFormat.Folder;
|
OutputFormat outputFormat = OutputFormat.Folder;
|
||||||
SkipFileType skipFileType = SkipFileType.None;
|
SkipFileType skipFileType = SkipFileType.None;
|
||||||
|
SplittingMode splittingMode = SplittingMode.None;
|
||||||
SplitType splitType = SplitType.None;
|
SplitType splitType = SplitType.None;
|
||||||
StatReportFormat statDatFormat = StatReportFormat.None;
|
StatReportFormat statDatFormat = StatReportFormat.None;
|
||||||
UpdateMode updateMode = UpdateMode.None;
|
UpdateMode updateMode = UpdateMode.None;
|
||||||
@@ -360,7 +360,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-es":
|
case "-es":
|
||||||
case "--ext":
|
case "--ext":
|
||||||
externalSplitType |= ExternalSplitType.Extension;
|
splittingMode |= SplittingMode.Extension;
|
||||||
break;
|
break;
|
||||||
case "-f":
|
case "-f":
|
||||||
case "--files":
|
case "--files":
|
||||||
@@ -384,7 +384,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-hs":
|
case "-hs":
|
||||||
case "--hash":
|
case "--hash":
|
||||||
externalSplitType |= ExternalSplitType.Hash;
|
splittingMode |= SplittingMode.Hash;
|
||||||
break;
|
break;
|
||||||
case "-ic":
|
case "-ic":
|
||||||
case "--ignore-chd":
|
case "--ignore-chd":
|
||||||
@@ -400,7 +400,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-ls":
|
case "-ls":
|
||||||
case "--level":
|
case "--level":
|
||||||
externalSplitType |= ExternalSplitType.Level;
|
splittingMode |= SplittingMode.Level;
|
||||||
break;
|
break;
|
||||||
case "-m":
|
case "-m":
|
||||||
case "--merge":
|
case "--merge":
|
||||||
@@ -628,7 +628,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-ts":
|
case "-ts":
|
||||||
case "--type":
|
case "--type":
|
||||||
externalSplitType |= ExternalSplitType.Type;
|
splittingMode |= SplittingMode.Type;
|
||||||
break;
|
break;
|
||||||
case "-tsv":
|
case "-tsv":
|
||||||
case "--tsv":
|
case "--tsv":
|
||||||
@@ -1302,7 +1302,7 @@ namespace SabreTools
|
|||||||
// Split a DAT by the split type
|
// Split a DAT by the split type
|
||||||
else if (split)
|
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
|
// Get statistics on input files
|
||||||
|
|||||||
Reference in New Issue
Block a user