Improve logging and Nodump handling

This commit is contained in:
Matt Nadareski
2016-05-18 16:37:39 -07:00
parent 3ee1753b21
commit b08433cd52
3 changed files with 11 additions and 5 deletions

View File

@@ -1309,7 +1309,7 @@ Make a selection:
if (File.Exists(filename)) if (File.Exists(filename))
{ {
logger.User("Converting " + filename); logger.User("Converting \"" + Path.GetFileName(filename) + "\"");
DatData datdata = new DatData DatData datdata = new DatData
{ {
Name = "", Name = "",
@@ -1348,7 +1348,7 @@ Make a selection:
foreach (string file in Directory.EnumerateFiles(filename, "*", SearchOption.AllDirectories)) foreach (string file in Directory.EnumerateFiles(filename, "*", SearchOption.AllDirectories))
{ {
logger.User("Converting " + file); logger.User("Converting \"" + Path.GetFullPath(file).Remove(0, filename.Length + 1) + "\"");
DatData datdata = new DatData DatData datdata = new DatData
{ {
Name = "", Name = "",

View File

@@ -75,6 +75,11 @@ namespace SabreTools.Helper
{ {
continue; continue;
} }
// Special case for nodump...
else if (gc[i] == "nodump" && attrib != "status" && attrib != "flags")
{
temp.SetAttributeValue("status", "nodump");
}
// Even number of quotes, not in a quote, not in attribute // Even number of quotes, not in a quote, not in attribute
else if (Regex.Matches(gc[i], "\"").Count % 2 == 0 && !quote && attrib == "") else if (Regex.Matches(gc[i], "\"").Count % 2 == 0 && !quote && attrib == "")
{ {

View File

@@ -55,7 +55,7 @@ namespace SabreTools.Helper
/// <returns>The XmlTextReader representing the (possibly converted) file, null otherwise</returns> /// <returns>The XmlTextReader representing the (possibly converted) file, null otherwise</returns>
public static XmlTextReader GetXmlTextReader(string filename, Logger logger) public static XmlTextReader GetXmlTextReader(string filename, Logger logger)
{ {
logger.Log("Attempting to read file: " + filename); logger.Log("Attempting to read file: \"" + filename + "\"");
// Check if file exists // Check if file exists
if (!File.Exists(filename)) if (!File.Exists(filename))
@@ -291,7 +291,8 @@ namespace SabreTools.Helper
// If the rom is nodump, skip it // If the rom is nodump, skip it
if (xtr.GetAttribute("flags") == "nodump" || xtr.GetAttribute("status") == "nodump") if (xtr.GetAttribute("flags") == "nodump" || xtr.GetAttribute("status") == "nodump")
{ {
logger.Log("Nodump detected; skipping..."); logger.Log("Nodump detected: " +
(xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != "" ? "\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND") + "; skipping...");
break; break;
} }
@@ -342,7 +343,7 @@ namespace SabreTools.Helper
// 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 (subreader.Name == "rom" && (size == 0 || size == -1)) else if (subreader.Name == "rom" && (size == 0 || size == -1))
{ {
logger.Warning("Potentially incomplete entry found for " + xtr.GetAttribute("name")); logger.Warning("Potentially incomplete entry found for \"" + xtr.GetAttribute("name") + "\"");
break; break;
} }