From f838a2461ba424118ae4fc3532cfbaa9089a5846 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 2 Jun 2016 20:59:29 -0700 Subject: [PATCH] [Style] Make the extension more appropriate for each type --- SabreHelper/Style.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/SabreHelper/Style.cs b/SabreHelper/Style.cs index 1b6cfa39..4d9f55ca 100644 --- a/SabreHelper/Style.cs +++ b/SabreHelper/Style.cs @@ -154,8 +154,25 @@ namespace SabreTools.Helper outDir += Path.DirectorySeparatorChar; } + // Get the extension from the output type + string extension = ""; + switch(datdata.OutputFormat) + { + case OutputFormat.ClrMamePro: + case OutputFormat.DOSCenter: + case OutputFormat.RomCenter: + extension = ".dat"; + break; + case OutputFormat.MissFile: + extension = ".txt"; + break; + case OutputFormat.SabreDat: + case OutputFormat.Xml: + extension = ".xml"; + break; + } string filename = (String.IsNullOrEmpty(datdata.FileName) ? datdata.Description : datdata.FileName); - string outfile = outDir + filename + (datdata.OutputFormat == OutputFormat.Xml || datdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat"); + string outfile = outDir + filename + extension; outfile = (outfile.Contains(Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString()) ? outfile.Replace(Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString(), Path.DirectorySeparatorChar.ToString()) : outfile);