/** * <summary>This method will compare two files and will point out which files are in common, * and more importantly the differences</summary> */ private void Compare(ArmaModFile compareModFile, bool showInCommon) { //first round: check if file 2 has every element file 1 has (missing elements) foreach (ModElement mod in this.modList) { string currId = mod.id; if (compareModFile.HasId(currId)) { if (showInCommon) { Console.WriteLine($"Both files have {mod}."); } } else { Console.WriteLine($"File 2 is missing {mod}!"); } } //second round: check if file 1 has every element file 2 has (exceeding elements) foreach (ModElement mod in compareModFile.modList) { string currId = mod.id; if (this.HasId(currId)) { //reduntant to print they both have it, since that is already done above } else { Console.WriteLine($"File 1 is missing {mod}!"); } } }
static void Main(string[] args) { ArmaModFile file1 = new ArmaModFile(@"C:/Users/schwe/Desktop/jonas_ace.html"); ArmaModFile file2 = new ArmaModFile(@"C:/Users/schwe/Desktop/Arma 3 Mod Preset broken_ace.html"); /*Console.WriteLine("File 1:"); * file1.PrintModList(); * Console.WriteLine("File 2:"); * file2.PrintModList();*/ file1.Compare(file2, false); //Console.WriteLine(file2.HasId("753946944")); Console.ReadKey(true); }