diff --git a/DATabase/Core/Generate.cs b/DATabase/Core/Generate.cs
index f0848988..82f66818 100644
--- a/DATabase/Core/Generate.cs
+++ b/DATabase/Core/Generate.cs
@@ -84,7 +84,7 @@ namespace SabreTools
// If there are no games for this combination, return nothing
if (!sldr.HasRows)
{
- _logger.Log("No system could be found with id in \"" + _systems + "\". Please check and try again.");
+ _logger.Error("No system could be found with id in \"" + _systems + "\". Please check and try again.");
return false;
}
@@ -128,7 +128,7 @@ namespace SabreTools
// If there are no games for this combination, return nothing
if (!sldr.HasRows)
{
- _logger.Log("No source could be found with id in \"" + _sources + "\". Please check and try again.");
+ _logger.Error("No source could be found with id in \"" + _sources + "\". Please check and try again.");
return false;
}
@@ -262,7 +262,7 @@ namespace SabreTools
}
catch (Exception ex)
{
- _logger.Log(ex.ToString());
+ _logger.Error(ex.ToString());
return false;
}
@@ -314,7 +314,7 @@ JOIN checksums
// If there are no games for this combination, return nothing
if (!sldr.HasRows)
{
- _logger.Log("No games could be found with those inputs. Please check and try again.");
+ _logger.Error("No games could be found with those inputs. Please check and try again.");
return null;
}
diff --git a/DATabase/Core/Import.cs b/DATabase/Core/Import.cs
index 5e6d7c17..7ef40682 100644
--- a/DATabase/Core/Import.cs
+++ b/DATabase/Core/Import.cs
@@ -146,7 +146,7 @@ namespace SabreTools
// If the type is still unmatched, the data can't be imported yet
else
{
- _logger.Log("File " + filename + " cannot be imported at this time because it is not a known pattern.\nPlease try again with an unrenamed version.");
+ _logger.Error("File " + filename + " cannot be imported at this time because it is not a known pattern.\nPlease try again with an unrenamed version.");
return false;
}
@@ -162,7 +162,7 @@ namespace SabreTools
case DatType.MAME:
if (!Remapping.MAME.ContainsKey(fileinfo[1].Value))
{
- _logger.Log("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
+ _logger.Error("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false;
}
GroupCollection mameInfo = Regex.Match(Remapping.MAME[fileinfo[1].Value], _remappedPattern).Groups;
@@ -175,7 +175,7 @@ namespace SabreTools
case DatType.NoIntro:
if (!Remapping.NoIntro.ContainsKey(fileinfo[1].Value))
{
- _logger.Log("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
+ _logger.Error("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false;
}
GroupCollection nointroInfo = Regex.Match(Remapping.NoIntro[fileinfo[1].Value], _remappedPattern).Groups;
@@ -191,7 +191,7 @@ namespace SabreTools
case DatType.Redump:
if (!Remapping.Redump.ContainsKey(fileinfo[1].Value))
{
- _logger.Log("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
+ _logger.Error("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false;
}
GroupCollection redumpInfo = Regex.Match(Remapping.Redump[fileinfo[1].Value], _remappedPattern).Groups;
@@ -212,7 +212,7 @@ namespace SabreTools
if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value))
{
- _logger.Log("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
+ _logger.Error("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false;
}
}
@@ -228,7 +228,7 @@ namespace SabreTools
case DatType.TruRip:
if (!Remapping.TruRip.ContainsKey(fileinfo[1].Value))
{
- _logger.Log("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
+ _logger.Error("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false;
}
GroupCollection truripInfo = Regex.Match(Remapping.TruRip[fileinfo[1].Value], _remappedPattern).Groups;
@@ -264,7 +264,7 @@ namespace SabreTools
// If nothing is found, tell the user and exit
if (!sldr.HasRows)
{
- _logger.Log("Error: No suitable system for '" + filename + "' found! Please add the system and then try again.");
+ _logger.Error("Error: No suitable system for '" + filename + "' found! Please add the system and then try again.");
return false;
}
@@ -288,7 +288,7 @@ namespace SabreTools
// If nothing is found, tell the user and exit
if (!sldr.HasRows)
{
- _logger.Log("Error: No suitable source for '" + filename + "' found! Please add the source and then try again.");
+ _logger.Error("Error: No suitable source for '" + filename + "' found! Please add the source and then try again.");
return false;
}
@@ -562,14 +562,14 @@ INSERT INTO files (setid, name, type, lastupdated)
// If the insert of the checksums failed, that's bad
if (affected < 1)
{
- _logger.Log("There was an error adding checksums for " + name + " to the database!");
+ _logger.Error("There was an error adding checksums for " + name + " to the database!");
return false;
}
}
// Otherwise, something happened which is bad
else
{
- _logger.Log("There was an error adding " + name + " to the database!");
+ _logger.Error("There was an error adding " + name + " to the database!");
return false;
}
}
diff --git a/DATabase/DATabase.cs b/DATabase/DATabase.cs
index dfcf86c4..ac223818 100644
--- a/DATabase/DATabase.cs
+++ b/DATabase/DATabase.cs
@@ -372,7 +372,7 @@ or 'b' to go back to the previous menu:");
}
else
{
- logger.Log("I'm sorry but " + filename + "doesn't exist!");
+ logger.Error("I'm sorry but " + filename + "doesn't exist!");
}
return;
}
@@ -510,7 +510,7 @@ Make a selection:
// If nothing is found, tell the user and exit
if (!sldr.HasRows)
{
- logger.Log("Error: No systems found! Please add a source and then try again.");
+ logger.Error("Error: No systems found! Please add a source and then try again.");
return;
}
@@ -535,7 +535,7 @@ Make a selection:
// If nothing is found, tell the user and exit
if (!ssldr.HasRows)
{
- logger.Log("Error: No sources found! Please add a source and then try again.");
+ logger.Error("Error: No sources found! Please add a source and then try again.");
return;
}
@@ -563,7 +563,7 @@ Make a selection:
// If nothing is found, tell the user and exit
if (!sldr.HasRows)
{
- logger.Log("Error: No systems found! Please add a source and then try again.");
+ logger.Error("Error: No systems found! Please add a source and then try again.");
return;
}
@@ -781,7 +781,7 @@ Make a selection:
}
else
{
- logger.Log("Source " + name + " could not be added!");
+ logger.Error("Source " + name + " could not be added!");
}
}
@@ -800,12 +800,12 @@ Make a selection:
}
else
{
- logger.Log("Source with id '" + srcid + "' could not be removed.");
+ logger.Error("Source with id '" + srcid + "' could not be removed.");
}
}
else
{
- logger.Log("Invalid input");
+ logger.Error("Invalid input");
}
}
@@ -822,7 +822,7 @@ Make a selection:
}
else
{
- logger.Log("System " + manufacturer + " - " + system + " could not be added!");
+ logger.Error("System " + manufacturer + " - " + system + " could not be added!");
}
}
@@ -841,12 +841,12 @@ Make a selection:
}
else
{
- logger.Log("System with id '" + sysid + "' could not be removed.");
+ logger.Error("System with id '" + sysid + "' could not be removed.");
}
}
else
{
- logger.Log("Invalid input");
+ logger.Error("Invalid input");
}
}
}
diff --git a/DATabase/Helper/Logger.cs b/DATabase/Helper/Logger.cs
index 153cb159..1f53e7d3 100644
--- a/DATabase/Helper/Logger.cs
+++ b/DATabase/Helper/Logger.cs
@@ -116,5 +116,15 @@ namespace SabreTools.Helper
return true;
}
+
+ ///
+ /// Writes the given string as an error in the log
+ ///
+ /// String to be written log
+ /// True if the output could be written, false otherwise
+ public bool Error(string output)
+ {
+ return Log("Error: " + output);
+ }
}
}