[DatFile] Clean up logging a little

This commit is contained in:
Matt Nadareski
2017-03-14 23:31:39 -07:00
parent b71951ccd6
commit eee0f9e3fb
2 changed files with 6 additions and 15 deletions

View File

@@ -657,7 +657,6 @@ namespace SabreTools.Helper.Dats
// Otherwise, we say that we have a valid named file // Otherwise, we say that we have a valid named file
else else
{ {
Globals.Logger.Verbose("Adding unmatched file '" + datItem.Name + "'");
output.Add(datItem); output.Add(datItem);
lastItem = datItem; lastItem = datItem;
lastrenamed = null; lastrenamed = null;

View File

@@ -1332,7 +1332,7 @@ namespace SabreTools.Helper.Dats
int parentcount = parent.Count; int parentcount = parent.Count;
if (parentcount == 0) if (parentcount == 0)
{ {
Globals.Logger.Verbose("Empty parent: " + String.Join("\\", parent)); Globals.Logger.Verbose("Empty parent: " + String.Join("\\", parent) + " found in " + filename);
empty = true; empty = true;
} }
@@ -2091,14 +2091,10 @@ namespace SabreTools.Helper.Dats
} }
if (subreader.GetAttribute("flags") == "baddump" || subreader.GetAttribute("status") == "baddump") if (subreader.GetAttribute("flags") == "baddump" || subreader.GetAttribute("status") == "baddump")
{ {
Globals.Logger.Verbose("Bad dump detected: " +
(subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != "" ? "\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
its = ItemStatus.BadDump; its = ItemStatus.BadDump;
} }
if (subreader.GetAttribute("flags") == "nodump" || subreader.GetAttribute("status") == "nodump") if (subreader.GetAttribute("flags") == "nodump" || subreader.GetAttribute("status") == "nodump")
{ {
Globals.Logger.Verbose("Nodump detected: " +
(subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != "" ? "\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
its = ItemStatus.Nodump; its = ItemStatus.Nodump;
} }
if (subreader.GetAttribute("flags") == "verified" || subreader.GetAttribute("status") == "verified") if (subreader.GetAttribute("flags") == "verified" || subreader.GetAttribute("status") == "verified")
@@ -2284,13 +2280,9 @@ namespace SabreTools.Helper.Dats
its = ItemStatus.Good; its = ItemStatus.Good;
break; break;
case "baddump": case "baddump":
Globals.Logger.Verbose("Bad dump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != "" ?
"\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
its = ItemStatus.BadDump; its = ItemStatus.BadDump;
break; break;
case "nodump": case "nodump":
Globals.Logger.Verbose("Nodump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != "" ?
"\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
its = ItemStatus.Nodump; its = ItemStatus.Nodump;
break; break;
case "verified": case "verified":
@@ -2410,7 +2402,7 @@ namespace SabreTools.Helper.Dats
} }
catch (Exception ex) catch (Exception ex)
{ {
Globals.Logger.Warning(ex.ToString()); Globals.Logger.Warning("Exception found while parsing " + filename + ": " + ex.ToString());
// For XML errors, just skip the affected node // For XML errors, just skip the affected node
xtr?.Read(); xtr?.Read();
@@ -2962,14 +2954,14 @@ namespace SabreTools.Helper.Dats
// If there's no name in the rom, we log and skip it // If there's no name in the rom, we log and skip it
if (item.Name == null) if (item.Name == null)
{ {
Globals.Logger.Warning("Rom with no name found! Skipping..."); Globals.Logger.Warning(FileName + ": Rom with no name found! Skipping...");
return; return;
} }
// If the name ends with a directory separator, we log and skip it (DOSCenter only?) // If the name ends with a directory separator, we log and skip it (DOSCenter only?)
if (item.Name.EndsWith("/") || item.Name.EndsWith("\\")) if (item.Name.EndsWith("/") || item.Name.EndsWith("\\"))
{ {
Globals.Logger.Warning("Rom ending with directory separator found: '" + item.Name + "'. Skipping..."); Globals.Logger.Warning(FileName + ": Rom ending with directory separator found: '" + item.Name + "'. Skipping...");
return; return;
} }
@@ -3009,7 +3001,7 @@ namespace SabreTools.Helper.Dats
// If the file has no size and it's not the above case, skip and log // If the file has no size and it's not the above case, skip and log
else if (itemRom.ItemStatus != ItemStatus.Nodump && (itemRom.Size == 0 || itemRom.Size == -1)) else if (itemRom.ItemStatus != ItemStatus.Nodump && (itemRom.Size == 0 || itemRom.Size == -1))
{ {
Globals.Logger.Verbose("Incomplete entry for \"" + itemRom.Name + "\" will be output as nodump"); Globals.Logger.Verbose(FileName + ": Incomplete entry for \"" + itemRom.Name + "\" will be output as nodump");
itemRom.ItemStatus = ItemStatus.Nodump; itemRom.ItemStatus = ItemStatus.Nodump;
} }
// If the file has a size but aboslutely no hashes, skip and log // If the file has a size but aboslutely no hashes, skip and log
@@ -3022,7 +3014,7 @@ namespace SabreTools.Helper.Dats
&& String.IsNullOrEmpty(itemRom.SHA384) && String.IsNullOrEmpty(itemRom.SHA384)
&& String.IsNullOrEmpty(itemRom.SHA512)) && String.IsNullOrEmpty(itemRom.SHA512))
{ {
Globals.Logger.Verbose("Incomplete entry for \"" + itemRom.Name + "\" will be output as nodump"); Globals.Logger.Verbose(FileName + ": Incomplete entry for \"" + itemRom.Name + "\" will be output as nodump");
itemRom.ItemStatus = ItemStatus.Nodump; itemRom.ItemStatus = ItemStatus.Nodump;
} }