[DatFile] Force BOM off with UTF8 writing

Input DATs are straight UTF-8 the majority of the time so we should output the same
This commit is contained in:
Matt Nadareski
2016-09-20 23:42:22 -07:00
parent cadc3e941c
commit 340580708a

View File

@@ -2258,13 +2258,6 @@ namespace SabreTools.Helper
List<DatItem> roms = dict[key]; List<DatItem> roms = dict[key];
// If we somehow have a null list, just skip it
if (roms == null)
{
logger.Warning("Blank list found for key: " + key);
continue;
}
// If we're merging the roms, do so // If we're merging the roms, do so
if (mergeroms) if (mergeroms)
{ {
@@ -2989,7 +2982,7 @@ namespace SabreTools.Helper
logger.User("Opening file for writing: " + outfile); logger.User("Opening file for writing: " + outfile);
FileStream fs = File.Create(outfile); FileStream fs = File.Create(outfile);
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8); StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false));
// Write out the header // Write out the header
WriteHeader(sw, outputFormat, datdata, logger); WriteHeader(sw, outputFormat, datdata, logger);
@@ -3776,7 +3769,7 @@ namespace SabreTools.Helper
switch (outputFormat) switch (outputFormat)
{ {
case OutputFormat.ClrMamePro: case OutputFormat.ClrMamePro:
footer = ")"; footer = ")\n";
break; break;
case OutputFormat.SabreDat: case OutputFormat.SabreDat:
for (int i = depth - 1; i >= 2; i--) for (int i = depth - 1; i >= 2; i--)
@@ -3788,10 +3781,10 @@ namespace SabreTools.Helper
} }
footer += "</directory>\n"; footer += "</directory>\n";
} }
footer += "\t</data>\n</datafile>"; footer += "\t</data>\n</datafile>\n";
break; break;
case OutputFormat.Xml: case OutputFormat.Xml:
footer = "\t</machine>\n</datafile>"; footer = "\t</machine>\n</datafile>\n";
break; break;
} }
} }
@@ -3803,7 +3796,7 @@ namespace SabreTools.Helper
{ {
case OutputFormat.SabreDat: case OutputFormat.SabreDat:
case OutputFormat.Xml: case OutputFormat.Xml:
footer = "</datafile>"; footer = "</datafile>\n";
break; break;
} }
} }