mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add and use DepotInformation
This commit is contained in:
@@ -52,6 +52,10 @@ structure according to the original DAT master directory tree structure.";
|
|||||||
// Get the DAT file associated with the key
|
// Get the DAT file associated with the key
|
||||||
DatFile datFile = DatFile.CreateAndParse(Path.Combine(_dats, foundDats[key]));
|
DatFile datFile = DatFile.CreateAndParse(Path.Combine(_dats, foundDats[key]));
|
||||||
|
|
||||||
|
// Set the depot values
|
||||||
|
datFile.Header.InputDepot = new DepotInformation(true, 4);
|
||||||
|
datFile.Header.OutputDepot = new DepotInformation(true, 4);
|
||||||
|
|
||||||
// Create the new output directory if it doesn't exist
|
// Create the new output directory if it doesn't exist
|
||||||
string outputFolder = Path.Combine(outdat, Path.GetFileNameWithoutExtension(foundDats[key]));
|
string outputFolder = Path.Combine(outdat, Path.GetFileNameWithoutExtension(foundDats[key]));
|
||||||
DirectoryExtensions.Ensure(outputFolder, create: true);
|
DirectoryExtensions.Ensure(outputFolder, create: true);
|
||||||
@@ -62,8 +66,6 @@ structure according to the original DAT master directory tree structure.";
|
|||||||
// Now scan all of those depots and rebuild
|
// Now scan all of those depots and rebuild
|
||||||
datFile.RebuildDepot(
|
datFile.RebuildDepot(
|
||||||
onlineDepots,
|
onlineDepots,
|
||||||
indepth: 4,
|
|
||||||
outdepth: 4,
|
|
||||||
outDir: outputFolder,
|
outDir: outputFolder,
|
||||||
outputFormat: (copy ? OutputFormat.TorrentGzipRomba : OutputFormat.TorrentZip),
|
outputFormat: (copy ? OutputFormat.TorrentGzipRomba : OutputFormat.TorrentZip),
|
||||||
updateDat: false);
|
updateDat: false);
|
||||||
|
|||||||
@@ -2045,7 +2045,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Now find all folders that are empty, if we are supposed to
|
// Now find all folders that are empty, if we are supposed to
|
||||||
if (!Header.Romba && addBlanks)
|
if (!Header.OutputDepot.IsActive && addBlanks)
|
||||||
{
|
{
|
||||||
List<string> empties = DirectoryExtensions.ListEmpty(basePath);
|
List<string> empties = DirectoryExtensions.ListEmpty(basePath);
|
||||||
Parallel.ForEach(empties, Globals.ParallelOptions, dir =>
|
Parallel.ForEach(empties, Globals.ParallelOptions, dir =>
|
||||||
@@ -2119,8 +2119,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
bool addDate,
|
bool addDate,
|
||||||
bool copyFiles)
|
bool copyFiles)
|
||||||
{
|
{
|
||||||
// Special case for if we are in Romba mode (all names are supposed to be SHA-1 hashes)
|
// Special case for if we are in Depot mode (all names are supposed to be SHA-1 hashes)
|
||||||
if (Header.Romba)
|
if (Header.OutputDepot.IsActive)
|
||||||
{
|
{
|
||||||
GZipArchive gzarc = new GZipArchive(item);
|
GZipArchive gzarc = new GZipArchive(item);
|
||||||
BaseFile baseFile = gzarc.GetTorrentGZFileInfo();
|
BaseFile baseFile = gzarc.GetTorrentGZFileInfo();
|
||||||
@@ -2342,8 +2342,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// Process the DAT and find all matches in input files and folders assuming they're a depot
|
/// Process the DAT and find all matches in input files and folders assuming they're a depot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputs">List of input files/folders to check</param>
|
/// <param name="inputs">List of input files/folders to check</param>
|
||||||
/// <param name="indepth">Positive value representing depth of input depot</param>
|
|
||||||
/// <param name="outdepth">Positive value representing depth of output depot</param>
|
|
||||||
/// <param name="outDir">Output directory to use to build to</param>
|
/// <param name="outDir">Output directory to use to build to</param>
|
||||||
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
||||||
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
||||||
@@ -2353,8 +2351,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <returns>True if rebuilding was a success, false otherwise</returns>
|
/// <returns>True if rebuilding was a success, false otherwise</returns>
|
||||||
public bool RebuildDepot(
|
public bool RebuildDepot(
|
||||||
List<string> inputs,
|
List<string> inputs,
|
||||||
int indepth = 4,
|
|
||||||
int outdepth = 4,
|
|
||||||
string outDir = null,
|
string outDir = null,
|
||||||
bool date = false,
|
bool date = false,
|
||||||
bool delete = false,
|
bool delete = false,
|
||||||
@@ -2463,7 +2459,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Globals.Logger.User($"Checking hash '{hash}'");
|
Globals.Logger.User($"Checking hash '{hash}'");
|
||||||
|
|
||||||
// Get the extension path for the hash
|
// Get the extension path for the hash
|
||||||
string subpath = PathExtensions.GetRombaPath(hash, indepth);
|
string subpath = PathExtensions.GetDepotPath(hash, Header.InputDepot.Depth);
|
||||||
|
|
||||||
// Find the first depot that includes the hash
|
// Find the first depot that includes the hash
|
||||||
string foundpath = null;
|
string foundpath = null;
|
||||||
@@ -2495,9 +2491,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Otherwise, we rebuild that file to all locations that we need to
|
// Otherwise, we rebuild that file to all locations that we need to
|
||||||
bool usedInternally;
|
bool usedInternally;
|
||||||
if (Items[hash][0].ItemType == ItemType.Disk)
|
if (Items[hash][0].ItemType == ItemType.Disk)
|
||||||
usedInternally = RebuildIndividualFile(new Disk(fileinfo), foundpath, outDir, outdepth, date, inverse, outputFormat, updateDat, false /* isZip */);
|
usedInternally = RebuildIndividualFile(new Disk(fileinfo), foundpath, outDir, date, inverse, outputFormat, updateDat, false /* isZip */);
|
||||||
else
|
else
|
||||||
usedInternally = RebuildIndividualFile(new Rom(fileinfo), foundpath, outDir, outdepth, date, inverse, outputFormat, updateDat, false /* isZip */);
|
usedInternally = RebuildIndividualFile(new Rom(fileinfo), foundpath, outDir, date, inverse, outputFormat, updateDat, false /* isZip */);
|
||||||
|
|
||||||
// If we are supposed to delete the depot file, do so
|
// If we are supposed to delete the depot file, do so
|
||||||
if (delete && usedInternally)
|
if (delete && usedInternally)
|
||||||
@@ -2526,7 +2522,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputs">List of input files/folders to check</param>
|
/// <param name="inputs">List of input files/folders to check</param>
|
||||||
/// <param name="outDir">Output directory to use to build to</param>
|
/// <param name="outDir">Output directory to use to build to</param>
|
||||||
/// <param name="outdepth">Positive value representing depth of output depot</param>
|
|
||||||
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
||||||
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
||||||
@@ -2538,7 +2533,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
public bool RebuildGeneric(
|
public bool RebuildGeneric(
|
||||||
List<string> inputs,
|
List<string> inputs,
|
||||||
string outDir = null,
|
string outDir = null,
|
||||||
int outdepth = 4,
|
|
||||||
bool quickScan = false,
|
bool quickScan = false,
|
||||||
bool date = false,
|
bool date = false,
|
||||||
bool delete = false,
|
bool delete = false,
|
||||||
@@ -2626,7 +2620,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
if (File.Exists(input))
|
if (File.Exists(input))
|
||||||
{
|
{
|
||||||
Globals.Logger.User($"Checking file: {input}");
|
Globals.Logger.User($"Checking file: {input}");
|
||||||
RebuildGenericHelper(input, outDir, outdepth, quickScan, date, delete, inverse, outputFormat, updateDat, asFiles);
|
RebuildGenericHelper(input, outDir, quickScan, date, delete, inverse, outputFormat, updateDat, asFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the input is a directory
|
// If the input is a directory
|
||||||
@@ -2636,7 +2630,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
Globals.Logger.User($"Checking file: {file}");
|
Globals.Logger.User($"Checking file: {file}");
|
||||||
RebuildGenericHelper(file, outDir, outdepth, quickScan, date, delete, inverse, outputFormat, updateDat, asFiles);
|
RebuildGenericHelper(file, outDir, quickScan, date, delete, inverse, outputFormat, updateDat, asFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2663,7 +2657,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="file">Name of the file to process</param>
|
/// <param name="file">Name of the file to process</param>
|
||||||
/// <param name="outDir">Output directory to use to build to</param>
|
/// <param name="outDir">Output directory to use to build to</param>
|
||||||
/// <param name="outdepth">Positive value representing depth of output depot</param>
|
|
||||||
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
|
||||||
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
||||||
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
/// <param name="delete">True if input files should be deleted, false otherwise</param>
|
||||||
@@ -2674,7 +2667,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
private void RebuildGenericHelper(
|
private void RebuildGenericHelper(
|
||||||
string file,
|
string file,
|
||||||
string outDir,
|
string outDir,
|
||||||
int outdepth,
|
|
||||||
bool quickScan,
|
bool quickScan,
|
||||||
bool date,
|
bool date,
|
||||||
bool delete,
|
bool delete,
|
||||||
@@ -2702,7 +2694,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
else if (externalFileInfo.Type == FileType.None)
|
else if (externalFileInfo.Type == FileType.None)
|
||||||
externalDatItem = new Rom(externalFileInfo);
|
externalDatItem = new Rom(externalFileInfo);
|
||||||
|
|
||||||
usedExternally = RebuildIndividualFile(externalDatItem, file, outDir, outdepth, date, inverse, outputFormat, updateDat, null /* isZip */);
|
usedExternally = RebuildIndividualFile(externalDatItem, file, outDir, date, inverse, outputFormat, updateDat, null /* isZip */);
|
||||||
|
|
||||||
// Scan the file internally
|
// Scan the file internally
|
||||||
|
|
||||||
@@ -2735,7 +2727,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
else if (internalFileInfo.Type == FileType.None)
|
else if (internalFileInfo.Type == FileType.None)
|
||||||
internalDatItem = new Rom(internalFileInfo);
|
internalDatItem = new Rom(internalFileInfo);
|
||||||
|
|
||||||
usedExternally = RebuildIndividualFile(internalDatItem, file, outDir, outdepth, date, inverse, outputFormat, updateDat, null /* isZip */);
|
usedExternally = RebuildIndividualFile(internalDatItem, file, outDir, date, inverse, outputFormat, updateDat, null /* isZip */);
|
||||||
}
|
}
|
||||||
// Otherwise, loop through the entries and try to match
|
// Otherwise, loop through the entries and try to match
|
||||||
else
|
else
|
||||||
@@ -2743,7 +2735,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (BaseFile entry in entries)
|
foreach (BaseFile entry in entries)
|
||||||
{
|
{
|
||||||
DatItem internalDatItem = DatItem.Create(entry);
|
DatItem internalDatItem = DatItem.Create(entry);
|
||||||
usedInternally |= RebuildIndividualFile(internalDatItem, file, outDir, outdepth, date, inverse, outputFormat, updateDat, !isTorrentGzip /* isZip */);
|
usedInternally |= RebuildIndividualFile(internalDatItem, file, outDir, date, inverse, outputFormat, updateDat, !isTorrentGzip /* isZip */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2758,7 +2750,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="datItem">Information for the current file to rebuild from</param>
|
/// <param name="datItem">Information for the current file to rebuild from</param>
|
||||||
/// <param name="file">Name of the file to process</param>
|
/// <param name="file">Name of the file to process</param>
|
||||||
/// <param name="outDir">Output directory to use to build to</param>
|
/// <param name="outDir">Output directory to use to build to</param>
|
||||||
/// <param name="outdepth">Positive value representing depth of output depot</param>
|
|
||||||
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
/// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
|
||||||
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
|
/// <param name="inverse">True if the DAT should be used as a filter instead of a template, false otherwise</param>
|
||||||
/// <param name="outputFormat">Output format that files should be written to</param>
|
/// <param name="outputFormat">Output format that files should be written to</param>
|
||||||
@@ -2769,7 +2760,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
DatItem datItem,
|
DatItem datItem,
|
||||||
string file,
|
string file,
|
||||||
string outDir,
|
string outDir,
|
||||||
int outdepth,
|
|
||||||
bool date,
|
bool date,
|
||||||
bool inverse,
|
bool inverse,
|
||||||
OutputFormat outputFormat,
|
OutputFormat outputFormat,
|
||||||
@@ -2811,7 +2801,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// Get the proper output path
|
// Get the proper output path
|
||||||
if (outputFormat == OutputFormat.TorrentGzipRomba)
|
if (outputFormat == OutputFormat.TorrentGzipRomba)
|
||||||
outDir = Path.Combine(outDir, PathExtensions.GetRombaPath(sha1, outdepth));
|
outDir = Path.Combine(outDir, PathExtensions.GetDepotPath(sha1, Header.OutputDepot.Depth));
|
||||||
else
|
else
|
||||||
outDir = Path.Combine(outDir, sha1 + ".gz");
|
outDir = Path.Combine(outDir, sha1 + ".gz");
|
||||||
|
|
||||||
@@ -2839,7 +2829,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// Get the proper output path
|
// Get the proper output path
|
||||||
if (outputFormat == OutputFormat.TorrentXZRomba)
|
if (outputFormat == OutputFormat.TorrentXZRomba)
|
||||||
outDir = Path.Combine(outDir, PathExtensions.GetRombaPath(sha1, outdepth));
|
outDir = Path.Combine(outDir, PathExtensions.GetDepotPath(sha1, Header.OutputDepot.Depth));
|
||||||
else
|
else
|
||||||
outDir = Path.Combine(outDir, sha1 + ".xz");
|
outDir = Path.Combine(outDir, sha1 + ".xz");
|
||||||
|
|
||||||
@@ -2912,7 +2902,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Folder outputArchive = Folder.Create(outputFormat);
|
Folder outputArchive = Folder.Create(outputFormat);
|
||||||
|
|
||||||
// Now rebuild to the output file
|
// Now rebuild to the output file
|
||||||
outputArchive.Write(fileStream, outDir, (Rom)item, date: date, depth: outdepth);
|
outputArchive.Write(fileStream, outDir, (Rom)item, date: date, depth: Header.OutputDepot.Depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the input stream
|
// Close the input stream
|
||||||
@@ -2979,8 +2969,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Folder outputArchive = Folder.Create(outputFormat);
|
Folder outputArchive = Folder.Create(outputFormat);
|
||||||
|
|
||||||
// Now rebuild to the output file
|
// Now rebuild to the output file
|
||||||
eitherSuccess |= outputArchive.Write(transformStream, outDir, (Rom)item, date: date, depth: outdepth);
|
eitherSuccess |= outputArchive.Write(transformStream, outDir, (Rom)item, date: date, depth: Header.OutputDepot.Depth);
|
||||||
eitherSuccess |= outputArchive.Write(fileStream, outDir, (Rom)datItem, date: date, depth: outdepth);
|
eitherSuccess |= outputArchive.Write(fileStream, outDir, (Rom)datItem, date: date, depth: Header.OutputDepot.Depth);
|
||||||
|
|
||||||
// Now add the success of either rebuild
|
// Now add the success of either rebuild
|
||||||
rebuilt &= eitherSuccess;
|
rebuilt &= eitherSuccess;
|
||||||
@@ -3003,10 +2993,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// Process the DAT and verify from the depots
|
/// Process the DAT and verify from the depots
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputs">List of input directories to compare against</param>
|
/// <param name="inputs">List of input directories to compare against</param>
|
||||||
/// <param name="depth">Positive value representing depot depth, defaults to 4</param>
|
|
||||||
/// <param name="outDir">Optional param for output directory</param>
|
/// <param name="outDir">Optional param for output directory</param>
|
||||||
/// <returns>True if verification was a success, false otherwise</returns>
|
/// <returns>True if verification was a success, false otherwise</returns>
|
||||||
public bool VerifyDepot(List<string> inputs, int depth = 4, string outDir = null)
|
public bool VerifyDepot(List<string> inputs, string outDir = null)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -3042,7 +3031,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Globals.Logger.User($"Checking hash '{hash}'");
|
Globals.Logger.User($"Checking hash '{hash}'");
|
||||||
|
|
||||||
// Get the extension path for the hash
|
// Get the extension path for the hash
|
||||||
string subpath = PathExtensions.GetRombaPath(hash, depth);
|
string subpath = PathExtensions.GetDepotPath(hash, Header.InputDepot.Depth);
|
||||||
|
|
||||||
// Find the first depot that includes the hash
|
// Find the first depot that includes the hash
|
||||||
string foundpath = null;
|
string foundpath = null;
|
||||||
@@ -3723,8 +3712,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
string pre = CreatePrefixPostfix(item, true);
|
string pre = CreatePrefixPostfix(item, true);
|
||||||
string post = CreatePrefixPostfix(item, false);
|
string post = CreatePrefixPostfix(item, false);
|
||||||
|
|
||||||
// If we're in Romba mode, take care of that instead
|
// If we're in Depot mode, take care of that instead
|
||||||
if (Header.Romba)
|
if (Header.OutputDepot.IsActive)
|
||||||
{
|
{
|
||||||
if (item.ItemType == ItemType.Rom)
|
if (item.ItemType == ItemType.Rom)
|
||||||
{
|
{
|
||||||
@@ -3733,7 +3722,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// We can only write out if there's a SHA-1
|
// We can only write out if there's a SHA-1
|
||||||
if (!string.IsNullOrWhiteSpace(romItem.SHA1))
|
if (!string.IsNullOrWhiteSpace(romItem.SHA1))
|
||||||
{
|
{
|
||||||
name = PathExtensions.GetRombaPath(romItem.SHA1, Header.RombaDepth).Replace('\\', '/');
|
name = PathExtensions.GetDepotPath(romItem.SHA1, Header.OutputDepot.Depth).Replace('\\', '/');
|
||||||
item.Name = $"{pre}{name}{post}";
|
item.Name = $"{pre}{name}{post}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3744,7 +3733,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// We can only write out if there's a SHA-1
|
// We can only write out if there's a SHA-1
|
||||||
if (!string.IsNullOrWhiteSpace(diskItem.SHA1))
|
if (!string.IsNullOrWhiteSpace(diskItem.SHA1))
|
||||||
{
|
{
|
||||||
name = PathExtensions.GetRombaPath(diskItem.SHA1, Header.RombaDepth).Replace('\\', '/');
|
name = PathExtensions.GetDepotPath(diskItem.SHA1, Header.OutputDepot.Depth).Replace('\\', '/');
|
||||||
item.Name = pre + name + post;
|
item.Name = pre + name + post;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,16 +211,16 @@ namespace SabreTools.Library.DatFiles
|
|||||||
public bool RemoveExtension { get; set; }
|
public bool RemoveExtension { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Romba output mode
|
/// Input depot information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool Romba { get; set; }
|
public DepotInformation InputDepot { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Romba depth
|
/// Output depot information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int RombaDepth { get; set; } = 4;
|
public DepotInformation OutputDepot { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Output the machine name
|
/// Output the machine name
|
||||||
@@ -294,8 +294,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AddExtension = this.AddExtension,
|
AddExtension = this.AddExtension,
|
||||||
RemoveExtension = this.RemoveExtension,
|
RemoveExtension = this.RemoveExtension,
|
||||||
GameName = this.GameName,
|
GameName = this.GameName,
|
||||||
Romba = this.Romba,
|
InputDepot = this.InputDepot.Clone() as DepotInformation,
|
||||||
RombaDepth = this.RombaDepth,
|
OutputDepot = this.OutputDepot.Clone() as DepotInformation,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,8 +358,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AddExtension = this.AddExtension,
|
AddExtension = this.AddExtension,
|
||||||
RemoveExtension = this.RemoveExtension,
|
RemoveExtension = this.RemoveExtension,
|
||||||
GameName = this.GameName,
|
GameName = this.GameName,
|
||||||
Romba = this.Romba,
|
InputDepot = this.InputDepot.Clone() as DepotInformation,
|
||||||
RombaDepth = this.RombaDepth,
|
OutputDepot = this.OutputDepot.Clone() as DepotInformation,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,86 +370,86 @@ namespace SabreTools.Library.DatFiles
|
|||||||
public void ConditionalCopy(DatHeader datHeader)
|
public void ConditionalCopy(DatHeader datHeader)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.FileName))
|
if (!string.IsNullOrWhiteSpace(datHeader.FileName))
|
||||||
this.FileName = datHeader.FileName;
|
FileName = datHeader.FileName;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Name))
|
if (!string.IsNullOrWhiteSpace(datHeader.Name))
|
||||||
this.Name = datHeader.Name;
|
Name = datHeader.Name;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Description))
|
if (!string.IsNullOrWhiteSpace(datHeader.Description))
|
||||||
this.Description = datHeader.Description;
|
Description = datHeader.Description;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.RootDir))
|
if (!string.IsNullOrWhiteSpace(datHeader.RootDir))
|
||||||
this.RootDir = datHeader.RootDir;
|
RootDir = datHeader.RootDir;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Category))
|
if (!string.IsNullOrWhiteSpace(datHeader.Category))
|
||||||
this.Category = datHeader.Category;
|
Category = datHeader.Category;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Version))
|
if (!string.IsNullOrWhiteSpace(datHeader.Version))
|
||||||
this.Version = datHeader.Version;
|
Version = datHeader.Version;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Date))
|
if (!string.IsNullOrWhiteSpace(datHeader.Date))
|
||||||
this.Date = datHeader.Date;
|
Date = datHeader.Date;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Author))
|
if (!string.IsNullOrWhiteSpace(datHeader.Author))
|
||||||
this.Author = datHeader.Author;
|
Author = datHeader.Author;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Email))
|
if (!string.IsNullOrWhiteSpace(datHeader.Email))
|
||||||
this.Email = datHeader.Email;
|
Email = datHeader.Email;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Homepage))
|
if (!string.IsNullOrWhiteSpace(datHeader.Homepage))
|
||||||
this.Homepage = datHeader.Homepage;
|
Homepage = datHeader.Homepage;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Url))
|
if (!string.IsNullOrWhiteSpace(datHeader.Url))
|
||||||
this.Url = datHeader.Url;
|
Url = datHeader.Url;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Comment))
|
if (!string.IsNullOrWhiteSpace(datHeader.Comment))
|
||||||
this.Comment = datHeader.Comment;
|
Comment = datHeader.Comment;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.HeaderSkipper))
|
if (!string.IsNullOrWhiteSpace(datHeader.HeaderSkipper))
|
||||||
this.HeaderSkipper = datHeader.HeaderSkipper;
|
HeaderSkipper = datHeader.HeaderSkipper;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Type))
|
if (!string.IsNullOrWhiteSpace(datHeader.Type))
|
||||||
this.Type = datHeader.Type;
|
Type = datHeader.Type;
|
||||||
|
|
||||||
if (datHeader.ForceMerging != ForceMerging.None)
|
if (datHeader.ForceMerging != ForceMerging.None)
|
||||||
this.ForceMerging = datHeader.ForceMerging;
|
ForceMerging = datHeader.ForceMerging;
|
||||||
|
|
||||||
if (datHeader.ForceNodump != ForceNodump.None)
|
if (datHeader.ForceNodump != ForceNodump.None)
|
||||||
this.ForceNodump = datHeader.ForceNodump;
|
ForceNodump = datHeader.ForceNodump;
|
||||||
|
|
||||||
if (datHeader.ForcePacking != ForcePacking.None)
|
if (datHeader.ForcePacking != ForcePacking.None)
|
||||||
this.ForcePacking = datHeader.ForcePacking;
|
ForcePacking = datHeader.ForcePacking;
|
||||||
|
|
||||||
if (datHeader.DatFormat != 0x00)
|
if (datHeader.DatFormat != 0x00)
|
||||||
this.DatFormat = datHeader.DatFormat;
|
DatFormat = datHeader.DatFormat;
|
||||||
|
|
||||||
if (datHeader.ExcludeFields != null)
|
if (datHeader.ExcludeFields != null)
|
||||||
this.ExcludeFields = datHeader.ExcludeFields;
|
ExcludeFields = datHeader.ExcludeFields;
|
||||||
|
|
||||||
this.OneRomPerGame = datHeader.OneRomPerGame;
|
OneRomPerGame = datHeader.OneRomPerGame;
|
||||||
this.KeepEmptyGames = datHeader.KeepEmptyGames;
|
KeepEmptyGames = datHeader.KeepEmptyGames;
|
||||||
this.SceneDateStrip = datHeader.SceneDateStrip;
|
SceneDateStrip = datHeader.SceneDateStrip;
|
||||||
this.DedupeRoms = datHeader.DedupeRoms;
|
DedupeRoms = datHeader.DedupeRoms;
|
||||||
//this.StripHash = datHeader.StripHash;
|
//StripHash = datHeader.StripHash;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Prefix))
|
if (!string.IsNullOrWhiteSpace(datHeader.Prefix))
|
||||||
this.Prefix = datHeader.Prefix;
|
Prefix = datHeader.Prefix;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.Postfix))
|
if (!string.IsNullOrWhiteSpace(datHeader.Postfix))
|
||||||
this.Postfix = datHeader.Postfix;
|
Postfix = datHeader.Postfix;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.AddExtension))
|
if (!string.IsNullOrWhiteSpace(datHeader.AddExtension))
|
||||||
this.AddExtension = datHeader.AddExtension;
|
AddExtension = datHeader.AddExtension;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(datHeader.ReplaceExtension))
|
if (!string.IsNullOrWhiteSpace(datHeader.ReplaceExtension))
|
||||||
this.ReplaceExtension = datHeader.ReplaceExtension;
|
ReplaceExtension = datHeader.ReplaceExtension;
|
||||||
|
|
||||||
this.RemoveExtension = datHeader.RemoveExtension;
|
RemoveExtension = datHeader.RemoveExtension;
|
||||||
this.Romba = datHeader.Romba;
|
InputDepot = datHeader.InputDepot.Clone() as DepotInformation;
|
||||||
this.RombaDepth = datHeader.RombaDepth;
|
OutputDepot = datHeader.OutputDepot.Clone() as DepotInformation;
|
||||||
this.GameName = datHeader.GameName;
|
GameName = datHeader.GameName;
|
||||||
this.Quotes = datHeader.Quotes;
|
Quotes = datHeader.Quotes;
|
||||||
this.UseRomName = datHeader.UseRomName;
|
UseRomName = datHeader.UseRomName;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
60
SabreTools.Library/DatFiles/DepotInformation.cs
Normal file
60
SabreTools.Library/DatFiles/DepotInformation.cs
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
using SabreTools.Library.Data;
|
||||||
|
|
||||||
|
namespace SabreTools.Library.DatFiles
|
||||||
|
{
|
||||||
|
public class DepotInformation : ICloneable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Name or path of the Depot
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to use this Depot or not
|
||||||
|
/// </summary>
|
||||||
|
public bool IsActive { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Depot byte-depth
|
||||||
|
/// </summary>
|
||||||
|
public int Depth { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isActive">Set active state</param>
|
||||||
|
/// <param name="depth">Set depth between 0 and SHA-1's byte length</param>
|
||||||
|
public DepotInformation(bool isActive = false, int depth = 4)
|
||||||
|
{
|
||||||
|
IsActive = isActive;
|
||||||
|
Depth = depth;
|
||||||
|
|
||||||
|
// Limit depth value
|
||||||
|
if (Depth == Int32.MinValue)
|
||||||
|
Depth = 4;
|
||||||
|
else if (Depth < 0)
|
||||||
|
Depth = 0;
|
||||||
|
else if (Depth > Constants.SHA1Zero.Length)
|
||||||
|
Depth = Constants.SHA1Zero.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Cloning
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clone the current object
|
||||||
|
/// </summary>
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
return new DepotInformation
|
||||||
|
{
|
||||||
|
Name = this.Name,
|
||||||
|
IsActive = this.IsActive,
|
||||||
|
Depth = this.Depth,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -136,7 +136,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
ProcessItemName(datItem, false, forceRomName: false);
|
ProcessItemName(datItem, false, forceRomName: false);
|
||||||
|
|
||||||
// Romba mode automatically uses item name
|
// Romba mode automatically uses item name
|
||||||
if (Header.Romba || Header.UseRomName)
|
if (Header.OutputDepot.IsActive || Header.UseRomName)
|
||||||
{
|
{
|
||||||
sw.Write($"{datItem.GetField(Field.Name, Header.ExcludeFields)}\n");
|
sw.Write($"{datItem.GetField(Field.Name, Header.ExcludeFields)}\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -457,7 +457,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
rom = new Rom(inputStream.GetInfo(keepReadOpen: true));
|
rom = new Rom(inputStream.GetInfo(keepReadOpen: true));
|
||||||
|
|
||||||
// Get the output file name
|
// Get the output file name
|
||||||
string outfile = Path.Combine(outDir, PathExtensions.GetRombaPath(rom.SHA1, depth)); // TODO: When updating to SHA-256, this needs to update to SHA256
|
string outfile = Path.Combine(outDir, PathExtensions.GetDepotPath(rom.SHA1, depth)); // TODO: When updating to SHA-256, this needs to update to SHA256
|
||||||
|
|
||||||
// Check to see if the folder needs to be created
|
// Check to see if the folder needs to be created
|
||||||
if (!Directory.Exists(Path.GetDirectoryName(outfile)))
|
if (!Directory.Exists(Path.GetDirectoryName(outfile)))
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ namespace SabreTools.Library.FileTypes
|
|||||||
rom = new Rom(inputStream.GetInfo(keepReadOpen: true));
|
rom = new Rom(inputStream.GetInfo(keepReadOpen: true));
|
||||||
|
|
||||||
// Get the output file name
|
// Get the output file name
|
||||||
string outfile = Path.Combine(outDir, PathExtensions.GetRombaPath(rom.SHA1, depth)); // TODO: When updating to SHA-256, this needs to update to SHA256
|
string outfile = Path.Combine(outDir, PathExtensions.GetDepotPath(rom.SHA1, depth)); // TODO: When updating to SHA-256, this needs to update to SHA256
|
||||||
outfile = outfile.Replace(".gz", ".xz");
|
outfile = outfile.Replace(".gz", ".xz");
|
||||||
|
|
||||||
// Check to see if the folder needs to be created
|
// Check to see if the folder needs to be created
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace SabreTools.Library.IO
|
|||||||
/// <param name="hash">SHA-1 hash to get the path for</param>
|
/// <param name="hash">SHA-1 hash to get the path for</param>
|
||||||
/// <param name="depth">Positive value representing the depth of the depot</param>
|
/// <param name="depth">Positive value representing the depth of the depot</param>
|
||||||
/// <returns>Subfolder path for the given hash</returns>
|
/// <returns>Subfolder path for the given hash</returns>
|
||||||
public static string GetRombaPath(string hash, int depth)
|
public static string GetDepotPath(string hash, int depth)
|
||||||
{
|
{
|
||||||
// If the hash isn't the right size, then we return null
|
// If the hash isn't the right size, then we return null
|
||||||
if (hash.Length != Constants.SHA1Length) // TODO: When updating to SHA-256, this needs to update to Constants.SHA256Length
|
if (hash.Length != Constants.SHA1Length) // TODO: When updating to SHA-256, this needs to update to Constants.SHA256Length
|
||||||
|
|||||||
@@ -2661,8 +2661,6 @@ Some special strings that can be used:
|
|||||||
RegionList = GetList(features, RegionListValue),
|
RegionList = GetList(features, RegionListValue),
|
||||||
RemoveExtension = GetBoolean(features, RemoveExtensionsValue),
|
RemoveExtension = GetBoolean(features, RemoveExtensionsValue),
|
||||||
ReplaceExtension = GetString(features, ReplaceExtensionStringValue),
|
ReplaceExtension = GetString(features, ReplaceExtensionStringValue),
|
||||||
Romba = GetBoolean(features, RombaValue),
|
|
||||||
RombaDepth = GetInt32(features, RombaDepthInt32Value),
|
|
||||||
RootDir = GetString(features, RootStringValue),
|
RootDir = GetString(features, RootStringValue),
|
||||||
SceneDateStrip = GetBoolean(features, SceneDateStripValue),
|
SceneDateStrip = GetBoolean(features, SceneDateStripValue),
|
||||||
Type = GetBoolean(features, SuperdatValue) ? "SuperDAT" : null,
|
Type = GetBoolean(features, SuperdatValue) ? "SuperDAT" : null,
|
||||||
@@ -2671,9 +2669,13 @@ Some special strings that can be used:
|
|||||||
Version = GetString(features, VersionStringValue),
|
Version = GetString(features, VersionStringValue),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set a reasonable default for the Romba depth
|
// Get the depot information
|
||||||
if (datHeader.RombaDepth == Int32.MinValue)
|
datHeader.InputDepot = new DepotInformation(
|
||||||
datHeader.RombaDepth = 4;
|
GetBoolean(features, DepotValue),
|
||||||
|
GetInt32(features, DepotDepthInt32Value));
|
||||||
|
datHeader.OutputDepot = new DepotInformation(
|
||||||
|
GetBoolean(features, RombaValue),
|
||||||
|
GetInt32(features, RombaDepthInt32Value));
|
||||||
|
|
||||||
bool deprecated = GetBoolean(features, DeprecatedValue);
|
bool deprecated = GetBoolean(features, DeprecatedValue);
|
||||||
foreach (string ot in GetList(features, OutputTypeListValue))
|
foreach (string ot in GetList(features, OutputTypeListValue))
|
||||||
|
|||||||
@@ -62,27 +62,17 @@ namespace SabreTools.Features
|
|||||||
TreatAsFiles asFiles = GetTreatAsFiles(features);
|
TreatAsFiles asFiles = GetTreatAsFiles(features);
|
||||||
bool date = GetBoolean(features, AddDateValue);
|
bool date = GetBoolean(features, AddDateValue);
|
||||||
bool delete = GetBoolean(features, DeleteValue);
|
bool delete = GetBoolean(features, DeleteValue);
|
||||||
bool depot = GetBoolean(features, DepotValue);
|
|
||||||
bool inverse = GetBoolean(features, InverseValue);
|
bool inverse = GetBoolean(features, InverseValue);
|
||||||
bool quickScan = GetBoolean(features, QuickValue);
|
bool quickScan = GetBoolean(features, QuickValue);
|
||||||
bool romba = GetBoolean(features, RombaValue);
|
|
||||||
bool updateDat = GetBoolean(features, UpdateDatValue);
|
bool updateDat = GetBoolean(features, UpdateDatValue);
|
||||||
var outputFormat = GetOutputFormat(features);
|
var outputFormat = GetOutputFormat(features);
|
||||||
|
|
||||||
// Get optional depths
|
|
||||||
int depotDepth = 4;
|
|
||||||
if (features.ContainsKey(DepotDepthInt32Value))
|
|
||||||
depotDepth = GetInt32(features, DepotDepthInt32Value);
|
|
||||||
int rombaDepth = 4;
|
|
||||||
if (features.ContainsKey(RombaDepthInt32Value))
|
|
||||||
rombaDepth = GetInt32(features, RombaDepthInt32Value);
|
|
||||||
|
|
||||||
// If we have TorrentGzip output and the romba flag, update
|
// If we have TorrentGzip output and the romba flag, update
|
||||||
if (romba && outputFormat == OutputFormat.TorrentGzip)
|
if (Header.OutputDepot.IsActive && outputFormat == OutputFormat.TorrentGzip)
|
||||||
outputFormat = OutputFormat.TorrentGzipRomba;
|
outputFormat = OutputFormat.TorrentGzipRomba;
|
||||||
|
|
||||||
// If we hae TorrentXZ output and the romba flag, update
|
// If we hae TorrentXZ output and the romba flag, update
|
||||||
if (romba && outputFormat == OutputFormat.TorrentXZ)
|
if (Header.OutputDepot.IsActive && outputFormat == OutputFormat.TorrentXZ)
|
||||||
outputFormat = OutputFormat.TorrentXZRomba;
|
outputFormat = OutputFormat.TorrentXZRomba;
|
||||||
|
|
||||||
// Get a list of files from the input datfiles
|
// Get a list of files from the input datfiles
|
||||||
@@ -97,15 +87,19 @@ namespace SabreTools.Features
|
|||||||
DatFile datdata = DatFile.Create();
|
DatFile datdata = DatFile.Create();
|
||||||
datdata.Parse(datfile, 99, keep: true);
|
datdata.Parse(datfile, 99, keep: true);
|
||||||
|
|
||||||
|
// Set depot information
|
||||||
|
datdata.Header.InputDepot = Header.InputDepot.Clone() as DepotInformation;
|
||||||
|
datdata.Header.OutputDepot = Header.OutputDepot.Clone() as DepotInformation;
|
||||||
|
|
||||||
// If we have overridden the header skipper, set it now
|
// If we have overridden the header skipper, set it now
|
||||||
if (!string.IsNullOrEmpty(Header.HeaderSkipper))
|
if (!string.IsNullOrEmpty(Header.HeaderSkipper))
|
||||||
datdata.Header.HeaderSkipper = Header.HeaderSkipper;
|
datdata.Header.HeaderSkipper = Header.HeaderSkipper;
|
||||||
|
|
||||||
// If we have the depot flag, respect it
|
// If we have the depot flag, respect it
|
||||||
if (depot)
|
if (Header.InputDepot.IsActive)
|
||||||
datdata.RebuildDepot(Inputs, depotDepth, rombaDepth, Path.Combine(OutputDir, datdata.Header.FileName), date, delete, inverse, outputFormat, updateDat);
|
datdata.RebuildDepot(Inputs, Path.Combine(OutputDir, datdata.Header.FileName), date, delete, inverse, outputFormat, updateDat);
|
||||||
else
|
else
|
||||||
datdata.RebuildGeneric(Inputs, Path.Combine(OutputDir, datdata.Header.FileName), rombaDepth, quickScan, date, delete, inverse, outputFormat, updateDat, asFiles);
|
datdata.RebuildGeneric(Inputs, Path.Combine(OutputDir, datdata.Header.FileName), quickScan, date, delete, inverse, outputFormat, updateDat, asFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,6 +115,10 @@ namespace SabreTools.Features
|
|||||||
datdata.Parse(datfile, 99, keep: true);
|
datdata.Parse(datfile, 99, keep: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set depot information
|
||||||
|
datdata.Header.InputDepot = Header.InputDepot.Clone() as DepotInformation;
|
||||||
|
datdata.Header.OutputDepot = Header.OutputDepot.Clone() as DepotInformation;
|
||||||
|
|
||||||
// If we have overridden the header skipper, set it now
|
// If we have overridden the header skipper, set it now
|
||||||
if (!string.IsNullOrEmpty(Header.HeaderSkipper))
|
if (!string.IsNullOrEmpty(Header.HeaderSkipper))
|
||||||
datdata.Header.HeaderSkipper = Header.HeaderSkipper;
|
datdata.Header.HeaderSkipper = Header.HeaderSkipper;
|
||||||
@@ -128,10 +126,10 @@ namespace SabreTools.Features
|
|||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
// If we have the depot flag, respect it
|
// If we have the depot flag, respect it
|
||||||
if (depot)
|
if (Header.InputDepot.IsActive)
|
||||||
datdata.RebuildDepot(Inputs, depotDepth, rombaDepth, OutputDir, date, delete, inverse, outputFormat, updateDat);
|
datdata.RebuildDepot(Inputs, OutputDir, date, delete, inverse, outputFormat, updateDat);
|
||||||
else
|
else
|
||||||
datdata.RebuildGeneric(Inputs, OutputDir, rombaDepth, quickScan, date, delete, inverse, outputFormat, updateDat, asFiles);
|
datdata.RebuildGeneric(Inputs, OutputDir, quickScan, date, delete, inverse, outputFormat, updateDat, asFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,15 +44,9 @@ namespace SabreTools.Features
|
|||||||
|
|
||||||
// Get feature flags
|
// Get feature flags
|
||||||
TreatAsFiles asFiles = GetTreatAsFiles(features);
|
TreatAsFiles asFiles = GetTreatAsFiles(features);
|
||||||
bool depot = GetBoolean(features, DepotValue);
|
|
||||||
bool hashOnly = GetBoolean(features, HashOnlyValue);
|
bool hashOnly = GetBoolean(features, HashOnlyValue);
|
||||||
bool quickScan = GetBoolean(features, QuickValue);
|
bool quickScan = GetBoolean(features, QuickValue);
|
||||||
|
|
||||||
// Get optional depth
|
|
||||||
int depotDepth = 4;
|
|
||||||
if (features.ContainsKey(DepotDepthInt32Value))
|
|
||||||
depotDepth = GetInt32(features, DepotDepthInt32Value);
|
|
||||||
|
|
||||||
// If we are in individual mode, process each DAT on their own
|
// If we are in individual mode, process each DAT on their own
|
||||||
if (GetBoolean(features, IndividualValue))
|
if (GetBoolean(features, IndividualValue))
|
||||||
{
|
{
|
||||||
@@ -62,13 +56,16 @@ namespace SabreTools.Features
|
|||||||
datdata.Parse(datfile, 99, keep: true);
|
datdata.Parse(datfile, 99, keep: true);
|
||||||
datdata.ApplyFilter(Filter, true);
|
datdata.ApplyFilter(Filter, true);
|
||||||
|
|
||||||
|
// Set depot information
|
||||||
|
datdata.Header.InputDepot = Header.InputDepot.Clone() as DepotInformation;
|
||||||
|
|
||||||
// If we have overridden the header skipper, set it now
|
// If we have overridden the header skipper, set it now
|
||||||
if (!string.IsNullOrEmpty(Header.HeaderSkipper))
|
if (!string.IsNullOrEmpty(Header.HeaderSkipper))
|
||||||
datdata.Header.HeaderSkipper = Header.HeaderSkipper;
|
datdata.Header.HeaderSkipper = Header.HeaderSkipper;
|
||||||
|
|
||||||
// If we have the depot flag, respect it
|
// If we have the depot flag, respect it
|
||||||
if (depot)
|
if (Header.InputDepot.IsActive)
|
||||||
datdata.VerifyDepot(Inputs, depotDepth, OutputDir);
|
datdata.VerifyDepot(Inputs, OutputDir);
|
||||||
else
|
else
|
||||||
datdata.VerifyGeneric(Inputs, OutputDir, hashOnly, quickScan, asFiles, Filter);
|
datdata.VerifyGeneric(Inputs, OutputDir, hashOnly, quickScan, asFiles, Filter);
|
||||||
}
|
}
|
||||||
@@ -86,6 +83,9 @@ namespace SabreTools.Features
|
|||||||
datdata.ApplyFilter(Filter, true);
|
datdata.ApplyFilter(Filter, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set depot information
|
||||||
|
datdata.Header.InputDepot = Header.InputDepot.Clone() as DepotInformation;
|
||||||
|
|
||||||
// If we have overridden the header skipper, set it now
|
// If we have overridden the header skipper, set it now
|
||||||
if (!string.IsNullOrEmpty(Header.HeaderSkipper))
|
if (!string.IsNullOrEmpty(Header.HeaderSkipper))
|
||||||
datdata.Header.HeaderSkipper = Header.HeaderSkipper;
|
datdata.Header.HeaderSkipper = Header.HeaderSkipper;
|
||||||
@@ -93,8 +93,8 @@ namespace SabreTools.Features
|
|||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
// If we have the depot flag, respect it
|
// If we have the depot flag, respect it
|
||||||
if (depot)
|
if (Header.InputDepot.IsActive)
|
||||||
datdata.VerifyDepot(Inputs, depotDepth, OutputDir);
|
datdata.VerifyDepot(Inputs, OutputDir);
|
||||||
else
|
else
|
||||||
datdata.VerifyGeneric(Inputs, OutputDir, hashOnly, quickScan, asFiles, Filter);
|
datdata.VerifyGeneric(Inputs, OutputDir, hashOnly, quickScan, asFiles, Filter);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user