mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add "AB" mode
Basically, this will output the information that's in each DAT but not in the merged and also the data that's only in every DAT. This needs testing, but it's a good start.
This commit is contained in:
@@ -118,6 +118,7 @@ Options:
|
||||
-lso, --list-sources List all sources (id <= name)
|
||||
-lsy, --list-systems List all systems (id <= name)
|
||||
-m, --merge Merge two or more DATs
|
||||
-ad, --all-diff Enable output of all diff variants
|
||||
-di, --diff Switch to diffdat mode
|
||||
-dd, --dedup Enable deduping in the created DAT
|
||||
-b, --bare Don't include date in file name
|
||||
|
||||
@@ -451,5 +451,35 @@ namespace SabreTools.Helper
|
||||
List<String> CString = AString.Except(BString).Union(BString.Except(AString)).ToList();
|
||||
return Output.StringToRomData(CString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all RomData objects that are in A but not in B
|
||||
/// </summary>
|
||||
/// <param name="A">First RomData list</param>
|
||||
/// <param name="B">Second RomData list</param>
|
||||
/// <returns>Any rom that's only in the first list</returns>
|
||||
/// <remarks>Adapted from http://stackoverflow.com/questions/5620266/the-opposite-of-intersect</remarks>
|
||||
public static List<RomData> DiffOnlyInA(List<RomData> A, List<RomData> B)
|
||||
{
|
||||
List<String> AString = Output.RomDataToString(A);
|
||||
List<String> BString = Output.RomDataToString(B);
|
||||
List<String> CString = AString.Except(BString).ToList();
|
||||
return Output.StringToRomData(CString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all RomData objects that are in A and B
|
||||
/// </summary>
|
||||
/// <param name="A">First RomData list</param>
|
||||
/// <param name="B">Second RomData list</param>
|
||||
/// <returns>Any rom that's in both lists</returns>
|
||||
/// <remarks>Adapted from http://stackoverflow.com/questions/5620266/the-opposite-of-intersect</remarks>
|
||||
public static List<RomData> DiffInAB(List<RomData> A, List<RomData> B)
|
||||
{
|
||||
List<String> AString = Output.RomDataToString(A);
|
||||
List<String> BString = Output.RomDataToString(B);
|
||||
List<String> CString = AString.Union(BString).Except(AString.Except(BString).Union(BString.Except(AString))).ToList();
|
||||
return Output.StringToRomData(CString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user