mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add new output to OfflineMerge
This commit is contained in:
@@ -156,6 +156,7 @@ namespace SabreTools
|
|||||||
/// (a) Net New - (currentNewMerged)-(currentAllMerged)
|
/// (a) Net New - (currentNewMerged)-(currentAllMerged)
|
||||||
/// (b) Unneeded - (currentAllMerged)-(currentNewMerged)
|
/// (b) Unneeded - (currentAllMerged)-(currentNewMerged)
|
||||||
/// (c) New Missing - (a)+(currentMissingMerged-(b))
|
/// (c) New Missing - (a)+(currentMissingMerged-(b))
|
||||||
|
/// (d) Have - (currentNewMerged)-(c)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>True if the files were created properly, false otherwise</returns>
|
/// <returns>True if the files were created properly, false otherwise</returns>
|
||||||
public bool Process()
|
public bool Process()
|
||||||
@@ -259,6 +260,66 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now create the Have dictionary [(currentNewMerged)-(c)]
|
||||||
|
_logger.Log("Creating and populating Have dictionary");
|
||||||
|
Dictionary<string, List<RomData>> midHave = new Dictionary<string, List<RomData>>();
|
||||||
|
foreach (string key in newMissing.Keys)
|
||||||
|
{
|
||||||
|
if (midHave.ContainsKey(key))
|
||||||
|
{
|
||||||
|
midHave[key].AddRange(newMissing[key]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
midHave.Add(key, newMissing[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (string key in completeDats.Keys)
|
||||||
|
{
|
||||||
|
if (midHave.ContainsKey(key))
|
||||||
|
{
|
||||||
|
foreach (RomData rom in completeDats[key])
|
||||||
|
{
|
||||||
|
if (rom.System == _currentNewMerged)
|
||||||
|
{
|
||||||
|
midHave[key].Add(rom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<RomData> roms = new List<RomData>();
|
||||||
|
foreach (RomData rom in completeDats[key])
|
||||||
|
{
|
||||||
|
if (rom.System == _currentNewMerged)
|
||||||
|
{
|
||||||
|
roms.Add(rom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
midHave.Add(key, roms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Dictionary<string, List<RomData>> have = new Dictionary<string, List<RomData>>();
|
||||||
|
foreach (string key in midHave.Keys)
|
||||||
|
{
|
||||||
|
if (midHave[key].Count == 1)
|
||||||
|
{
|
||||||
|
if (midHave[key][0].System == _currentNewMerged)
|
||||||
|
{
|
||||||
|
if (have.ContainsKey(key))
|
||||||
|
{
|
||||||
|
have[key].Add(midHave[key][0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<RomData> temp = new List<RomData>();
|
||||||
|
temp.Add(midHave[key][0]);
|
||||||
|
have.Add(key, temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we are supposed to replace everything in the output with default values, do so
|
// If we are supposed to replace everything in the output with default values, do so
|
||||||
if (_fake)
|
if (_fake)
|
||||||
{
|
{
|
||||||
@@ -315,12 +376,31 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
newMissing[key] = temp;
|
newMissing[key] = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_logger.Log("Replacing all hashes in Have with 0-byte values");
|
||||||
|
keys = have.Keys.ToList();
|
||||||
|
foreach (string key in keys)
|
||||||
|
{
|
||||||
|
List<RomData> temp = new List<RomData>();
|
||||||
|
List<RomData> roms = have[key];
|
||||||
|
for (int i = 0; i < roms.Count; i++)
|
||||||
|
{
|
||||||
|
RomData rom = roms[i];
|
||||||
|
rom.Size = sizezero;
|
||||||
|
rom.CRC = crczero;
|
||||||
|
rom.MD5 = md5zero;
|
||||||
|
rom.SHA1 = sha1zero;
|
||||||
|
temp.Add(rom);
|
||||||
|
}
|
||||||
|
have[key] = temp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, output all of the files
|
// Finally, output all of the files
|
||||||
Output.WriteToDatFromDict("Net New", "Net New", "", DateTime.Now.ToString("yyyy-MM-dd"), "", "SabreTools", false, false, true, "", netNew, _logger);
|
Output.WriteToDatFromDict("Net New", "Net New", "", DateTime.Now.ToString("yyyy-MM-dd"), "", "SabreTools", false, false, true, "", netNew, _logger);
|
||||||
Output.WriteToDatFromDict("Unneeded", "Unneeded", "", DateTime.Now.ToString("yyyy-MM-dd"), "", "SabreTools", false, false, true, "", unneeded, _logger);
|
Output.WriteToDatFromDict("Unneeded", "Unneeded", "", DateTime.Now.ToString("yyyy-MM-dd"), "", "SabreTools", false, false, true, "", unneeded, _logger);
|
||||||
Output.WriteToDatFromDict("New Missing", "New Missing", "", DateTime.Now.ToString("yyyy-MM-dd"), "", "SabreTools", false, false, true, "", newMissing, _logger);
|
Output.WriteToDatFromDict("New Missing", "New Missing", "", DateTime.Now.ToString("yyyy-MM-dd"), "", "SabreTools", false, false, true, "", newMissing, _logger);
|
||||||
|
Output.WriteToDatFromDict("Have", "Have", "", DateTime.Now.ToString("yyyy-MM-dd"), "", "SabreTools", false, false, true, "", have, _logger);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ Options:
|
|||||||
-lso, --list-sources List all sources (id <= name)
|
-lso, --list-sources List all sources (id <= name)
|
||||||
-lsy, --list-systems List all systems (id <= name)
|
-lsy, --list-systems List all systems (id <= name)
|
||||||
-m, --merge Merge one or more DATs
|
-m, --merge Merge one or more DATs
|
||||||
-ad, --all-diff Enable output of all diff variants (2 DATs only)
|
-ad, --all-diff Enable output of all diff variants
|
||||||
-di, --diff Switch to diffdat mode
|
-di, --diff Switch to diffdat mode
|
||||||
-dd, --dedup Enable deduping in the created DAT
|
-dd, --dedup Enable deduping in the created DAT
|
||||||
-b, --bare Don't include date in file name
|
-b, --bare Don't include date in file name
|
||||||
@@ -183,7 +183,8 @@ Options:
|
|||||||
This program will output the following DATs:
|
This program will output the following DATs:
|
||||||
(a) Net New - (NewComplete)-(Complete)
|
(a) Net New - (NewComplete)-(Complete)
|
||||||
(b) Unneeded - (Complete)-(NewComplete)
|
(b) Unneeded - (Complete)-(NewComplete)
|
||||||
(c) New Missing - (Net New)+(Missing-(Unneeded))");
|
(c) New Missing - (Net New)+(Missing-(Unneeded))
|
||||||
|
(d) Have - (NewComplete)-(New Missing)");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Console.Write("This is the default help output");
|
Console.Write("This is the default help output");
|
||||||
|
|||||||
Reference in New Issue
Block a user