Enable on-the-fly DAT writing for DATFromDir

This commit is contained in:
Matt Nadareski
2016-05-23 15:57:09 -07:00
parent 9184aa824e
commit 92d5337ac9
3 changed files with 142 additions and 87 deletions

View File

@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
@@ -141,11 +142,19 @@ namespace SabreTools.Helper
public static string CreateOutfileName(string outDir, DatData datdata)
{
// Double check the outdir for the end delim
if (!outDir.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
outDir += Path.DirectorySeparatorChar;
}
string outfile = outDir + datdata.Description + (datdata.OutputFormat == OutputFormat.Xml || datdata.OutputFormat == OutputFormat.SabreDat ? ".xml" : ".dat");
outfile = (outfile.Contains(Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString()) ?
outfile.Replace(Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString(), Path.DirectorySeparatorChar.ToString()) :
outfile);
Console.WriteLine(outfile);
return outfile;
}
}