Handle blank folders in DATFromDir and output alike

This commit is contained in:
Matt Nadareski
2016-05-19 10:28:53 -07:00
parent b10e5e9502
commit 41063921f2
4 changed files with 222 additions and 86 deletions

View File

@@ -28,7 +28,7 @@ namespace SabreTools.Helper
{
XElement elem = new XElement("datafile");
bool block = false;
bool block = false, romfound = false;
for (int k = 0; k < filecontents.Length; k++)
{
string line = filecontents[k];
@@ -61,6 +61,7 @@ namespace SabreTools.Helper
// If the line is a rom or disk and we're in a block
else if ((line.Trim().StartsWith("rom (") || line.Trim().StartsWith("disk (")) && block)
{
romfound = true;
string[] gc = line.Trim().Split(' ');
XElement temp = new XElement(gc[0]);
@@ -151,6 +152,7 @@ namespace SabreTools.Helper
// If we find an end bracket that's not associated with anything else, the block is done
else if (Regex.IsMatch(line, _endPatternCMP) && block)
{
romfound = false;
block = false;
elem = elem.Parent;
}