diff --git a/SabreHelper/RomManipulation.cs b/SabreHelper/RomManipulation.cs
index 923f49f2..1afe6378 100644
--- a/SabreHelper/RomManipulation.cs
+++ b/SabreHelper/RomManipulation.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
@@ -8,6 +9,25 @@ namespace SabreTools.Helper
{
public class RomManipulation
{
+ ///
+ /// Return if the file is XML or not
+ ///
+ /// Name of the file to be parsed
+ /// True if the file is XML, false otherwise
+ public static bool IsXmlDat(string filename)
+ {
+ XmlDocument doc = new XmlDocument();
+ try
+ {
+ doc.LoadXml(File.ReadAllText(filename));
+ }
+ catch (XmlException)
+ {
+ return false;
+ }
+ return true;
+ }
+
///
/// Parse a DAT and return all found games and roms within
///
@@ -304,18 +324,16 @@ namespace SabreTools.Helper
});
}
- public static bool IsXmlDat(string filename)
+ ///
+ /// Get differences between two lists of RomData objects
+ ///
+ /// First RomData list
+ /// Second RomData list
+ /// Any rom that's not in both lists
+ /// Adapted from http://stackoverflow.com/questions/5620266/the-opposite-of-intersect
+ public static List Diff(List A, List B)
{
- XmlDocument doc = new XmlDocument();
- try
- {
- doc.LoadXml(File.ReadAllText(filename));
- }
- catch (XmlException)
- {
- return false;
- }
- return true;
+ return A.Except(B).Union(B.Except(A)).ToList();
}
}
}