From bd6bda72e598777d424267fc7e1dfda5dc7ced23 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 24 May 2016 22:55:49 -0700 Subject: [PATCH] No roms means a reduced footer, if any --- SabreHelper/Output.cs | 51 ++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/SabreHelper/Output.cs b/SabreHelper/Output.cs index 33946876..bc90790e 100644 --- a/SabreHelper/Output.cs +++ b/SabreHelper/Output.cs @@ -476,26 +476,43 @@ namespace SabreTools.Helper try { string footer = ""; - switch (datdata.OutputFormat) + + // If we have roms, output the full footer + if (datdata.Roms.Count > 0) { - case OutputFormat.ClrMamePro: - footer = ")"; - break; - case OutputFormat.SabreDat: - for (int i = depth - 1; i >= 2; i--) - { - // Print out the number of tabs and the end folder - for (int j = 0; j < i; j++) + switch (datdata.OutputFormat) + { + case OutputFormat.ClrMamePro: + footer = ")"; + break; + case OutputFormat.SabreDat: + for (int i = depth - 1; i >= 2; i--) { - footer += "\t"; + // Print out the number of tabs and the end folder + for (int j = 0; j < i; j++) + { + footer += "\t"; + } + footer += "\n"; } - footer += "\n"; - } - footer += "\t\n"; - break; - case OutputFormat.Xml: - footer = "\t\n"; - break; + footer += "\t\n"; + break; + case OutputFormat.Xml: + footer = "\t\n"; + break; + } + } + + // Otherwise, output the abbreviated form + else + { + switch (datdata.OutputFormat) + { + case OutputFormat.SabreDat: + case OutputFormat.Xml: + footer = ""; + break; + } } // Write the footer out