mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Convert depot information to keys
This commit is contained in:
@@ -58,8 +58,8 @@ structure according to the original DAT master directory tree structure.";
|
||||
DatFile datFile = Parser.CreateAndParse(Path.Combine(_dats!, foundDats[key]));
|
||||
|
||||
// Set the depot values
|
||||
datFile.Header.InputDepot = new DepotInformation(true, 4);
|
||||
datFile.Header.OutputDepot = new DepotInformation(true, 4);
|
||||
datFile.Header.SetFieldValue<DepotInformation?>(DatHeader.InputDepotKey, new DepotInformation(true, 4));
|
||||
datFile.Header.SetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey, new DepotInformation(true, 4));
|
||||
|
||||
// Create the new output directory if it doesn't exist
|
||||
string outputFolder = Path.Combine(outdat, Path.GetFileNameWithoutExtension(foundDats[key]));
|
||||
|
||||
@@ -456,14 +456,14 @@ namespace SabreTools.DatFiles
|
||||
string post = CreatePrefixPostfix(item, false);
|
||||
|
||||
// If we're in Depot mode, take care of that instead
|
||||
if (Header.OutputDepot?.IsActive == true)
|
||||
if (Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.IsActive == true)
|
||||
{
|
||||
if (item is Disk disk)
|
||||
{
|
||||
// We can only write out if there's a SHA-1
|
||||
if (!string.IsNullOrEmpty(disk.GetFieldValue<string?>(Models.Metadata.Disk.SHA1Key)))
|
||||
{
|
||||
name = Utilities.GetDepotPath(disk.GetFieldValue<string?>(Models.Metadata.Disk.SHA1Key), Header.OutputDepot.Depth)?.Replace('\\', '/');
|
||||
name = Utilities.GetDepotPath(disk.GetFieldValue<string?>(Models.Metadata.Disk.SHA1Key), Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)!.Depth)?.Replace('\\', '/');
|
||||
item.SetName($"{pre}{name}{post}");
|
||||
}
|
||||
}
|
||||
@@ -472,7 +472,7 @@ namespace SabreTools.DatFiles
|
||||
// We can only write out if there's a SHA-1
|
||||
if (!string.IsNullOrEmpty(media.GetFieldValue<string?>(Models.Metadata.Media.SHA1Key)))
|
||||
{
|
||||
name = Utilities.GetDepotPath(media.GetFieldValue<string?>(Models.Metadata.Media.SHA1Key), Header.OutputDepot.Depth)?.Replace('\\', '/');
|
||||
name = Utilities.GetDepotPath(media.GetFieldValue<string?>(Models.Metadata.Media.SHA1Key), Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)!.Depth)?.Replace('\\', '/');
|
||||
item.SetName($"{pre}{name}{post}");
|
||||
}
|
||||
}
|
||||
@@ -481,7 +481,7 @@ namespace SabreTools.DatFiles
|
||||
// We can only write out if there's a SHA-1
|
||||
if (!string.IsNullOrEmpty(rom.GetFieldValue<string?>(Models.Metadata.Rom.SHA1Key)))
|
||||
{
|
||||
name = Utilities.GetDepotPath(rom.GetFieldValue<string?>(Models.Metadata.Rom.SHA1Key), Header.OutputDepot.Depth)?.Replace('\\', '/');
|
||||
name = Utilities.GetDepotPath(rom.GetFieldValue<string?>(Models.Metadata.Rom.SHA1Key), Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)!.Depth)?.Replace('\\', '/');
|
||||
item.SetName($"{pre}{name}{post}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,16 @@ namespace SabreTools.DatFiles
|
||||
/// </summary>
|
||||
public const string GameNameKey = "GAMENAME";
|
||||
|
||||
/// <summary>
|
||||
/// Input depot information
|
||||
/// </summary>
|
||||
public const string InputDepotKey = "INPUTDEPOT";
|
||||
|
||||
/// <summary>
|
||||
/// Output depot information
|
||||
/// </summary>
|
||||
public const string OutputDepotKey = "OUTPUTDEPOT";
|
||||
|
||||
/// <summary>
|
||||
/// Text to append to all outputted lines
|
||||
/// </summary>
|
||||
@@ -92,22 +102,6 @@ namespace SabreTools.DatFiles
|
||||
}
|
||||
}
|
||||
|
||||
#region Depot Information
|
||||
|
||||
/// <summary>
|
||||
/// Input depot information
|
||||
/// </summary>
|
||||
[JsonIgnore, XmlIgnore]
|
||||
public DepotInformation? InputDepot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Output depot information
|
||||
/// </summary>
|
||||
[JsonIgnore, XmlIgnore]
|
||||
public DepotInformation? OutputDepot { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Internal Header model
|
||||
/// </summary>
|
||||
@@ -163,11 +157,7 @@ namespace SabreTools.DatFiles
|
||||
/// </summary>
|
||||
public object Clone()
|
||||
{
|
||||
var header = new DatHeader()
|
||||
{
|
||||
InputDepot = this.InputDepot?.Clone() as DepotInformation,
|
||||
OutputDepot = this.OutputDepot?.Clone() as DepotInformation,
|
||||
};
|
||||
var header = new DatHeader();
|
||||
header.SetFieldValue<string?>(DatHeader.AddExtensionKey, GetFieldValue<string?>(DatHeader.AddExtensionKey));
|
||||
header.SetFieldValue<string?>(Models.Metadata.Header.AuthorKey, GetFieldValue<string?>(Models.Metadata.Header.AuthorKey));
|
||||
header.SetFieldValue<MergingFlag>(Models.Metadata.Header.BiosModeKey, GetFieldValue<MergingFlag>(Models.Metadata.Header.BiosModeKey));
|
||||
@@ -190,6 +180,8 @@ namespace SabreTools.DatFiles
|
||||
header.SetFieldValue<string?>(Models.Metadata.Header.HomepageKey, GetFieldValue<string?>(Models.Metadata.Header.HomepageKey));
|
||||
header.SetFieldValue<string?>(Models.Metadata.Header.IdKey, GetFieldValue<string?>(Models.Metadata.Header.IdKey));
|
||||
header.SetFieldValue<OfflineListInfo[]?>(Models.Metadata.Header.InfosKey, GetFieldValue<OfflineListInfo[]?>(Models.Metadata.Header.InfosKey)); // TODO: Perform a deep clone
|
||||
header.SetFieldValue<DepotInformation?>(DatHeader.InputDepotKey, GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Clone() as DepotInformation);
|
||||
header.SetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey, GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.Clone() as DepotInformation);
|
||||
header.SetFieldValue<bool?>(Models.Metadata.Header.LockBiosModeKey, GetFieldValue<bool?>(Models.Metadata.Header.LockBiosModeKey));
|
||||
header.SetFieldValue<bool?>(Models.Metadata.Header.LockRomModeKey, GetFieldValue<bool?>(Models.Metadata.Header.LockRomModeKey));
|
||||
header.SetFieldValue<bool?>(Models.Metadata.Header.LockSampleModeKey, GetFieldValue<bool?>(Models.Metadata.Header.LockSampleModeKey));
|
||||
@@ -248,14 +240,12 @@ namespace SabreTools.DatFiles
|
||||
/// </summary>
|
||||
public DatHeader CloneFiltering()
|
||||
{
|
||||
var header = new DatHeader()
|
||||
{
|
||||
InputDepot = this.InputDepot?.Clone() as DepotInformation,
|
||||
OutputDepot = this.OutputDepot?.Clone() as DepotInformation,
|
||||
};
|
||||
var header = new DatHeader();
|
||||
header.SetFieldValue<string?>(DatHeader.AddExtensionKey, GetFieldValue<string?>(DatHeader.AddExtensionKey));
|
||||
header.SetFieldValue<DatFormat>(DatHeader.DatFormatKey, GetFieldValue<DatFormat>(DatHeader.DatFormatKey));
|
||||
header.SetFieldValue<bool>(DatHeader.GameNameKey, GetFieldValue<bool>(DatHeader.GameNameKey));
|
||||
header.SetFieldValue<DepotInformation?>(DatHeader.InputDepotKey, GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Clone() as DepotInformation);
|
||||
header.SetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey, GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.Clone() as DepotInformation);
|
||||
header.SetFieldValue<string?>(DatHeader.PostfixKey, GetFieldValue<string?>(DatHeader.PostfixKey));
|
||||
header.SetFieldValue<string?>(DatHeader.PrefixKey, GetFieldValue<string?>(DatHeader.PrefixKey));
|
||||
header.SetFieldValue<bool>(DatHeader.RemoveExtensionKey, GetFieldValue<bool>(DatHeader.RemoveExtensionKey));
|
||||
@@ -341,8 +331,8 @@ namespace SabreTools.DatFiles
|
||||
if (!string.IsNullOrEmpty(datHeader.GetFieldValue<string?>(DatHeader.ReplaceExtensionKey)))
|
||||
SetFieldValue<string?>(DatHeader.ReplaceExtensionKey, datHeader.GetFieldValue<string?>(DatHeader.ReplaceExtensionKey));
|
||||
|
||||
InputDepot = datHeader.InputDepot?.Clone() as DepotInformation;
|
||||
OutputDepot = datHeader.OutputDepot?.Clone() as DepotInformation;
|
||||
SetFieldValue<DepotInformation?>(DatHeader.InputDepotKey, datHeader.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Clone() as DepotInformation);
|
||||
SetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey, datHeader.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.Clone() as DepotInformation);
|
||||
SetFieldValue<bool>(DatHeader.GameNameKey, datHeader.GetFieldValue<bool>(DatHeader.GameNameKey));
|
||||
SetFieldValue<bool>(DatHeader.QuotesKey, datHeader.GetFieldValue<bool>(DatHeader.QuotesKey));
|
||||
SetFieldValue<bool>(DatHeader.RemoveExtensionKey, datHeader.GetFieldValue<bool>(DatHeader.RemoveExtensionKey));
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
ProcessItemName(datItem, false, forceRomName: false);
|
||||
|
||||
// Romba mode automatically uses item name
|
||||
if (Header.OutputDepot?.IsActive == true || Header.GetFieldValue<bool>(DatHeader.UseRomNameKey))
|
||||
if (Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.IsActive == true || Header.GetFieldValue<bool>(DatHeader.UseRomNameKey))
|
||||
sw.Write($"{datItem.GetName() ?? string.Empty}\n");
|
||||
else if (!Header.GetFieldValue<bool>(DatHeader.UseRomNameKey) && datItem.GetFieldValue<Machine>(DatItem.MachineKey)!.GetFieldValue<string?>(Models.Metadata.Machine.NameKey) != lastgame)
|
||||
sw.Write($"{datItem.GetFieldValue<Machine>(DatItem.MachineKey)!.GetFieldValue<string?>(Models.Metadata.Machine.NameKey) ?? string.Empty}\n");
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace SabreTools.DatTools
|
||||
private static bool CheckDepotFile(DatFile datFile, string item)
|
||||
{
|
||||
// If we're not in Depot mode, return false
|
||||
if (datFile.Header.OutputDepot?.IsActive != true)
|
||||
if (datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.IsActive != true)
|
||||
return false;
|
||||
|
||||
// Check the file as if it were in a depot
|
||||
@@ -321,7 +321,7 @@ namespace SabreTools.DatTools
|
||||
private static void ProcessDirectoryBlanks(DatFile datFile, string? basePath)
|
||||
{
|
||||
// If we're in depot mode, we don't process blanks
|
||||
if (datFile.Header.OutputDepot?.IsActive == true)
|
||||
if (datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.IsActive == true)
|
||||
return;
|
||||
|
||||
List<string> empties = basePath.ListEmpty() ?? [];
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace SabreTools.DatTools
|
||||
logger.User($"Checking hash '{hash}'");
|
||||
|
||||
// Get the extension path for the hash
|
||||
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.InputDepot?.Depth ?? 0);
|
||||
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Depth ?? 0);
|
||||
if (subpath == null)
|
||||
continue;
|
||||
|
||||
@@ -590,7 +590,7 @@ namespace SabreTools.DatTools
|
||||
// Get the proper output path
|
||||
string sha1 = (datItem as Rom)!.GetFieldValue<string?>(Models.Metadata.Rom.SHA1Key) ?? string.Empty;
|
||||
if (outputFormat == OutputFormat.TorrentGzipRomba)
|
||||
outDir = Path.Combine(outDir, Utilities.GetDepotPath(sha1, datFile.Header.OutputDepot?.Depth ?? 0) ?? string.Empty);
|
||||
outDir = Path.Combine(outDir, Utilities.GetDepotPath(sha1, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.Depth ?? 0) ?? string.Empty);
|
||||
else
|
||||
outDir = Path.Combine(outDir, sha1 + ".gz");
|
||||
|
||||
@@ -636,7 +636,7 @@ namespace SabreTools.DatTools
|
||||
// Get the proper output path
|
||||
string sha1 = (datItem as Rom)!.GetFieldValue<string?>(Models.Metadata.Rom.SHA1Key) ?? string.Empty;
|
||||
if (outputFormat == OutputFormat.TorrentXZRomba)
|
||||
outDir = Path.Combine(outDir, Utilities.GetDepotPath(sha1, datFile.Header.OutputDepot?.Depth ?? 0) ?? string.Empty).Replace(".gz", ".xz");
|
||||
outDir = Path.Combine(outDir, Utilities.GetDepotPath(sha1, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.Depth ?? 0) ?? string.Empty).Replace(".gz", ".xz");
|
||||
else
|
||||
outDir = Path.Combine(outDir, sha1 + ".xz");
|
||||
|
||||
@@ -728,9 +728,9 @@ namespace SabreTools.DatTools
|
||||
|
||||
// Set the depth fields where appropriate
|
||||
if (outputArchive is GZipArchive gzipArchive)
|
||||
gzipArchive.Depth = datFile.Header.OutputDepot?.Depth ?? 0;
|
||||
gzipArchive.Depth = datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.Depth ?? 0;
|
||||
else if (outputArchive is XZArchive xzArchive)
|
||||
xzArchive.Depth = datFile.Header.OutputDepot?.Depth ?? 0;
|
||||
xzArchive.Depth = datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.Depth ?? 0;
|
||||
|
||||
return outputArchive;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace SabreTools.DatTools
|
||||
logger.User($"Checking hash '{hash}'");
|
||||
|
||||
// Get the extension path for the hash
|
||||
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.InputDepot?.Depth ?? 0);
|
||||
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Depth ?? 0);
|
||||
if (subpath == null)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -2149,17 +2149,16 @@ Some special strings that can be used:
|
||||
/// </summary>
|
||||
private DatHeader? GetDatHeader(Dictionary<string, Feature?> features)
|
||||
{
|
||||
// TODO: Sort this by region, like the actual header
|
||||
var datHeader = new DatHeader()
|
||||
{
|
||||
// Get the depot information
|
||||
InputDepot = new DepotInformation(
|
||||
// Get the depot information
|
||||
var inputDepot = new DepotInformation(
|
||||
GetBoolean(features, DepotValue),
|
||||
GetInt32(features, DepotDepthInt32Value)),
|
||||
OutputDepot = new DepotInformation(
|
||||
GetInt32(features, DepotDepthInt32Value));
|
||||
var outputDepot = new DepotInformation(
|
||||
GetBoolean(features, RombaValue),
|
||||
GetInt32(features, RombaDepthInt32Value))
|
||||
};
|
||||
GetInt32(features, RombaDepthInt32Value));
|
||||
|
||||
var datHeader = new DatHeader();
|
||||
datHeader.SetFieldValue<string?>(DatHeader.AddExtensionKey, GetString(features, AddExtensionStringValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.AuthorKey, GetString(features, AuthorStringValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.CategoryKey, GetString(features, CategoryStringValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.CommentKey, GetString(features, CommentStringValue));
|
||||
@@ -2170,22 +2169,22 @@ Some special strings that can be used:
|
||||
datHeader.SetFieldValue<MergingFlag>(Models.Metadata.Header.ForceMergingKey, GetString(features, ForceMergingStringValue).AsEnumValue<MergingFlag>());
|
||||
datHeader.SetFieldValue<NodumpFlag>(Models.Metadata.Header.ForceNodumpKey, GetString(features, ForceNodumpStringValue).AsEnumValue<NodumpFlag>());
|
||||
datHeader.SetFieldValue<PackingFlag>(Models.Metadata.Header.ForceNodumpKey, GetString(features, ForcePackingStringValue).AsEnumValue<PackingFlag>());
|
||||
datHeader.SetFieldValue<bool>(DatHeader.GameNameKey, GetBoolean(features, GamePrefixValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.HeaderKey, GetString(features, HeaderStringValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.HomepageKey, GetString(features, HomepageStringValue));
|
||||
datHeader.SetFieldValue<DepotInformation?>(DatHeader.InputDepotKey, inputDepot);
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.NameKey, GetString(features, NameStringValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.RootDirKey, GetString(features, RootStringValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.TypeKey, GetBoolean(features, SuperdatValue) ? "SuperDAT" : null);
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.UrlKey, GetString(features, UrlStringValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.VersionKey, GetString(features, VersionStringValue));
|
||||
|
||||
datHeader.SetFieldValue<string?>(DatHeader.AddExtensionKey, GetString(features, AddExtensionStringValue));
|
||||
datHeader.SetFieldValue<bool>(DatHeader.GameNameKey, GetBoolean(features, GamePrefixValue));
|
||||
datHeader.SetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey, outputDepot);
|
||||
datHeader.SetFieldValue<string?>(DatHeader.PostfixKey, GetString(features, PostfixStringValue));
|
||||
datHeader.SetFieldValue<string?>(DatHeader.PrefixKey, GetString(features, PrefixStringValue));
|
||||
datHeader.SetFieldValue<bool>(DatHeader.QuotesKey, GetBoolean(features, QuotesValue));
|
||||
datHeader.SetFieldValue<bool>(DatHeader.RemoveExtensionKey, GetBoolean(features, RemoveExtensionsValue));
|
||||
datHeader.SetFieldValue<string?>(DatHeader.ReplaceExtensionKey, GetString(features, ReplaceExtensionStringValue));
|
||||
datHeader.SetFieldValue<bool>(DatHeader.UseRomNameKey, GetBoolean(features, RomsValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.RootDirKey, GetString(features, RootStringValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.TypeKey, GetBoolean(features, SuperdatValue) ? "SuperDAT" : null);
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.UrlKey, GetString(features, UrlStringValue));
|
||||
datHeader.SetFieldValue<string?>(Models.Metadata.Header.VersionKey, GetString(features, VersionStringValue));
|
||||
|
||||
bool deprecated = GetBoolean(features, DeprecatedValue);
|
||||
foreach (string ot in GetList(features, OutputTypeListValue))
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace SabreTools.Features
|
||||
var outputFormat = GetOutputFormat(features);
|
||||
|
||||
// If we have the romba flag
|
||||
if (Header!.OutputDepot?.IsActive == true)
|
||||
if (Header!.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.IsActive == true)
|
||||
{
|
||||
// Update TorrentGzip output
|
||||
if (outputFormat == OutputFormat.TorrentGzip)
|
||||
@@ -98,8 +98,8 @@ namespace SabreTools.Features
|
||||
Parser.ParseInto(datdata, datfile, int.MaxValue, keep: true);
|
||||
|
||||
// Set depot information
|
||||
datdata.Header.InputDepot = Header.InputDepot?.Clone() as DepotInformation;
|
||||
datdata.Header.OutputDepot = Header.OutputDepot?.Clone() as DepotInformation;
|
||||
datdata.Header.SetFieldValue<DepotInformation?>(DatHeader.InputDepotKey, Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Clone() as DepotInformation);
|
||||
datdata.Header.SetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey, Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.Clone() as DepotInformation);
|
||||
|
||||
// If we have overridden the header skipper, set it now
|
||||
if (!string.IsNullOrEmpty(Header.GetFieldValue<string?>(Models.Metadata.Header.HeaderKey)))
|
||||
@@ -107,7 +107,7 @@ namespace SabreTools.Features
|
||||
|
||||
// If we have the depot flag, respect it
|
||||
bool success;
|
||||
if (Header.InputDepot?.IsActive ?? false)
|
||||
if (Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.IsActive ?? false)
|
||||
success = Rebuilder.RebuildDepot(datdata, Inputs, Path.Combine(OutputDir!, datdata.Header.GetFieldValue<string?>(DatHeader.FileNameKey)!), date, delete, inverse, outputFormat);
|
||||
else
|
||||
success = Rebuilder.RebuildGeneric(datdata, Inputs, Path.Combine(OutputDir!, datdata.Header.GetFieldValue<string?>(DatHeader.FileNameKey)!), quickScan, date, delete, inverse, outputFormat, asFiles);
|
||||
@@ -137,8 +137,8 @@ namespace SabreTools.Features
|
||||
}
|
||||
|
||||
// Set depot information
|
||||
datdata.Header.InputDepot = Header.InputDepot?.Clone() as DepotInformation;
|
||||
datdata.Header.OutputDepot = Header.OutputDepot?.Clone() as DepotInformation;
|
||||
datdata.Header.SetFieldValue<DepotInformation?>(DatHeader.InputDepotKey, Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Clone() as DepotInformation);
|
||||
datdata.Header.SetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey, Header.GetFieldValue<DepotInformation?>(DatHeader.OutputDepotKey)?.Clone() as DepotInformation);
|
||||
|
||||
// If we have overridden the header skipper, set it now
|
||||
if (!string.IsNullOrEmpty(Header.GetFieldValue<string?>(Models.Metadata.Header.HeaderKey)))
|
||||
@@ -148,7 +148,7 @@ namespace SabreTools.Features
|
||||
|
||||
// If we have the depot flag, respect it
|
||||
bool success;
|
||||
if (Header.InputDepot?.IsActive ?? false)
|
||||
if (Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.IsActive ?? false)
|
||||
success = Rebuilder.RebuildDepot(datdata, Inputs, OutputDir!, date, delete, inverse, outputFormat);
|
||||
else
|
||||
success = Rebuilder.RebuildGeneric(datdata, Inputs, OutputDir!, quickScan, date, delete, inverse, outputFormat, asFiles);
|
||||
|
||||
@@ -72,14 +72,14 @@ namespace SabreTools.Features
|
||||
Remover!.ApplyRemovals(datdata);
|
||||
|
||||
// Set depot information
|
||||
datdata.Header.InputDepot = Header!.InputDepot?.Clone() as DepotInformation;
|
||||
datdata.Header.SetFieldValue<DepotInformation?>(DatHeader.InputDepotKey, Header!.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Clone() as DepotInformation);
|
||||
|
||||
// If we have overridden the header skipper, set it now
|
||||
if (!string.IsNullOrEmpty(Header.GetFieldValue<string?>(Models.Metadata.Header.HeaderKey)))
|
||||
datdata.Header.SetFieldValue<string?>(Models.Metadata.Header.HeaderKey, Header.GetFieldValue<string?>(Models.Metadata.Header.HeaderKey));
|
||||
|
||||
// If we have the depot flag, respect it
|
||||
if (Header.InputDepot?.IsActive ?? false)
|
||||
if (Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.IsActive ?? false)
|
||||
{
|
||||
Verification.VerifyDepot(datdata, Inputs);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ namespace SabreTools.Features
|
||||
Remover!.ApplyRemovals(datdata);
|
||||
|
||||
// Set depot information
|
||||
datdata.Header.InputDepot = Header!.InputDepot?.Clone() as DepotInformation;
|
||||
datdata.Header.SetFieldValue<DepotInformation?>(DatHeader.InputDepotKey, Header!.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Clone() as DepotInformation);
|
||||
|
||||
// If we have overridden the header skipper, set it now
|
||||
if (!string.IsNullOrEmpty(Header.GetFieldValue<string?>(Models.Metadata.Header.HeaderKey)))
|
||||
@@ -129,7 +129,7 @@ namespace SabreTools.Features
|
||||
watch.Stop();
|
||||
|
||||
// If we have the depot flag, respect it
|
||||
if (Header.InputDepot?.IsActive ?? false)
|
||||
if (Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.IsActive ?? false)
|
||||
{
|
||||
Verification.VerifyDepot(datdata, Inputs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user