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:
@@ -45,7 +45,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
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
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
_logger.User($"Writing to '{outfile}'...");
|
||||
|
||||
// Serialize the input file
|
||||
var metadata = ConvertMetadata(ignoreblanks);
|
||||
var metadataFile = new Serialization.CrossModel.ClrMamePro().Deserialize(metadata);
|
||||
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;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
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
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
_logger.User($"Writing to '{outfile}'...");
|
||||
|
||||
// Serialize the input file
|
||||
var metadata = ConvertMetadata(ignoreblanks);
|
||||
var hashfile = new Serialization.CrossModel.Hashfile().Deserialize(metadata, _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;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
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
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
_logger.User($"Writing to '{outfile}'...");
|
||||
|
||||
// Serialize the input file
|
||||
var metadata = ConvertMetadata(ignoreblanks);
|
||||
@@ -364,17 +364,17 @@ namespace SabreTools.DatFiles.Formats
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
_logger.User($"Writing to '{outfile}'...");
|
||||
FileStream fs = File.Create(outfile);
|
||||
|
||||
// If we get back null for some reason, just log and return
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -82,13 +82,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
}
|
||||
}
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
sw.Dispose();
|
||||
fs.Dispose();
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -100,13 +100,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
_logger.User($"Writing to '{outfile}'...");
|
||||
FileStream fs = File.Create(outfile);
|
||||
|
||||
// If we get back null for some reason, just log and return
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -146,13 +146,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
}
|
||||
}
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
sw.Dispose();
|
||||
fs.Dispose();
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
_logger.Warning($"Exception found while parsing '{filename}': {ex}");
|
||||
}
|
||||
|
||||
jtr.Close();
|
||||
@@ -365,13 +365,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
_logger.User($"Writing to '{outfile}'...");
|
||||
FileStream fs = System.IO.File.Create(outfile);
|
||||
|
||||
// If we get back null for some reason, just log and return
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -428,13 +428,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
// Write the file footer out
|
||||
WriteFooter(jtw);
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
jtw.Close();
|
||||
fs.Dispose();
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -446,13 +446,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
_logger.User($"Writing to '{outfile}'...");
|
||||
FileStream fs = System.IO.File.Create(outfile);
|
||||
|
||||
// If we get back null for some reason, just log and return
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -509,13 +509,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
// Write the file footer out
|
||||
WriteFooter(jtw);
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
jtw.Close();
|
||||
fs.Dispose();
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
}
|
||||
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
|
||||
xtr?.Read();
|
||||
@@ -194,13 +194,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
_logger.User($"Writing to '{outfile}'...");
|
||||
FileStream fs = File.Create(outfile);
|
||||
|
||||
// If we get back null for some reason, just log and return
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
// Write the file footer out
|
||||
WriteFooter(xtw);
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
#if NET452_OR_GREATER
|
||||
xtw.Dispose();
|
||||
#endif
|
||||
@@ -264,7 +264,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -276,13 +276,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
_logger.User($"Writing to '{outfile}'...");
|
||||
FileStream fs = File.Create(outfile);
|
||||
|
||||
// If we get back null for some reason, just log and return
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
// Write the file footer out
|
||||
WriteFooter(xtw);
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
#if NET452_OR_GREATER
|
||||
xtw.Dispose();
|
||||
#endif
|
||||
@@ -346,7 +346,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
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
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
_logger.User($"Writing to '{outfile}'...");
|
||||
|
||||
// Serialize the input file
|
||||
var metadata = ConvertMetadata(ignoreblanks);
|
||||
var metadataFile = new Serialization.CrossModel.SeparatedValue().Deserialize(metadata);
|
||||
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;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
_logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
_logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user