mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatTools] Rearrange code blocks in WriteDatfile
This commit is contained in:
@@ -2417,30 +2417,23 @@ namespace SabreTools.Helper
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the DAT has no output format, default to XML
|
// If output directory is empty, use the current folder
|
||||||
if (datdata.OutputFormat == OutputFormat.None)
|
|
||||||
{
|
|
||||||
datdata.OutputFormat = OutputFormat.Xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Output initial statistics, for kicks
|
|
||||||
if (stats)
|
|
||||||
{
|
|
||||||
Stats.OutputStats(datdata, logger, (datdata.RomCount + datdata.DiskCount == 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bucket roms by game name and optionally dedupe
|
|
||||||
SortedDictionary<string, List<Rom>> sortable = DatTools.BucketByGame(datdata.Files, datdata.MergeRoms, norename, logger);
|
|
||||||
|
|
||||||
// Now write out to file
|
|
||||||
// If it's empty, use the current folder
|
|
||||||
if (outDir.Trim() == "")
|
if (outDir.Trim() == "")
|
||||||
{
|
{
|
||||||
outDir = Environment.CurrentDirectory;
|
outDir = Environment.CurrentDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the output directory if it doesn't already exist
|
// Create the output directory if it doesn't already exist
|
||||||
|
if (!Directory.Exists(outDir))
|
||||||
|
{
|
||||||
Directory.CreateDirectory(outDir);
|
Directory.CreateDirectory(outDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the DAT has no output format, default to XML
|
||||||
|
if (datdata.OutputFormat == OutputFormat.None)
|
||||||
|
{
|
||||||
|
datdata.OutputFormat = OutputFormat.Xml;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure that the three essential fields are filled in
|
// Make sure that the three essential fields are filled in
|
||||||
if (String.IsNullOrEmpty(datdata.FileName) && String.IsNullOrEmpty(datdata.Name) && String.IsNullOrEmpty(datdata.Description))
|
if (String.IsNullOrEmpty(datdata.FileName) && String.IsNullOrEmpty(datdata.Name) && String.IsNullOrEmpty(datdata.Description))
|
||||||
@@ -2476,6 +2469,15 @@ namespace SabreTools.Helper
|
|||||||
// Nothing is needed
|
// Nothing is needed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Output initial statistics, for kicks
|
||||||
|
if (stats)
|
||||||
|
{
|
||||||
|
Stats.OutputStats(datdata, logger, (datdata.RomCount + datdata.DiskCount == 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bucket roms by game name and optionally dedupe
|
||||||
|
SortedDictionary<string, List<Rom>> sortable = DatTools.BucketByGame(datdata.Files, datdata.MergeRoms, norename, logger);
|
||||||
|
|
||||||
// Get the outfile name
|
// Get the outfile name
|
||||||
string outfile = Style.CreateOutfileName(outDir, datdata);
|
string outfile = Style.CreateOutfileName(outDir, datdata);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user