Add proper DAT addition and merging

This commit is contained in:
Matt Nadareski
2016-04-19 17:31:03 -07:00
parent 2628d4832a
commit 2fd0a8ab3a

View File

@@ -34,7 +34,7 @@ namespace SabreTools
Build.Start("DiffDat");
List<String> inputs = new List<String>();
bool tofile = false, help = false, merge = false; ;
bool tofile = false, help = false, merge = false, diff = false;
foreach (string arg in args)
{
switch (arg)
@@ -48,6 +48,10 @@ namespace SabreTools
case "--log":
tofile = true;
break;
case "-d":
case "--diff":
diff = true;
break;
case "-m":
case "--merge":
merge = true;
@@ -80,14 +84,21 @@ namespace SabreTools
return;
}
// Otherwise, read in the files, diff them, and write the result to the file type that the first one is
// Otherwise, read in the files, process them and write the result to the file type that the first one is
List<RomData> A = new List<RomData>();
foreach (string input in inputs)
{
logger.Log("Adding DAT: " + input);
List<RomData> B = RomManipulation.Parse(input, 0, 0, logger);
if (diff)
{
A = RomManipulation.Diff(A, B);
}
else
{
A.AddRange(B);
}
}
// If we want a merged list, send it for merging before outputting
if (merge)