mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make Logger naming consistent
This commit is contained in:
@@ -47,7 +47,7 @@ namespace SabreTools.DatFiles
|
|||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore, XmlIgnore]
|
[JsonIgnore, XmlIgnore]
|
||||||
protected Logger logger;
|
protected Logger _logger;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ namespace SabreTools.DatFiles
|
|||||||
/// <param name="datFile">DatFile to get the values from</param>
|
/// <param name="datFile">DatFile to get the values from</param>
|
||||||
public DatFile(DatFile? datFile)
|
public DatFile(DatFile? datFile)
|
||||||
{
|
{
|
||||||
logger = new Logger(this);
|
_logger = new Logger(this);
|
||||||
if (datFile != null)
|
if (datFile != null)
|
||||||
{
|
{
|
||||||
Header = datFile.Header;
|
Header = datFile.Header;
|
||||||
@@ -656,7 +656,7 @@ namespace SabreTools.DatFiles
|
|||||||
if (rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) == null
|
if (rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) == null
|
||||||
&& rom.GetStringFieldValue(Models.Metadata.Rom.CRCKey) == "null")
|
&& rom.GetStringFieldValue(Models.Metadata.Rom.CRCKey) == "null")
|
||||||
{
|
{
|
||||||
logger.Verbose($"Empty folder found: {machine.GetStringFieldValue(Models.Metadata.Machine.NameKey)}");
|
_logger.Verbose($"Empty folder found: {machine.GetStringFieldValue(Models.Metadata.Machine.NameKey)}");
|
||||||
|
|
||||||
rom.SetName(rom.GetName() == "null" ? "-" : rom.GetName());
|
rom.SetName(rom.GetName() == "null" ? "-" : rom.GetName());
|
||||||
rom.SetFieldValue<string?>(Models.Metadata.Rom.SizeKey, Constants.SizeZero.ToString());
|
rom.SetFieldValue<string?>(Models.Metadata.Rom.SizeKey, Constants.SizeZero.ToString());
|
||||||
@@ -700,7 +700,7 @@ namespace SabreTools.DatFiles
|
|||||||
if (rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) == null
|
if (rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) == null
|
||||||
&& rom.GetStringFieldValue(Models.Metadata.Rom.CRCKey) == "null")
|
&& rom.GetStringFieldValue(Models.Metadata.Rom.CRCKey) == "null")
|
||||||
{
|
{
|
||||||
logger.Verbose($"Empty folder found: {machineObj.GetStringFieldValue(Models.Metadata.Machine.NameKey)}");
|
_logger.Verbose($"Empty folder found: {machineObj.GetStringFieldValue(Models.Metadata.Machine.NameKey)}");
|
||||||
|
|
||||||
rom.SetName(rom.GetName() == "null" ? "-" : rom.GetName());
|
rom.SetName(rom.GetName() == "null" ? "-" : rom.GetName());
|
||||||
rom.SetFieldValue<string?>(Models.Metadata.Rom.SizeKey, Constants.SizeZero.ToString());
|
rom.SetFieldValue<string?>(Models.Metadata.Rom.SizeKey, Constants.SizeZero.ToString());
|
||||||
@@ -828,14 +828,14 @@ namespace SabreTools.DatFiles
|
|||||||
if (datItem.GetDuplicateStatus(lastItem).HasFlag(DupeType.All))
|
if (datItem.GetDuplicateStatus(lastItem).HasFlag(DupeType.All))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
logger.Verbose($"Exact duplicate found for '{datItemName}'");
|
_logger.Verbose($"Exact duplicate found for '{datItemName}'");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the current name matches the previous name, rename the current item
|
// If the current name matches the previous name, rename the current item
|
||||||
else if (datItemName == lastItemName)
|
else if (datItemName == lastItemName)
|
||||||
{
|
{
|
||||||
logger.Verbose($"Name duplicate found for '{datItemName}'");
|
_logger.Verbose($"Name duplicate found for '{datItemName}'");
|
||||||
|
|
||||||
if (datItem is Disk || datItem is DatItems.Formats.File || datItem is Media || datItem is Rom)
|
if (datItem is Disk || datItem is DatItems.Formats.File || datItem is Media || datItem is Rom)
|
||||||
{
|
{
|
||||||
@@ -923,14 +923,14 @@ namespace SabreTools.DatFiles
|
|||||||
if (datItem.Value.GetDuplicateStatus(lastItem).HasFlag(DupeType.All))
|
if (datItem.Value.GetDuplicateStatus(lastItem).HasFlag(DupeType.All))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
logger.Verbose($"Exact duplicate found for '{datItemName}'");
|
_logger.Verbose($"Exact duplicate found for '{datItemName}'");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the current name matches the previous name, rename the current item
|
// If the current name matches the previous name, rename the current item
|
||||||
else if (datItemName == lastItemName)
|
else if (datItemName == lastItemName)
|
||||||
{
|
{
|
||||||
logger.Verbose($"Name duplicate found for '{datItemName}'");
|
_logger.Verbose($"Name duplicate found for '{datItemName}'");
|
||||||
|
|
||||||
if (datItem.Value is Disk || datItem.Value is DatItems.Formats.File || datItem.Value is Media || datItem.Value is Rom)
|
if (datItem.Value is Disk || datItem.Value is DatItems.Formats.File || datItem.Value is Media || datItem.Value is Rom)
|
||||||
{
|
{
|
||||||
@@ -984,7 +984,7 @@ namespace SabreTools.DatFiles
|
|||||||
// If this is invoked with a null DatItem, we ignore
|
// If this is invoked with a null DatItem, we ignore
|
||||||
if (datItem == null)
|
if (datItem == null)
|
||||||
{
|
{
|
||||||
logger?.Verbose($"Item was skipped because it was null");
|
_logger?.Verbose($"Item was skipped because it was null");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -992,7 +992,7 @@ namespace SabreTools.DatFiles
|
|||||||
if (datItem.GetBoolFieldValue(DatItem.RemoveKey) == true)
|
if (datItem.GetBoolFieldValue(DatItem.RemoveKey) == true)
|
||||||
{
|
{
|
||||||
string itemString = JsonConvert.SerializeObject(datItem, Formatting.None);
|
string itemString = JsonConvert.SerializeObject(datItem, Formatting.None);
|
||||||
logger?.Verbose($"Item '{itemString}' was skipped because it was marked for removal");
|
_logger?.Verbose($"Item '{itemString}' was skipped because it was marked for removal");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1000,7 +1000,7 @@ namespace SabreTools.DatFiles
|
|||||||
if (datItem is Blank)
|
if (datItem is Blank)
|
||||||
{
|
{
|
||||||
string itemString = JsonConvert.SerializeObject(datItem, Formatting.None);
|
string itemString = JsonConvert.SerializeObject(datItem, Formatting.None);
|
||||||
logger?.Verbose($"Item '{itemString}' was skipped because it was of type 'Blank'");
|
_logger?.Verbose($"Item '{itemString}' was skipped because it was of type 'Blank'");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1012,7 +1012,7 @@ namespace SabreTools.DatFiles
|
|||||||
if (size == 0 || size == null)
|
if (size == 0 || size == null)
|
||||||
{
|
{
|
||||||
string itemString = JsonConvert.SerializeObject(datItem, Formatting.None);
|
string itemString = JsonConvert.SerializeObject(datItem, Formatting.None);
|
||||||
logger?.Verbose($"Item '{itemString}' was skipped because it had an invalid size");
|
_logger?.Verbose($"Item '{itemString}' was skipped because it had an invalid size");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1023,7 +1023,7 @@ namespace SabreTools.DatFiles
|
|||||||
if (!Array.Exists(GetSupportedTypes(), t => t == itemType))
|
if (!Array.Exists(GetSupportedTypes(), t => t == itemType))
|
||||||
{
|
{
|
||||||
string itemString = JsonConvert.SerializeObject(datItem, Formatting.None);
|
string itemString = JsonConvert.SerializeObject(datItem, Formatting.None);
|
||||||
logger?.Verbose($"Item '{itemString}' was skipped because it was not supported in {datFormat}");
|
_logger?.Verbose($"Item '{itemString}' was skipped because it was not supported in {datFormat}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1033,9 +1033,9 @@ namespace SabreTools.DatFiles
|
|||||||
{
|
{
|
||||||
string itemString = JsonConvert.SerializeObject(datItem, Formatting.None);
|
string itemString = JsonConvert.SerializeObject(datItem, Formatting.None);
|
||||||
#if NET20 || NET35
|
#if NET20 || NET35
|
||||||
logger?.Verbose($"Item '{itemString}' was skipped because it was missing required fields for {datFormat}: {string.Join(", ", [.. missingFields])}");
|
_logger?.Verbose($"Item '{itemString}' was skipped because it was missing required fields for {datFormat}: {string.Join(", ", [.. missingFields])}");
|
||||||
#else
|
#else
|
||||||
logger?.Verbose($"Item '{itemString}' was skipped because it was missing required fields for {datFormat}: {string.Join(", ", missingFields)}");
|
_logger?.Verbose($"Item '{itemString}' was skipped because it was missing required fields for {datFormat}: {string.Join(", ", missingFields)}");
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace SabreTools.DatFiles
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -1426,7 +1426,7 @@ namespace SabreTools.DatFiles
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
var input = inputs[i];
|
var input = inputs[i];
|
||||||
logger.User($"Adding DAT: {input.CurrentPath}");
|
_staticLogger.User($"Adding DAT: {input.CurrentPath}");
|
||||||
datFiles[i] = DatFile.Create(datFile.Header.CloneFiltering());
|
datFiles[i] = DatFile.Create(datFile.Header.CloneFiltering());
|
||||||
Parser.ParseInto(datFiles[i], input, i, keep: true);
|
Parser.ParseInto(datFiles[i], input, i, keep: true);
|
||||||
#if NET40_OR_GREATER || NETCOREAPP
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
string message = $"'{filename}' - An error occurred during parsing";
|
string message = $"'{filename}' - An error occurred during parsing";
|
||||||
logger.Error(ex, message);
|
_logger.Error(ex, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,24 +174,24 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
|
|
||||||
// Serialize the input file
|
// Serialize the input file
|
||||||
var metadata = ConvertMetadata(ignoreblanks);
|
var metadata = ConvertMetadata(ignoreblanks);
|
||||||
var metadataFile = new Serialization.CrossModel.ClrMamePro().Deserialize(metadata);
|
var metadataFile = new Serialization.CrossModel.ClrMamePro().Deserialize(metadata);
|
||||||
if (!Serialization.Serializers.ClrMamePro.SerializeFile(metadataFile, outfile, _quotes))
|
if (!Serialization.Serializers.ClrMamePro.SerializeFile(metadataFile, outfile, _quotes))
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
_logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
string message = $"'{filename}' - An error occurred during parsing";
|
string message = $"'{filename}' - An error occurred during parsing";
|
||||||
logger.Error(ex, message);
|
_logger.Error(ex, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,24 +194,24 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
|
|
||||||
// Serialize the input file
|
// Serialize the input file
|
||||||
var metadata = ConvertMetadata(ignoreblanks);
|
var metadata = ConvertMetadata(ignoreblanks);
|
||||||
var hashfile = new Serialization.CrossModel.Hashfile().Deserialize(metadata, _hash);
|
var hashfile = new Serialization.CrossModel.Hashfile().Deserialize(metadata, _hash);
|
||||||
if (!(Serialization.Serializers.Hashfile.SerializeFile(hashfile, outfile, _hash)))
|
if (!(Serialization.Serializers.Hashfile.SerializeFile(hashfile, outfile, _hash)))
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
_logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
string message = $"'{filename}' - An error occurred during parsing";
|
string message = $"'{filename}' - An error occurred during parsing";
|
||||||
logger.Error(ex, message);
|
_logger.Error(ex, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
|
|
||||||
// Serialize the input file
|
// Serialize the input file
|
||||||
var metadata = ConvertMetadata(ignoreblanks);
|
var metadata = ConvertMetadata(ignoreblanks);
|
||||||
@@ -364,17 +364,17 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
_logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
FileStream fs = File.Create(outfile);
|
FileStream fs = File.Create(outfile);
|
||||||
|
|
||||||
// If we get back null for some reason, just log and return
|
// If we get back null for some reason, just log and return
|
||||||
if (fs == null)
|
if (fs == null)
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
_logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,13 +82,13 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
sw.Dispose();
|
sw.Dispose();
|
||||||
fs.Dispose();
|
fs.Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,13 +100,13 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
FileStream fs = File.Create(outfile);
|
FileStream fs = File.Create(outfile);
|
||||||
|
|
||||||
// If we get back null for some reason, just log and return
|
// If we get back null for some reason, just log and return
|
||||||
if (fs == null)
|
if (fs == null)
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
_logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,13 +146,13 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
sw.Dispose();
|
sw.Dispose();
|
||||||
fs.Dispose();
|
fs.Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
_logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||||
}
|
}
|
||||||
|
|
||||||
jtr.Close();
|
jtr.Close();
|
||||||
@@ -365,13 +365,13 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
FileStream fs = System.IO.File.Create(outfile);
|
FileStream fs = System.IO.File.Create(outfile);
|
||||||
|
|
||||||
// If we get back null for some reason, just log and return
|
// If we get back null for some reason, just log and return
|
||||||
if (fs == null)
|
if (fs == null)
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
_logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,13 +428,13 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
// Write the file footer out
|
// Write the file footer out
|
||||||
WriteFooter(jtw);
|
WriteFooter(jtw);
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
jtw.Close();
|
jtw.Close();
|
||||||
fs.Dispose();
|
fs.Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,13 +446,13 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
FileStream fs = System.IO.File.Create(outfile);
|
FileStream fs = System.IO.File.Create(outfile);
|
||||||
|
|
||||||
// If we get back null for some reason, just log and return
|
// If we get back null for some reason, just log and return
|
||||||
if (fs == null)
|
if (fs == null)
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
_logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,13 +509,13 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
// Write the file footer out
|
// Write the file footer out
|
||||||
WriteFooter(jtw);
|
WriteFooter(jtw);
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
jtw.Close();
|
jtw.Close();
|
||||||
fs.Dispose();
|
fs.Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Warning(ex, $"Exception found while parsing '{filename}'");
|
_logger.Warning(ex, $"Exception found while parsing '{filename}'");
|
||||||
|
|
||||||
// For XML errors, just skip the affected node
|
// For XML errors, just skip the affected node
|
||||||
xtr?.Read();
|
xtr?.Read();
|
||||||
@@ -194,13 +194,13 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
FileStream fs = File.Create(outfile);
|
FileStream fs = File.Create(outfile);
|
||||||
|
|
||||||
// If we get back null for some reason, just log and return
|
// If we get back null for some reason, just log and return
|
||||||
if (fs == null)
|
if (fs == null)
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
_logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
// Write the file footer out
|
// Write the file footer out
|
||||||
WriteFooter(xtw);
|
WriteFooter(xtw);
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
#if NET452_OR_GREATER
|
#if NET452_OR_GREATER
|
||||||
xtw.Dispose();
|
xtw.Dispose();
|
||||||
#endif
|
#endif
|
||||||
@@ -264,7 +264,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,13 +276,13 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
FileStream fs = File.Create(outfile);
|
FileStream fs = File.Create(outfile);
|
||||||
|
|
||||||
// If we get back null for some reason, just log and return
|
// If we get back null for some reason, just log and return
|
||||||
if (fs == null)
|
if (fs == null)
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
_logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
// Write the file footer out
|
// Write the file footer out
|
||||||
WriteFooter(xtw);
|
WriteFooter(xtw);
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
#if NET452_OR_GREATER
|
#if NET452_OR_GREATER
|
||||||
xtw.Dispose();
|
xtw.Dispose();
|
||||||
#endif
|
#endif
|
||||||
@@ -346,7 +346,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
string message = $"'{filename}' - An error occurred during parsing";
|
string message = $"'{filename}' - An error occurred during parsing";
|
||||||
logger.Error(ex, message);
|
_logger.Error(ex, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,24 +94,24 @@ namespace SabreTools.DatFiles.Formats
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
|
|
||||||
// Serialize the input file
|
// Serialize the input file
|
||||||
var metadata = ConvertMetadata(ignoreblanks);
|
var metadata = ConvertMetadata(ignoreblanks);
|
||||||
var metadataFile = new Serialization.CrossModel.SeparatedValue().Deserialize(metadata);
|
var metadataFile = new Serialization.CrossModel.SeparatedValue().Deserialize(metadata);
|
||||||
if (!(Serialization.Serializers.SeparatedValue.SerializeFile(metadataFile, outfile, _delim)))
|
if (!(Serialization.Serializers.SeparatedValue.SerializeFile(metadataFile, outfile, _delim)))
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
_logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace SabreTools.DatFiles
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Logger logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ namespace SabreTools.DatFiles
|
|||||||
{
|
{
|
||||||
bucketedBy = ItemKey.NULL;
|
bucketedBy = ItemKey.NULL;
|
||||||
mergedBy = DedupeType.None;
|
mergedBy = DedupeType.None;
|
||||||
logger = new Logger(this);
|
_logger = new Logger(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -196,7 +196,7 @@ namespace SabreTools.DatFiles
|
|||||||
&& string.IsNullOrEmpty(disk.GetStringFieldValue(Models.Metadata.Disk.MD5Key))
|
&& string.IsNullOrEmpty(disk.GetStringFieldValue(Models.Metadata.Disk.MD5Key))
|
||||||
&& string.IsNullOrEmpty(disk.GetStringFieldValue(Models.Metadata.Disk.SHA1Key)))
|
&& string.IsNullOrEmpty(disk.GetStringFieldValue(Models.Metadata.Disk.SHA1Key)))
|
||||||
{
|
{
|
||||||
logger.Verbose($"Incomplete entry for '{disk.GetName()}' will be output as nodump");
|
_logger.Verbose($"Incomplete entry for '{disk.GetName()}' will be output as nodump");
|
||||||
disk.SetFieldValue<string?>(Models.Metadata.Disk.StatusKey, ItemStatus.Nodump.AsStringValue());
|
disk.SetFieldValue<string?>(Models.Metadata.Disk.StatusKey, ItemStatus.Nodump.AsStringValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ namespace SabreTools.DatFiles
|
|||||||
&& string.IsNullOrEmpty(media.GetStringFieldValue(Models.Metadata.Media.SHA256Key))
|
&& string.IsNullOrEmpty(media.GetStringFieldValue(Models.Metadata.Media.SHA256Key))
|
||||||
&& string.IsNullOrEmpty(media.GetStringFieldValue(Models.Metadata.Media.SpamSumKey)))
|
&& string.IsNullOrEmpty(media.GetStringFieldValue(Models.Metadata.Media.SpamSumKey)))
|
||||||
{
|
{
|
||||||
logger.Verbose($"Incomplete entry for '{media.GetName()}' will be output as nodump");
|
_logger.Verbose($"Incomplete entry for '{media.GetName()}' will be output as nodump");
|
||||||
}
|
}
|
||||||
|
|
||||||
item = media;
|
item = media;
|
||||||
@@ -539,20 +539,20 @@ namespace SabreTools.DatFiles
|
|||||||
// If the sorted type isn't the same, we want to sort the dictionary accordingly
|
// If the sorted type isn't the same, we want to sort the dictionary accordingly
|
||||||
if (bucketedBy != bucketBy && bucketBy != ItemKey.NULL)
|
if (bucketedBy != bucketBy && bucketBy != ItemKey.NULL)
|
||||||
{
|
{
|
||||||
logger.User($"Organizing roms by {bucketBy}");
|
_logger.User($"Organizing roms by {bucketBy}");
|
||||||
PerformBucketing(bucketBy, lower, norename);
|
PerformBucketing(bucketBy, lower, norename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the merge type isn't the same, we want to merge the dictionary accordingly
|
// If the merge type isn't the same, we want to merge the dictionary accordingly
|
||||||
if (mergedBy != dedupeType)
|
if (mergedBy != dedupeType)
|
||||||
{
|
{
|
||||||
logger.User($"Deduping roms by {dedupeType}");
|
_logger.User($"Deduping roms by {dedupeType}");
|
||||||
PerformDeduplication(bucketBy, dedupeType);
|
PerformDeduplication(bucketBy, dedupeType);
|
||||||
}
|
}
|
||||||
// If the merge type is the same, we want to sort the dictionary to be consistent
|
// If the merge type is the same, we want to sort the dictionary to be consistent
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logger.User($"Sorting roms by {bucketBy}");
|
_logger.User($"Sorting roms by {bucketBy}");
|
||||||
PerformSorting();
|
PerformSorting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -879,7 +879,7 @@ namespace SabreTools.DatFiles
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Warning(ex.ToString());
|
_logger.Warning(ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ namespace SabreTools.DatFiles
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Logger logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ namespace SabreTools.DatFiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ItemDictionaryDB()
|
public ItemDictionaryDB()
|
||||||
{
|
{
|
||||||
logger = new Logger(this);
|
_logger = new Logger(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Accessors
|
#region Accessors
|
||||||
@@ -1237,7 +1237,7 @@ namespace SabreTools.DatFiles
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Warning(ex.ToString());
|
_logger.Warning(ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace SabreTools.DatFiles
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ namespace SabreTools.DatFiles
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex, $"Error with file '{currentPath}'");
|
_staticLogger.Error(ex, $"Error with file '{currentPath}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace SabreTools.DatFiles
|
|||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
string message = $"'{filename}' - An error occurred during parsing";
|
string message = $"'{filename}' - An error occurred during parsing";
|
||||||
logger.Error(ex, message);
|
_logger.Error(ex, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,24 +43,24 @@ namespace SabreTools.DatFiles
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
|
|
||||||
// Serialize the input file in two steps
|
// Serialize the input file in two steps
|
||||||
var internalFormat = ConvertMetadata(ignoreblanks);
|
var internalFormat = ConvertMetadata(ignoreblanks);
|
||||||
var specificFormat = Activator.CreateInstance<TModelSerializer>().Deserialize(internalFormat);
|
var specificFormat = Activator.CreateInstance<TModelSerializer>().Deserialize(internalFormat);
|
||||||
if (!Activator.CreateInstance<TFileSerializer>().Serialize(specificFormat, outfile))
|
if (!Activator.CreateInstance<TFileSerializer>().Serialize(specificFormat, outfile))
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
_logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,24 +69,24 @@ namespace SabreTools.DatFiles
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.User($"Writing to '{outfile}'...");
|
_logger.User($"Writing to '{outfile}'...");
|
||||||
|
|
||||||
// Serialize the input file in two steps
|
// Serialize the input file in two steps
|
||||||
var internalFormat = ConvertMetadataDB(ignoreblanks);
|
var internalFormat = ConvertMetadataDB(ignoreblanks);
|
||||||
var specificFormat = Activator.CreateInstance<TModelSerializer>().Deserialize(internalFormat);
|
var specificFormat = Activator.CreateInstance<TModelSerializer>().Deserialize(internalFormat);
|
||||||
if (!Activator.CreateInstance<TFileSerializer>().Serialize(specificFormat, outfile))
|
if (!Activator.CreateInstance<TFileSerializer>().Serialize(specificFormat, outfile))
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
_logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ namespace SabreTools.DatItems
|
|||||||
/// Static logger for static methods
|
/// Static logger for static methods
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore, XmlIgnore]
|
[JsonIgnore, XmlIgnore]
|
||||||
protected static readonly Logger staticLogger = new();
|
protected static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Logger logger = new();
|
private readonly Logger _logger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ namespace SabreTools.DatTools
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ namespace SabreTools.DatTools
|
|||||||
// Process the input
|
// Process the input
|
||||||
if (Directory.Exists(basePath))
|
if (Directory.Exists(basePath))
|
||||||
{
|
{
|
||||||
logger.Verbose($"Folder found: {basePath}");
|
_staticLogger.Verbose($"Folder found: {basePath}");
|
||||||
|
|
||||||
// Get a list of all files to process
|
// Get a list of all files to process
|
||||||
#if NET20 || NET35
|
#if NET20 || NET35
|
||||||
@@ -104,13 +104,13 @@ namespace SabreTools.DatTools
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Process the files in the main folder or any subfolder
|
// Process the files in the main folder or any subfolder
|
||||||
logger.User(totalSize, currentSize);
|
_staticLogger.User(totalSize, currentSize);
|
||||||
foreach (string item in files)
|
foreach (string item in files)
|
||||||
{
|
{
|
||||||
currentSize += new FileInfo(item).Length;
|
currentSize += new FileInfo(item).Length;
|
||||||
|
|
||||||
CheckFileForHashes(datFile, item, basePath, asFile);
|
CheckFileForHashes(datFile, item, basePath, asFile);
|
||||||
logger.User(totalSize, currentSize, item);
|
_staticLogger.User(totalSize, currentSize, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now find all folders that are empty, if we are supposed to
|
// Now find all folders that are empty, if we are supposed to
|
||||||
@@ -119,14 +119,14 @@ namespace SabreTools.DatTools
|
|||||||
}
|
}
|
||||||
else if (System.IO.File.Exists(basePath))
|
else if (System.IO.File.Exists(basePath))
|
||||||
{
|
{
|
||||||
logger.Verbose($"File found: {basePath}");
|
_staticLogger.Verbose($"File found: {basePath}");
|
||||||
|
|
||||||
totalSize = new FileInfo(basePath).Length;
|
totalSize = new FileInfo(basePath).Length;
|
||||||
logger.User(totalSize, currentSize);
|
_staticLogger.User(totalSize, currentSize);
|
||||||
|
|
||||||
string? parentPath = Path.GetDirectoryName(Path.GetDirectoryName(basePath));
|
string? parentPath = Path.GetDirectoryName(Path.GetDirectoryName(basePath));
|
||||||
CheckFileForHashes(datFile, basePath, parentPath, asFile);
|
CheckFileForHashes(datFile, basePath, parentPath, asFile);
|
||||||
logger.User(totalSize, totalSize, basePath);
|
_staticLogger.User(totalSize, totalSize, basePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
@@ -231,11 +231,11 @@ namespace SabreTools.DatTools
|
|||||||
// Add the list if it doesn't exist already
|
// Add the list if it doesn't exist already
|
||||||
Rom rom = baseFile.ConvertToRom();
|
Rom rom = baseFile.ConvertToRom();
|
||||||
datFile.Items.Add(rom.GetKey(ItemKey.CRC), rom);
|
datFile.Items.Add(rom.GetKey(ItemKey.CRC), rom);
|
||||||
logger.Verbose($"File added: {Path.GetFileNameWithoutExtension(item)}");
|
_staticLogger.Verbose($"File added: {Path.GetFileNameWithoutExtension(item)}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logger.Verbose($"File not added: {Path.GetFileNameWithoutExtension(item)}");
|
_staticLogger.Verbose($"File not added: {Path.GetFileNameWithoutExtension(item)}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ namespace SabreTools.DatTools
|
|||||||
gamename = gamename.Trim(Path.DirectorySeparatorChar);
|
gamename = gamename.Trim(Path.DirectorySeparatorChar);
|
||||||
romname = romname.Trim(Path.DirectorySeparatorChar);
|
romname = romname.Trim(Path.DirectorySeparatorChar);
|
||||||
|
|
||||||
logger.Verbose($"Adding blank empty folder: {gamename}");
|
_staticLogger.Verbose($"Adding blank empty folder: {gamename}");
|
||||||
|
|
||||||
var blankMachine = new Machine();
|
var blankMachine = new Machine();
|
||||||
blankMachine.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, gamename);
|
blankMachine.SetFieldValue<string?>(Models.Metadata.Machine.NameKey, gamename);
|
||||||
@@ -404,7 +404,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <param name="asFile">TreatAsFile representing CHD and Archive scanning</param>
|
/// <param name="asFile">TreatAsFile representing CHD and Archive scanning</param>
|
||||||
private void ProcessFile(DatFile datFile, string item, string? basePath, TreatAsFile asFile)
|
private void ProcessFile(DatFile datFile, string item, string? basePath, TreatAsFile asFile)
|
||||||
{
|
{
|
||||||
logger.Verbose($"'{Path.GetFileName(item)}' treated like a file");
|
_staticLogger.Verbose($"'{Path.GetFileName(item)}' treated like a file");
|
||||||
var header = datFile.Header.GetStringFieldValue(Models.Metadata.Header.HeaderKey);
|
var header = datFile.Header.GetStringFieldValue(Models.Metadata.Header.HeaderKey);
|
||||||
BaseFile? baseFile = FileTypeTool.GetInfo(item, _hashes, header);
|
BaseFile? baseFile = FileTypeTool.GetInfo(item, _hashes, header);
|
||||||
DatItem? datItem = DatItemTool.CreateDatItem(baseFile, asFile);
|
DatItem? datItem = DatItemTool.CreateDatItem(baseFile, asFile);
|
||||||
@@ -443,11 +443,11 @@ namespace SabreTools.DatTools
|
|||||||
string key = datItem.GetKey(ItemKey.CRC);
|
string key = datItem.GetKey(ItemKey.CRC);
|
||||||
datFile.Items.Add(key, datItem);
|
datFile.Items.Add(key, datItem);
|
||||||
|
|
||||||
logger.Verbose($"File added: {datItem.GetName() ?? string.Empty}");
|
_staticLogger.Verbose($"File added: {datItem.GetName() ?? string.Empty}");
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_staticLogger.Error(ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Logger logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ namespace SabreTools.DatTools
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ExtraIni()
|
public ExtraIni()
|
||||||
{
|
{
|
||||||
logger = new Logger(this);
|
_logger = new Logger(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -58,7 +58,7 @@ namespace SabreTools.DatTools
|
|||||||
// If we don't even have a possible field and file combination
|
// If we don't even have a possible field and file combination
|
||||||
if (!input.Contains(":"))
|
if (!input.Contains(":"))
|
||||||
{
|
{
|
||||||
logger.Warning($"'{input}` is not a valid INI extras string. Valid INI extras strings are of the form 'key:value'. Please refer to README.1ST or the help feature for more details.");
|
_logger.Warning($"'{input}` is not a valid INI extras string. Valid INI extras strings are of the form 'key:value'. Please refer to README.1ST or the help feature for more details.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ namespace SabreTools.DatTools
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -192,7 +192,7 @@ namespace SabreTools.DatTools
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ namespace SabreTools.DatTools
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_staticLogger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -99,7 +99,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <param name="datFile">Current DatFile object to run operations on</param>
|
/// <param name="datFile">Current DatFile object to run operations on</param>
|
||||||
internal static void CreateDeviceNonMergedSets(DatFile datFile)
|
internal static void CreateDeviceNonMergedSets(DatFile datFile)
|
||||||
{
|
{
|
||||||
logger.User("Creating device non-merged sets from the DAT");
|
_staticLogger.User("Creating device non-merged sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
@@ -122,7 +122,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <param name="datFile">Current DatFile object to run operations on</param>
|
/// <param name="datFile">Current DatFile object to run operations on</param>
|
||||||
internal static void CreateFullyMergedSets(DatFile datFile)
|
internal static void CreateFullyMergedSets(DatFile datFile)
|
||||||
{
|
{
|
||||||
logger.User("Creating fully merged sets from the DAT");
|
_staticLogger.User("Creating fully merged sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
@@ -149,7 +149,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <param name="datFile">Current DatFile object to run operations on</param>
|
/// <param name="datFile">Current DatFile object to run operations on</param>
|
||||||
internal static void CreateFullyNonMergedSets(DatFile datFile)
|
internal static void CreateFullyNonMergedSets(DatFile datFile)
|
||||||
{
|
{
|
||||||
logger.User("Creating fully non-merged sets from the DAT");
|
_staticLogger.User("Creating fully non-merged sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
@@ -178,7 +178,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <param name="datFile">Current DatFile object to run operations on</param>
|
/// <param name="datFile">Current DatFile object to run operations on</param>
|
||||||
internal static void CreateMergedSets(DatFile datFile)
|
internal static void CreateMergedSets(DatFile datFile)
|
||||||
{
|
{
|
||||||
logger.User("Creating merged sets from the DAT");
|
_staticLogger.User("Creating merged sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
@@ -205,7 +205,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <param name="datFile">Current DatFile object to run operations on</param>
|
/// <param name="datFile">Current DatFile object to run operations on</param>
|
||||||
internal static void CreateNonMergedSets(DatFile datFile)
|
internal static void CreateNonMergedSets(DatFile datFile)
|
||||||
{
|
{
|
||||||
logger.User("Creating non-merged sets from the DAT");
|
_staticLogger.User("Creating non-merged sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
@@ -232,7 +232,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <param name="datFile">Current DatFile object to run operations on</param>
|
/// <param name="datFile">Current DatFile object to run operations on</param>
|
||||||
internal static void CreateSplitSets(DatFile datFile)
|
internal static void CreateSplitSets(DatFile datFile)
|
||||||
{
|
{
|
||||||
logger.User("Creating split sets from the DAT");
|
_staticLogger.User("Creating split sets from the DAT");
|
||||||
|
|
||||||
// For sake of ease, the first thing we want to do is bucket by game
|
// For sake of ease, the first thing we want to do is bucket by game
|
||||||
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ namespace SabreTools.DatTools
|
|||||||
// If the DAT is not populated and inverse is not set, inform the user and quit
|
// If the DAT is not populated and inverse is not set, inform the user and quit
|
||||||
if (datFile.Items.DatStatistics.TotalCount == 0 && !inverse)
|
if (datFile.Items.DatStatistics.TotalCount == 0 && !inverse)
|
||||||
{
|
{
|
||||||
logger.User("No entries were found to rebuild, exiting...");
|
_staticLogger.User("No entries were found to rebuild, exiting...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ namespace SabreTools.DatTools
|
|||||||
// Add to the list if the input is a directory
|
// Add to the list if the input is a directory
|
||||||
if (Directory.Exists(input))
|
if (Directory.Exists(input))
|
||||||
{
|
{
|
||||||
logger.Verbose($"Adding depot: {input}");
|
_staticLogger.Verbose($"Adding depot: {input}");
|
||||||
lock (directories)
|
lock (directories)
|
||||||
{
|
{
|
||||||
directories.Add(input);
|
directories.Add(input);
|
||||||
@@ -116,7 +116,7 @@ namespace SabreTools.DatTools
|
|||||||
if (hash.Length != Constants.SHA1Length)
|
if (hash.Length != Constants.SHA1Length)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
logger.User($"Checking hash '{hash}'");
|
_staticLogger.User($"Checking hash '{hash}'");
|
||||||
|
|
||||||
// Get the extension path for the hash
|
// Get the extension path for the hash
|
||||||
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Depth ?? 0);
|
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Depth ?? 0);
|
||||||
@@ -206,7 +206,7 @@ namespace SabreTools.DatTools
|
|||||||
// If the DAT is not populated and inverse is not set, inform the user and quit
|
// If the DAT is not populated and inverse is not set, inform the user and quit
|
||||||
if (datFile.Items.DatStatistics.TotalCount == 0 && !inverse)
|
if (datFile.Items.DatStatistics.TotalCount == 0 && !inverse)
|
||||||
{
|
{
|
||||||
logger.User("No entries were found to rebuild, exiting...");
|
_staticLogger.User("No entries were found to rebuild, exiting...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ namespace SabreTools.DatTools
|
|||||||
// If the input is a file
|
// If the input is a file
|
||||||
if (System.IO.File.Exists(input))
|
if (System.IO.File.Exists(input))
|
||||||
{
|
{
|
||||||
logger.User($"Checking file: {input}");
|
_staticLogger.User($"Checking file: {input}");
|
||||||
bool rebuilt = RebuildGenericHelper(datFile, input, outDir, quickScan, date, inverse, outputFormat, asFile);
|
bool rebuilt = RebuildGenericHelper(datFile, input, outDir, quickScan, date, inverse, outputFormat, asFile);
|
||||||
|
|
||||||
// If we are supposed to delete the file, do so
|
// If we are supposed to delete the file, do so
|
||||||
@@ -249,14 +249,14 @@ namespace SabreTools.DatTools
|
|||||||
// If the input is a directory
|
// If the input is a directory
|
||||||
else if (Directory.Exists(input))
|
else if (Directory.Exists(input))
|
||||||
{
|
{
|
||||||
logger.Verbose($"Checking directory: {input}");
|
_staticLogger.Verbose($"Checking directory: {input}");
|
||||||
#if NET20 || NET35
|
#if NET20 || NET35
|
||||||
foreach (string file in Directory.GetFiles(input, "*"))
|
foreach (string file in Directory.GetFiles(input, "*"))
|
||||||
#else
|
#else
|
||||||
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
logger.User($"Checking file: {file}");
|
_staticLogger.User($"Checking file: {file}");
|
||||||
bool rebuilt = RebuildGenericHelper(datFile, file, outDir, quickScan, date, inverse, outputFormat, asFile);
|
bool rebuilt = RebuildGenericHelper(datFile, file, outDir, quickScan, date, inverse, outputFormat, asFile);
|
||||||
|
|
||||||
// If we are supposed to delete the file, do so
|
// If we are supposed to delete the file, do so
|
||||||
@@ -443,7 +443,7 @@ namespace SabreTools.DatTools
|
|||||||
fileStream.Seek(0, SeekOrigin.Begin);
|
fileStream.Seek(0, SeekOrigin.Begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.User($"{(inverse ? "No matches" : $"{dupes.Count} Matches")} found for '{Path.GetFileName(datItem.GetName() ?? datItem.GetStringFieldValue(Models.Metadata.DatItem.TypeKey).AsEnumValue<ItemType>().AsStringValue())}', rebuilding accordingly...");
|
_staticLogger.User($"{(inverse ? "No matches" : $"{dupes.Count} Matches")} found for '{Path.GetFileName(datItem.GetName() ?? datItem.GetStringFieldValue(Models.Metadata.DatItem.TypeKey).AsEnumValue<ItemType>().AsStringValue())}', rebuilding accordingly...");
|
||||||
rebuilt = true;
|
rebuilt = true;
|
||||||
|
|
||||||
// Special case for partial packing mode
|
// Special case for partial packing mode
|
||||||
@@ -506,7 +506,7 @@ namespace SabreTools.DatTools
|
|||||||
if (ShouldRebuild(datFile, headerless, transformStream, false, out dupes))
|
if (ShouldRebuild(datFile, headerless, transformStream, false, out dupes))
|
||||||
//if (ShouldRebuildDB(datFile, headerless, transformStream, false, out dupes))
|
//if (ShouldRebuildDB(datFile, headerless, transformStream, false, out dupes))
|
||||||
{
|
{
|
||||||
logger.User($"Headerless matches found for '{Path.GetFileName(datItem.GetName() ?? datItem.GetStringFieldValue(Models.Metadata.DatItem.TypeKey).AsEnumValue<ItemType>().AsStringValue())}', rebuilding accordingly...");
|
_staticLogger.User($"Headerless matches found for '{Path.GetFileName(datItem.GetName() ?? datItem.GetStringFieldValue(Models.Metadata.DatItem.TypeKey).AsEnumValue<ItemType>().AsStringValue())}', rebuilding accordingly...");
|
||||||
rebuilt = true;
|
rebuilt = true;
|
||||||
|
|
||||||
// Now loop through the list and rebuild accordingly
|
// Now loop through the list and rebuild accordingly
|
||||||
@@ -677,7 +677,7 @@ namespace SabreTools.DatTools
|
|||||||
BaseFile? tgzRom = tgz.GetTorrentGZFileInfo();
|
BaseFile? tgzRom = tgz.GetTorrentGZFileInfo();
|
||||||
if (isZip == false && tgzRom != null && (outputFormat == OutputFormat.TorrentGzip || outputFormat == OutputFormat.TorrentGzipRomba))
|
if (isZip == false && tgzRom != null && (outputFormat == OutputFormat.TorrentGzip || outputFormat == OutputFormat.TorrentGzipRomba))
|
||||||
{
|
{
|
||||||
logger.User($"Matches found for '{Path.GetFileName(datItem.GetName() ?? string.Empty)}', rebuilding accordingly...");
|
_staticLogger.User($"Matches found for '{Path.GetFileName(datItem.GetName() ?? string.Empty)}', rebuilding accordingly...");
|
||||||
|
|
||||||
// Get the proper output path
|
// Get the proper output path
|
||||||
string sha1 = (datItem as Rom)!.GetStringFieldValue(Models.Metadata.Rom.SHA1Key) ?? string.Empty;
|
string sha1 = (datItem as Rom)!.GetStringFieldValue(Models.Metadata.Rom.SHA1Key) ?? string.Empty;
|
||||||
@@ -723,7 +723,7 @@ namespace SabreTools.DatTools
|
|||||||
BaseFile? txzRom = txz.GetTorrentXZFileInfo();
|
BaseFile? txzRom = txz.GetTorrentXZFileInfo();
|
||||||
if (isZip == false && txzRom != null && (outputFormat == OutputFormat.TorrentXZ || outputFormat == OutputFormat.TorrentXZRomba))
|
if (isZip == false && txzRom != null && (outputFormat == OutputFormat.TorrentXZ || outputFormat == OutputFormat.TorrentXZRomba))
|
||||||
{
|
{
|
||||||
logger.User($"Matches found for '{Path.GetFileName(datItem.GetName() ?? string.Empty)}', rebuilding accordingly...");
|
_staticLogger.User($"Matches found for '{Path.GetFileName(datItem.GetName() ?? string.Empty)}', rebuilding accordingly...");
|
||||||
|
|
||||||
// Get the proper output path
|
// Get the proper output path
|
||||||
string sha1 = (datItem as Rom)!.GetStringFieldValue(Models.Metadata.Rom.SHA1Key) ?? string.Empty;
|
string sha1 = (datItem as Rom)!.GetStringFieldValue(Models.Metadata.Rom.SHA1Key) ?? string.Empty;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Logger logger;
|
protected Logger _logger;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ namespace SabreTools.DatTools
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Remover()
|
public Remover()
|
||||||
{
|
{
|
||||||
logger = new Logger(this);
|
_logger = new Logger(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -75,7 +75,7 @@ namespace SabreTools.DatTools
|
|||||||
{
|
{
|
||||||
bool removerSet = SetRemover(field);
|
bool removerSet = SetRemover(field);
|
||||||
if (!removerSet)
|
if (!removerSet)
|
||||||
logger.Warning($"The value {field} did not match any known field names. Please check the wiki for more details on supported field names.");
|
_logger.Warning($"The value {field} did not match any known field names. Please check the wiki for more details on supported field names.");
|
||||||
}
|
}
|
||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Logger logger = new();
|
private readonly Logger _logger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ namespace SabreTools.DatTools
|
|||||||
string value = values[i];
|
string value = values[i];
|
||||||
|
|
||||||
if (!SetSetter(field, value))
|
if (!SetSetter(field, value))
|
||||||
logger.Warning($"The value {value} did not match any known field names. Please check the wiki for more details on supported field names.");
|
_logger.Warning($"The value {value} did not match any known field names. Please check the wiki for more details on supported field names.");
|
||||||
}
|
}
|
||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
@@ -97,7 +97,7 @@ namespace SabreTools.DatTools
|
|||||||
string value = mapping.Value;
|
string value = mapping.Value;
|
||||||
|
|
||||||
if (!SetSetter(field, value))
|
if (!SetSetter(field, value))
|
||||||
logger.Warning($"The value {value} did not match any known field names. Please check the wiki for more details on supported field names.");
|
_logger.Warning($"The value {value} did not match any known field names. Please check the wiki for more details on supported field names.");
|
||||||
}
|
}
|
||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -784,7 +784,7 @@ namespace SabreTools.DatTools
|
|||||||
var items = datFile.Items[machine];
|
var items = datFile.Items[machine];
|
||||||
if (items == null || items.Count == 0)
|
if (items == null || items.Count == 0)
|
||||||
{
|
{
|
||||||
logger.Error($"{machine} contains no items and will be skipped");
|
_staticLogger.Error($"{machine} contains no items and will be skipped");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -797,7 +797,7 @@ namespace SabreTools.DatTools
|
|||||||
// TODO: Should there be more than just a log if a single item is larger than the chunksize?
|
// TODO: Should there be more than just a log if a single item is larger than the chunksize?
|
||||||
machineSize += rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) ?? 0;
|
machineSize += rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) ?? 0;
|
||||||
if ((rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) ?? 0) > chunkSize)
|
if ((rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) ?? 0) > chunkSize)
|
||||||
logger.Error($"{rom.GetName() ?? string.Empty} in {machine} is larger than {chunkSize}");
|
_staticLogger.Error($"{rom.GetName() ?? string.Empty} in {machine} is larger than {chunkSize}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -805,7 +805,7 @@ namespace SabreTools.DatTools
|
|||||||
// TODO: Should this eventually try to split the machine here?
|
// TODO: Should this eventually try to split the machine here?
|
||||||
if (machineSize > chunkSize)
|
if (machineSize > chunkSize)
|
||||||
{
|
{
|
||||||
logger.Error($"{machine} is larger than {chunkSize} and will be skipped");
|
_staticLogger.Error($"{machine} is larger than {chunkSize} and will be skipped");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ namespace SabreTools.DatTools
|
|||||||
// If there's no output format, set the default
|
// If there's no output format, set the default
|
||||||
if (statDatFormat == StatReportFormat.None)
|
if (statDatFormat == StatReportFormat.None)
|
||||||
{
|
{
|
||||||
logger.Verbose("No report format defined, defaulting to textfile");
|
_staticLogger.Verbose("No report format defined, defaulting to textfile");
|
||||||
statDatFormat = StatReportFormat.Textfile;
|
statDatFormat = StatReportFormat.Textfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ namespace SabreTools.DatTools
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex, $"Report '{outfile}' could not be written out");
|
_staticLogger.Error(ex, $"Report '{outfile}' could not be written out");
|
||||||
}
|
}
|
||||||
#if NET40_OR_GREATER || NETCOREAPP
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
});
|
});
|
||||||
@@ -189,7 +189,7 @@ namespace SabreTools.DatTools
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_staticLogger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ namespace SabreTools.DatTools
|
|||||||
// Add to the list if the input is a directory
|
// Add to the list if the input is a directory
|
||||||
if (Directory.Exists(input))
|
if (Directory.Exists(input))
|
||||||
{
|
{
|
||||||
logger.Verbose($"Adding depot: {input}");
|
_staticLogger.Verbose($"Adding depot: {input}");
|
||||||
directories.Add(input);
|
directories.Add(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ namespace SabreTools.DatTools
|
|||||||
if (hash.Length != Constants.SHA1Length)
|
if (hash.Length != Constants.SHA1Length)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
logger.User($"Checking hash '{hash}'");
|
_staticLogger.User($"Checking hash '{hash}'");
|
||||||
|
|
||||||
// Get the extension path for the hash
|
// Get the extension path for the hash
|
||||||
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Depth ?? 0);
|
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Depth ?? 0);
|
||||||
@@ -130,7 +130,7 @@ namespace SabreTools.DatTools
|
|||||||
// Add to the list if the input is a directory
|
// Add to the list if the input is a directory
|
||||||
if (Directory.Exists(input))
|
if (Directory.Exists(input))
|
||||||
{
|
{
|
||||||
logger.Verbose($"Adding depot: {input}");
|
_staticLogger.Verbose($"Adding depot: {input}");
|
||||||
directories.Add(input);
|
directories.Add(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ namespace SabreTools.DatTools
|
|||||||
if (hash.Length != Constants.SHA1Length)
|
if (hash.Length != Constants.SHA1Length)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
logger.User($"Checking hash '{hash}'");
|
_staticLogger.User($"Checking hash '{hash}'");
|
||||||
|
|
||||||
// Get the extension path for the hash
|
// Get the extension path for the hash
|
||||||
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Depth ?? 0);
|
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Depth ?? 0);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace SabreTools.DatTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ namespace SabreTools.DatTools
|
|||||||
// If we have nothing writable, abort
|
// If we have nothing writable, abort
|
||||||
if (!HasWritable(datFile))
|
if (!HasWritable(datFile))
|
||||||
{
|
{
|
||||||
logger.User("There were no items to write out!");
|
_staticLogger.User("There were no items to write out!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ namespace SabreTools.DatTools
|
|||||||
// If the DAT has no output format, default to XML
|
// If the DAT has no output format, default to XML
|
||||||
if (datFile.Header.GetFieldValue<DatFormat>(DatHeader.DatFormatKey) == 0)
|
if (datFile.Header.GetFieldValue<DatFormat>(DatHeader.DatFormatKey) == 0)
|
||||||
{
|
{
|
||||||
logger.Verbose("No DAT format defined, defaulting to XML");
|
_staticLogger.Verbose("No DAT format defined, defaulting to XML");
|
||||||
datFile.Header.SetFieldValue<DatFormat>(DatHeader.DatFormatKey, DatFormat.Logiqx);
|
datFile.Header.SetFieldValue<DatFormat>(DatHeader.DatFormatKey, DatFormat.Logiqx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ namespace SabreTools.DatTools
|
|||||||
datFile.ItemsDB.BucketBy(ItemKey.Machine, DedupeType.None);
|
datFile.ItemsDB.BucketBy(ItemKey.Machine, DedupeType.None);
|
||||||
|
|
||||||
// Output the number of items we're going to be writing
|
// Output the number of items we're going to be writing
|
||||||
logger.User($"A total of {datFile.Items.DatStatistics.TotalCount - datFile.Items.DatStatistics.RemovedCount} items will be written out to '{datFile.Header.GetStringFieldValue(DatHeader.FileNameKey)}'");
|
_staticLogger.User($"A total of {datFile.Items.DatStatistics.TotalCount - datFile.Items.DatStatistics.RemovedCount} items will be written out to '{datFile.Header.GetStringFieldValue(DatHeader.FileNameKey)}'");
|
||||||
//logger.User($"A total of {datFile.ItemsDB.DatStatistics.TotalCount - datFile.ItemsDB.DatStatistics.RemovedCount} items will be written out to '{datFile.Header.GetStringFieldValue(DatHeader.FileNameKey)}'");
|
//logger.User($"A total of {datFile.ItemsDB.DatStatistics.TotalCount - datFile.ItemsDB.DatStatistics.RemovedCount} items will be written out to '{datFile.Header.GetStringFieldValue(DatHeader.FileNameKey)}'");
|
||||||
|
|
||||||
// Get the outfile names
|
// Get the outfile names
|
||||||
@@ -94,7 +94,7 @@ namespace SabreTools.DatTools
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex, $"Datfile '{outfile}' could not be written out");
|
_staticLogger.Error(ex, $"Datfile '{outfile}' could not be written out");
|
||||||
}
|
}
|
||||||
#if NET40_OR_GREATER || NETCOREAPP
|
#if NET40_OR_GREATER || NETCOREAPP
|
||||||
});
|
});
|
||||||
@@ -104,7 +104,7 @@ namespace SabreTools.DatTools
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_staticLogger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace SabreTools.FileTypes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger _logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ namespace SabreTools.FileTypes
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex);
|
_staticLogger.Error(ex);
|
||||||
return new BaseFile();
|
return new BaseFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ namespace SabreTools.FileTypes
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex);
|
_staticLogger.Error(ex);
|
||||||
return new BaseFile();
|
return new BaseFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ namespace SabreTools.FileTypes
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex);
|
_staticLogger.Error(ex);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace SabreTools.Help
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Logger logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ namespace SabreTools.Help
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TopLevel()
|
public TopLevel()
|
||||||
{
|
{
|
||||||
logger = new Logger(this);
|
_logger = new Logger(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -72,7 +72,7 @@ namespace SabreTools.Help
|
|||||||
// Everything else isn't a file
|
// Everything else isn't a file
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logger.Error($"Invalid input detected: {args[i]}");
|
_logger.Error($"Invalid input detected: {args[i]}");
|
||||||
help.OutputIndividualFeature(Name);
|
help.OutputIndividualFeature(Name);
|
||||||
LoggerImpl.Close();
|
LoggerImpl.Close();
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace SabreTools.Reports
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly Logger logger = new();
|
protected readonly Logger _logger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace SabreTools.Reports.Formats
|
|||||||
FileStream fs = File.Create(outfile ?? string.Empty);
|
FileStream fs = File.Create(outfile ?? string.Empty);
|
||||||
if (fs == null)
|
if (fs == null)
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
_logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ namespace SabreTools.Reports.Formats
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace SabreTools.Reports.Formats
|
|||||||
FileStream fs = File.Create(outfile ?? string.Empty);
|
FileStream fs = File.Create(outfile ?? string.Empty);
|
||||||
if (fs == null)
|
if (fs == null)
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
_logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ namespace SabreTools.Reports.Formats
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace SabreTools.Reports.Formats
|
|||||||
Stream fs = _writeToConsole ? Console.OpenStandardOutput() : File.Create(outfile ?? string.Empty);
|
Stream fs = _writeToConsole ? Console.OpenStandardOutput() : File.Create(outfile ?? string.Empty);
|
||||||
if (fs == null)
|
if (fs == null)
|
||||||
{
|
{
|
||||||
logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
_logger.Warning($"File '{outfile}' could not be created for writing! Please check to see if the file is writable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ namespace SabreTools.Reports.Formats
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (!throwOnError)
|
catch (Exception ex) when (!throwOnError)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
_logger.Error(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace SabreTools.Features
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Logger logger = new();
|
protected Logger _logger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -2176,7 +2176,7 @@ Some special strings that can be used:
|
|||||||
DatFormat dftemp = GetDatFormat(ot);
|
DatFormat dftemp = GetDatFormat(ot);
|
||||||
if (dftemp == 0x00)
|
if (dftemp == 0x00)
|
||||||
{
|
{
|
||||||
logger.Error($"{ot} is not a recognized DAT format");
|
_logger.Error($"{ot} is not a recognized DAT format");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ Reset the internal state: reset();";
|
|||||||
// If the file doesn't exist, warn but continue
|
// If the file doesn't exist, warn but continue
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
{
|
{
|
||||||
logger.User($"{path} does not exist. Skipping...");
|
_logger.User($"{path} does not exist. Skipping...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +102,8 @@ Reset the internal state: reset();";
|
|||||||
var command = BatchCommand.Create(line);
|
var command = BatchCommand.Create(line);
|
||||||
if (command == null)
|
if (command == null)
|
||||||
{
|
{
|
||||||
logger.User($"Could not process {path} due to the following line: {line}");
|
_logger.User($"Could not process {path} due to the following line: {line}");
|
||||||
logger.User($"Please see the help text for more details about possible commands");
|
_logger.User($"Please see the help text for more details about possible commands");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,19 +111,19 @@ Reset the internal state: reset();";
|
|||||||
(bool valid, string? error) = command.ValidateArguments();
|
(bool valid, string? error) = command.ValidateArguments();
|
||||||
if (!valid)
|
if (!valid)
|
||||||
{
|
{
|
||||||
logger.User(error ?? string.Empty);
|
_logger.User(error ?? string.Empty);
|
||||||
logger.User($"Usage: {command.Usage()}");
|
_logger.User($"Usage: {command.Usage()}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now run the command
|
// Now run the command
|
||||||
logger.User($"Attempting to invoke {command.Name} with {(command.Arguments.Length == 0 ? "no arguments" : "the following argument(s): " + string.Join(", ", command.Arguments))}");
|
_logger.User($"Attempting to invoke {command.Name} with {(command.Arguments.Length == 0 ? "no arguments" : "the following argument(s): " + string.Join(", ", command.Arguments))}");
|
||||||
command.Process(batchState);
|
command.Process(batchState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.Error(ex, $"There was an exception processing {path}");
|
_logger.Error(ex, $"There was an exception processing {path}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace SabreTools.Features
|
|||||||
SplittingMode splittingMode = GetSplittingMode(features);
|
SplittingMode splittingMode = GetSplittingMode(features);
|
||||||
if (splittingMode == SplittingMode.None)
|
if (splittingMode == SplittingMode.None)
|
||||||
{
|
{
|
||||||
logger.Error("No valid splitting mode found!");
|
_logger.Error("No valid splitting mode found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ namespace SabreTools.Features
|
|||||||
if (splittingMode.HasFlag(SplittingMode.Level))
|
if (splittingMode.HasFlag(SplittingMode.Level))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
logger.Warning("This feature is not implemented: level-split");
|
_logger.Warning("This feature is not implemented: level-split");
|
||||||
DatTools.Splitter.SplitByLevel(
|
DatTools.Splitter.SplitByLevel(
|
||||||
internalDat,
|
internalDat,
|
||||||
OutputDir!,
|
OutputDir!,
|
||||||
@@ -164,7 +164,7 @@ namespace SabreTools.Features
|
|||||||
if (splittingMode.HasFlag(SplittingMode.TotalSize))
|
if (splittingMode.HasFlag(SplittingMode.TotalSize))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
logger.Warning("This feature is not implemented: level-split");
|
_logger.Warning("This feature is not implemented: level-split");
|
||||||
List<DatFile> sizedDats = DatTools.Splitter.SplitByTotalSize(internalDat, GetInt64(features, ChunkSizeInt64Value));
|
List<DatFile> sizedDats = DatTools.Splitter.SplitByTotalSize(internalDat, GetInt64(features, ChunkSizeInt64Value));
|
||||||
|
|
||||||
var watch = new InternalStopwatch("Outputting total-size-split DATs");
|
var watch = new InternalStopwatch("Outputting total-size-split DATs");
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ namespace SabreTools.Features
|
|||||||
{
|
{
|
||||||
// Create a new base DatFile
|
// Create a new base DatFile
|
||||||
DatFile datFile = DatFile.Create(Header);
|
DatFile datFile = DatFile.Create(Header);
|
||||||
logger.User($"Processing '{Path.GetFileName(inputPath.CurrentPath)}'");
|
_logger.User($"Processing '{Path.GetFileName(inputPath.CurrentPath)}'");
|
||||||
|
|
||||||
// Check the current format
|
// Check the current format
|
||||||
DatFormat currentFormat = datFile.Header.GetFieldValue<DatFormat>(DatHeader.DatFormatKey);
|
DatFormat currentFormat = datFile.Header.GetFieldValue<DatFormat>(DatHeader.DatFormatKey);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace SabreTools.Features
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Loop through and add the inputs to check against
|
// Loop through and add the inputs to check against
|
||||||
logger.User("Processing files:\n");
|
_logger.User("Processing files:\n");
|
||||||
foreach (string input in Inputs)
|
foreach (string input in Inputs)
|
||||||
{
|
{
|
||||||
dfd.PopulateFromDir(datdata, input, asFile);
|
dfd.PopulateFromDir(datdata, input, asFile);
|
||||||
@@ -144,7 +144,7 @@ namespace SabreTools.Features
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Loop through and add the inputs to check against
|
// Loop through and add the inputs to check against
|
||||||
logger.User("Processing files:\n");
|
_logger.User("Processing files:\n");
|
||||||
foreach (string input in Inputs)
|
foreach (string input in Inputs)
|
||||||
{
|
{
|
||||||
dfd.PopulateFromDir(datdata, input, asFile);
|
dfd.PopulateFromDir(datdata, input, asFile);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace SabreTools.Features
|
|||||||
if (!base.ProcessFeatures(features))
|
if (!base.ProcessFeatures(features))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
logger.User($"SabreTools version: {Globals.Version}");
|
_logger.User($"SabreTools version: {Globals.Version}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace SabreTools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging object
|
/// Logging object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Logger logger = new();
|
private static readonly Logger _staticLogger = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -74,12 +74,12 @@ namespace SabreTools
|
|||||||
// TODO: Re-evaluate feature flags with this change in mind
|
// TODO: Re-evaluate feature flags with this change in mind
|
||||||
featureName = featureName.TrimStart('-');
|
featureName = featureName.TrimStart('-');
|
||||||
if (args[0].StartsWith("-"))
|
if (args[0].StartsWith("-"))
|
||||||
logger.User($"Feature flags no longer require leading '-' characters");
|
_staticLogger.User($"Feature flags no longer require leading '-' characters");
|
||||||
|
|
||||||
// Verify that the flag is valid
|
// Verify that the flag is valid
|
||||||
if (!_help.TopLevelFlag(featureName))
|
if (!_help.TopLevelFlag(featureName))
|
||||||
{
|
{
|
||||||
logger.User($"'{featureName}' is not valid feature flag");
|
_staticLogger.User($"'{featureName}' is not valid feature flag");
|
||||||
_help.OutputIndividualFeature(featureName);
|
_help.OutputIndividualFeature(featureName);
|
||||||
LoggerImpl.Close();
|
LoggerImpl.Close();
|
||||||
return;
|
return;
|
||||||
@@ -154,7 +154,7 @@ namespace SabreTools
|
|||||||
// If the feature failed, output help
|
// If the feature failed, output help
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
logger.Error("An error occurred during processing!");
|
_staticLogger.Error("An error occurred during processing!");
|
||||||
_help.OutputIndividualFeature(featureName);
|
_help.OutputIndividualFeature(featureName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
if (inputs.Count == 0)
|
if (inputs.Count == 0)
|
||||||
{
|
{
|
||||||
logger.Error("This feature requires at least one input");
|
_staticLogger.Error("This feature requires at least one input");
|
||||||
_help?.OutputIndividualFeature(feature.Name);
|
_help?.OutputIndividualFeature(feature.Name);
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user