No roms means a reduced footer, if any

This commit is contained in:
Matt Nadareski
2016-05-24 22:55:49 -07:00
parent ed1430831a
commit bd6bda72e5

View File

@@ -476,26 +476,43 @@ namespace SabreTools.Helper
try try
{ {
string footer = ""; string footer = "";
switch (datdata.OutputFormat)
// If we have roms, output the full footer
if (datdata.Roms.Count > 0)
{ {
case OutputFormat.ClrMamePro: switch (datdata.OutputFormat)
footer = ")"; {
break; case OutputFormat.ClrMamePro:
case OutputFormat.SabreDat: footer = ")";
for (int i = depth - 1; i >= 2; i--) break;
{ case OutputFormat.SabreDat:
// Print out the number of tabs and the end folder for (int i = depth - 1; i >= 2; i--)
for (int j = 0; j < i; j++)
{ {
footer += "\t"; // Print out the number of tabs and the end folder
for (int j = 0; j < i; j++)
{
footer += "\t";
}
footer += "</directory>\n";
} }
footer += "</directory>\n"; footer += "\t</data>\n</datafile>";
} break;
footer += "\t</data>\n</datafile>"; case OutputFormat.Xml:
break; footer = "\t</machine>\n</datafile>";
case OutputFormat.Xml: break;
footer = "\t</machine>\n</datafile>"; }
break; }
// Otherwise, output the abbreviated form
else
{
switch (datdata.OutputFormat)
{
case OutputFormat.SabreDat:
case OutputFormat.Xml:
footer = "</datafile>";
break;
}
} }
// Write the footer out // Write the footer out