mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add and implement Logger.Error
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,5 +116,15 @@ namespace SabreTools.Helper
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the given string as an error in the log
|
||||
/// </summary>
|
||||
/// <param name="output">String to be written log</param>
|
||||
/// <returns>True if the output could be written, false otherwise</returns>
|
||||
public bool Error(string output)
|
||||
{
|
||||
return Log("Error: " + output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user