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:
@@ -82,7 +82,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
private readonly Logger logger = new();
|
||||
private readonly Logger _logger = new();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace SabreTools.DatTools
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
private static readonly Logger logger = new();
|
||||
private static readonly Logger _staticLogger = new();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace SabreTools.DatTools
|
||||
// Process the input
|
||||
if (Directory.Exists(basePath))
|
||||
{
|
||||
logger.Verbose($"Folder found: {basePath}");
|
||||
_staticLogger.Verbose($"Folder found: {basePath}");
|
||||
|
||||
// Get a list of all files to process
|
||||
#if NET20 || NET35
|
||||
@@ -104,13 +104,13 @@ namespace SabreTools.DatTools
|
||||
#endif
|
||||
|
||||
// Process the files in the main folder or any subfolder
|
||||
logger.User(totalSize, currentSize);
|
||||
_staticLogger.User(totalSize, currentSize);
|
||||
foreach (string item in files)
|
||||
{
|
||||
currentSize += new FileInfo(item).Length;
|
||||
|
||||
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
|
||||
@@ -119,14 +119,14 @@ namespace SabreTools.DatTools
|
||||
}
|
||||
else if (System.IO.File.Exists(basePath))
|
||||
{
|
||||
logger.Verbose($"File found: {basePath}");
|
||||
_staticLogger.Verbose($"File found: {basePath}");
|
||||
|
||||
totalSize = new FileInfo(basePath).Length;
|
||||
logger.User(totalSize, currentSize);
|
||||
_staticLogger.User(totalSize, currentSize);
|
||||
|
||||
string? parentPath = Path.GetDirectoryName(Path.GetDirectoryName(basePath));
|
||||
CheckFileForHashes(datFile, basePath, parentPath, asFile);
|
||||
logger.User(totalSize, totalSize, basePath);
|
||||
_staticLogger.User(totalSize, totalSize, basePath);
|
||||
}
|
||||
|
||||
watch.Stop();
|
||||
@@ -231,11 +231,11 @@ namespace SabreTools.DatTools
|
||||
// Add the list if it doesn't exist already
|
||||
Rom rom = baseFile.ConvertToRom();
|
||||
datFile.Items.Add(rom.GetKey(ItemKey.CRC), rom);
|
||||
logger.Verbose($"File added: {Path.GetFileNameWithoutExtension(item)}");
|
||||
_staticLogger.Verbose($"File added: {Path.GetFileNameWithoutExtension(item)}");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Verbose($"File not added: {Path.GetFileNameWithoutExtension(item)}");
|
||||
_staticLogger.Verbose($"File not added: {Path.GetFileNameWithoutExtension(item)}");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ namespace SabreTools.DatTools
|
||||
gamename = gamename.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();
|
||||
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>
|
||||
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);
|
||||
BaseFile? baseFile = FileTypeTool.GetInfo(item, _hashes, header);
|
||||
DatItem? datItem = DatItemTool.CreateDatItem(baseFile, asFile);
|
||||
@@ -443,11 +443,11 @@ namespace SabreTools.DatTools
|
||||
string key = datItem.GetKey(ItemKey.CRC);
|
||||
datFile.Items.Add(key, datItem);
|
||||
|
||||
logger.Verbose($"File added: {datItem.GetName() ?? string.Empty}");
|
||||
_staticLogger.Verbose($"File added: {datItem.GetName() ?? string.Empty}");
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_staticLogger.Error(ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
private readonly Logger logger;
|
||||
private readonly Logger _logger;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace SabreTools.DatTools
|
||||
/// </summary>
|
||||
public ExtraIni()
|
||||
{
|
||||
logger = new Logger(this);
|
||||
_logger = new Logger(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -58,7 +58,7 @@ namespace SabreTools.DatTools
|
||||
// If we don't even have a possible field and file combination
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace SabreTools.DatTools
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
@@ -192,7 +192,7 @@ namespace SabreTools.DatTools
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
private static readonly Logger logger = new();
|
||||
private static readonly Logger _staticLogger = new();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace SabreTools.DatTools
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_staticLogger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
@@ -99,7 +99,7 @@ namespace SabreTools.DatTools
|
||||
/// <param name="datFile">Current DatFile object to run operations on</param>
|
||||
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
|
||||
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>
|
||||
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
|
||||
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>
|
||||
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
|
||||
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>
|
||||
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
|
||||
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>
|
||||
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
|
||||
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>
|
||||
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
|
||||
datFile.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
private static readonly Logger logger = new();
|
||||
private static readonly Logger _staticLogger = new();
|
||||
|
||||
#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 (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;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace SabreTools.DatTools
|
||||
// Add to the list if the input is a directory
|
||||
if (Directory.Exists(input))
|
||||
{
|
||||
logger.Verbose($"Adding depot: {input}");
|
||||
_staticLogger.Verbose($"Adding depot: {input}");
|
||||
lock (directories)
|
||||
{
|
||||
directories.Add(input);
|
||||
@@ -116,7 +116,7 @@ namespace SabreTools.DatTools
|
||||
if (hash.Length != Constants.SHA1Length)
|
||||
continue;
|
||||
|
||||
logger.User($"Checking hash '{hash}'");
|
||||
_staticLogger.User($"Checking hash '{hash}'");
|
||||
|
||||
// Get the extension path for the hash
|
||||
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 (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;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace SabreTools.DatTools
|
||||
// If the input is a file
|
||||
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);
|
||||
|
||||
// If we are supposed to delete the file, do so
|
||||
@@ -249,14 +249,14 @@ namespace SabreTools.DatTools
|
||||
// If the input is a directory
|
||||
else if (Directory.Exists(input))
|
||||
{
|
||||
logger.Verbose($"Checking directory: {input}");
|
||||
_staticLogger.Verbose($"Checking directory: {input}");
|
||||
#if NET20 || NET35
|
||||
foreach (string file in Directory.GetFiles(input, "*"))
|
||||
#else
|
||||
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
||||
#endif
|
||||
{
|
||||
logger.User($"Checking file: {file}");
|
||||
_staticLogger.User($"Checking file: {file}");
|
||||
bool rebuilt = RebuildGenericHelper(datFile, file, outDir, quickScan, date, inverse, outputFormat, asFile);
|
||||
|
||||
// If we are supposed to delete the file, do so
|
||||
@@ -443,7 +443,7 @@ namespace SabreTools.DatTools
|
||||
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;
|
||||
|
||||
// Special case for partial packing mode
|
||||
@@ -506,7 +506,7 @@ namespace SabreTools.DatTools
|
||||
if (ShouldRebuild(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;
|
||||
|
||||
// Now loop through the list and rebuild accordingly
|
||||
@@ -677,7 +677,7 @@ namespace SabreTools.DatTools
|
||||
BaseFile? tgzRom = tgz.GetTorrentGZFileInfo();
|
||||
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
|
||||
string sha1 = (datItem as Rom)!.GetStringFieldValue(Models.Metadata.Rom.SHA1Key) ?? string.Empty;
|
||||
@@ -723,7 +723,7 @@ namespace SabreTools.DatTools
|
||||
BaseFile? txzRom = txz.GetTorrentXZFileInfo();
|
||||
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
|
||||
string sha1 = (datItem as Rom)!.GetStringFieldValue(Models.Metadata.Rom.SHA1Key) ?? string.Empty;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
protected Logger logger;
|
||||
protected Logger _logger;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace SabreTools.DatTools
|
||||
/// </summary>
|
||||
public Remover()
|
||||
{
|
||||
logger = new Logger(this);
|
||||
_logger = new Logger(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -75,7 +75,7 @@ namespace SabreTools.DatTools
|
||||
{
|
||||
bool removerSet = SetRemover(field);
|
||||
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();
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
private readonly Logger logger = new();
|
||||
private readonly Logger _logger = new();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace SabreTools.DatTools
|
||||
string value = values[i];
|
||||
|
||||
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();
|
||||
@@ -97,7 +97,7 @@ namespace SabreTools.DatTools
|
||||
string value = mapping.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();
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
private static readonly Logger logger = new();
|
||||
private static readonly Logger _staticLogger = new();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -784,7 +784,7 @@ namespace SabreTools.DatTools
|
||||
var items = datFile.Items[machine];
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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?
|
||||
machineSize += rom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) ?? 0;
|
||||
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?
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
private static readonly Logger logger = new();
|
||||
private static readonly Logger _staticLogger = new();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace SabreTools.DatTools
|
||||
// If there's no output format, set the default
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace SabreTools.DatTools
|
||||
}
|
||||
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
|
||||
});
|
||||
@@ -189,7 +189,7 @@ namespace SabreTools.DatTools
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_staticLogger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
private static readonly Logger logger = new();
|
||||
private static readonly Logger _staticLogger = new();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace SabreTools.DatTools
|
||||
// Add to the list if the input is a directory
|
||||
if (Directory.Exists(input))
|
||||
{
|
||||
logger.Verbose($"Adding depot: {input}");
|
||||
_staticLogger.Verbose($"Adding depot: {input}");
|
||||
directories.Add(input);
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace SabreTools.DatTools
|
||||
if (hash.Length != Constants.SHA1Length)
|
||||
continue;
|
||||
|
||||
logger.User($"Checking hash '{hash}'");
|
||||
_staticLogger.User($"Checking hash '{hash}'");
|
||||
|
||||
// Get the extension path for the hash
|
||||
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
|
||||
if (Directory.Exists(input))
|
||||
{
|
||||
logger.Verbose($"Adding depot: {input}");
|
||||
_staticLogger.Verbose($"Adding depot: {input}");
|
||||
directories.Add(input);
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ namespace SabreTools.DatTools
|
||||
if (hash.Length != Constants.SHA1Length)
|
||||
continue;
|
||||
|
||||
logger.User($"Checking hash '{hash}'");
|
||||
_staticLogger.User($"Checking hash '{hash}'");
|
||||
|
||||
// Get the extension path for the hash
|
||||
string? subpath = Utilities.GetDepotPath(hash, datFile.Header.GetFieldValue<DepotInformation?>(DatHeader.InputDepotKey)?.Depth ?? 0);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace SabreTools.DatTools
|
||||
/// <summary>
|
||||
/// Logging object
|
||||
/// </summary>
|
||||
private static readonly Logger logger = new();
|
||||
private static readonly Logger _staticLogger = new();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace SabreTools.DatTools
|
||||
// If we have nothing writable, abort
|
||||
if (!HasWritable(datFile))
|
||||
{
|
||||
logger.User("There were no items to write out!");
|
||||
_staticLogger.User("There were no items to write out!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace SabreTools.DatTools
|
||||
// If the DAT has no output format, default to XML
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace SabreTools.DatTools
|
||||
datFile.ItemsDB.BucketBy(ItemKey.Machine, DedupeType.None);
|
||||
|
||||
// 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)}'");
|
||||
|
||||
// Get the outfile names
|
||||
@@ -94,7 +94,7 @@ namespace SabreTools.DatTools
|
||||
}
|
||||
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
|
||||
});
|
||||
@@ -104,7 +104,7 @@ namespace SabreTools.DatTools
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_staticLogger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in New Issue
Block a user