private void method_9(CodeFile codeFile_0, AllSequences allSequences_0) { if (allSequences_0.Sequences.Count != 0) { int i = 0; IL_A1: while (i < codeFile_0.Similarities.Count) { Similarity similarity = codeFile_0.Similarities[i]; bool flag = false; int j = 0; while (j < allSequences_0.Sequences.Count) { Sequence sequence = allSequences_0.Sequences[j]; if (sequence.FirstCoord.J < similarity.MyHashIndexRange.Start || sequence.LastCoord.J > similarity.MyHashIndexRange.End) { j++; } else { codeFile_0.Similarities.Remove(similarity); flag = true; IL_9A: if (!flag) { i++; goto IL_A1; } goto IL_A1; } } goto IL_9A; } } }
internal void method7() { if (File.Exists("ignoreCode.txt")) { string str; using (StreamReader streamReader = new StreamReader("ignoreCode.txt")) { str = streamReader.ReadToEnd(); } List <CodeFile> list = method8(str); foreach (CodeFile current in list) { foreach (CodeFile file in Files) { AllSequences allSequences = Analysis.smethod1(current, file, current.Hashes.Length - 1); method9(file, allSequences); } } method2(RootDirectories.First <CodeDir>()); method3(); } }
private static AllSequences smethod2(CodeFile codeFile, int int2) { int[] hashes = codeFile.Hashes; int[] hashes2 = codeFile.Hashes; AllSequences allSequences = new AllSequences(); AllSequences result; if (hashes.Length == 0) { result = allSequences; } else { int[] array = new int[hashes2.Length]; int[] array2 = new int[hashes2.Length]; for (int i = 0; i < hashes.Length; i++) { for (int j = i; j < hashes2.Length; j++) { if (i != j) { if (hashes[i] != hashes2[j]) { array2[j] = 0; } else { if (i == 0 || j == 0) { array2[j] = 1; } else { array2[j] = 1 + array[j - 1]; } if (array2[j] > int2) { allSequences.AddCoordToAppropriateSequence(new Coord { I = i, J = j, Size = array2[j] }); } } } } int[] array3 = array; array = array2; array2 = array3; } result = allSequences; } return(result); }
internal void method_7() { if (File.Exists("ignoreCode.txt")) { string string_; using (StreamReader streamReader = new StreamReader("ignoreCode.txt")) { string_ = streamReader.ReadToEnd(); } List <CodeFile> list = this.method_8(string_); foreach (CodeFile current in list) { foreach (CodeFile current2 in this.observableCollection_1) { AllSequences allSequences_ = Analysis.smethod_1(current, current2, current.Hashes.Length - 1); this.method_9(current2, allSequences_); } } this.method_2(this.observableCollection_0.First <CodeDir>()); this.method_3(); } }
private void method9(CodeFile codeFile, AllSequences allSequences) { if (allSequences.Sequences.Count != 0) { int i = 0; IL_A1: while (i < codeFile.Similarities.Count) { Similarity similarity = codeFile.Similarities[i]; bool flag = false; int j = 0; while (j < allSequences.Sequences.Count) { Sequence sequence = allSequences.Sequences[j]; if (sequence.FirstCoord.J < similarity.MyHashIndexRange.Start || sequence.LastCoord.J > similarity.MyHashIndexRange.End) { j++; } else { codeFile.Similarities.Remove(similarity); flag = true; //IL_9A: if (!flag) { i++; goto IL_A1; } goto IL_A1; } } //goto IL_9A; } } }
private static AllSequences smethod2(CodeFile codeFile, int int2) { int[] hashes = codeFile.Hashes; int[] hashes2 = codeFile.Hashes; AllSequences allSequences = new AllSequences(); AllSequences result; if (hashes.Length == 0) { result = allSequences; } else { int[] array = new int[hashes2.Length]; int[] array2 = new int[hashes2.Length]; for (int i = 0; i < hashes.Length; i++) { for (int j = i; j < hashes2.Length; j++) { if (i != j) { if (hashes[i] != hashes2[j]) { array2[j] = 0; } else { if (i == 0 || j == 0) { array2[j] = 1; } else { array2[j] = 1 + array[j - 1]; } if (array2[j] > int2) { allSequences.AddCoordToAppropriateSequence(new Coord { I = i, J = j, Size = array2[j] }); } } } } int[] array3 = array; array = array2; array2 = array3; } result = allSequences; } return result; }
internal static AllSequences smethod1(CodeFile codeFile1, CodeFile codeFile2, int int2) { AllSequences result; if (codeFile1 == codeFile2) { result = Analysis.smethod2(codeFile1, int2); } else { int[] hashes = codeFile1.Hashes; int[] hashes2 = codeFile2.Hashes; AllSequences allSequences = new AllSequences(); if (hashes.Intersect(hashes2).Count<int>() == 0) { Analysis.int0++; result = allSequences; } else if (hashes.Length == 0 || hashes2.Length == 0) { result = allSequences; } else { int[] array = new int[hashes2.Length]; int[] array2 = new int[hashes2.Length]; for (int i = 0; i < hashes.Length; i++) { for (int j = 0; j < hashes2.Length; j++) { if (hashes[i] != hashes2[j]) { array2[j] = 0; } else { if (i == 0 || j == 0) { array2[j] = 1; } else { array2[j] = 1 + array[j - 1]; } if (array2[j] > int2) { allSequences.AddCoordToAppropriateSequence(new Coord { I = i, J = j, Size = array2[j] }); } } } int[] array3 = array; array = array2; array2 = array3; } result = allSequences; } } return result; }
private void method_10() { try { DirectoryInfo directoryInfo = new DirectoryInfo(this.string_0); int minSimilarityLineLength = this.options_0.MinSimilarityLineLength; FileInfo[] files = directoryInfo.GetFiles(this.options_0.FileSearchPattern, SearchOption.AllDirectories); int num = 0; List <Regex> excludeRegexes = this.options_0.GetExcludeRegexes(); FileInfo[] array = files; int i = 0; IL_98: while (i < array.Length) { FileInfo fileInfo = array[i]; bool flag = false; for (int j = 0; j < excludeRegexes.Count; j++) { if (excludeRegexes[j].IsMatch(fileInfo.FullName)) { flag = true; IL_87: if (!flag) { num++; } i++; goto IL_98; } } goto IL_87; } if (num == 0) { this.AlertAction("No " + this.options_0.FileSearchPattern + " Files Found"); this.Done(); } else { this.UpdateProgressAction(0, num, "Loading Files..."); CodeDir codeDir = this.method_4(directoryInfo, this.options_0.MinSimilarityLineLength, ""); this.observableCollection_0.Add(codeDir); ObservableCollection <CodeFile> observableCollection = this.observableCollection_1; this.UpdateProgressAction(0, observableCollection.Count * observableCollection.Count / 2, "Comparing Files..."); int num2 = 0; StringBuilder stringBuilder = new StringBuilder(); for (int j = 0; j < observableCollection.Count; j++) { CodeFile codeFile = observableCollection[j]; for (int k = j; k < observableCollection.Count; k++) { num2++; if (num2 % 500 == 0) { this.UpdateProgressValue(num2); } try { CodeFile codeFile_ = observableCollection[k]; AllSequences allSequences = Analysis.smethod_1(codeFile, codeFile_, minSimilarityLineLength); foreach (Sequence current in allSequences.Sequences) { Analysis.smethod_4(codeFile, codeFile_, current); } goto IL_24D; } catch (Exception ex) { stringBuilder.AppendLine(codeFile.Name + " - " + observableCollection[k].Name); goto IL_24D; } break; IL_24D :; } codeFile.method_1(); codeFile.Similarities.Sort(new Comparison <Similarity>(Analysis.smethod_0)); } this.method_2(codeDir); this.method_3(); this.method_7(); if (stringBuilder.Length > 0) { this.AlertAction("Atomiq experienced an error with the following file combinations: " + stringBuilder.ToString()); } this.bool_0 = true; this.Done(); } } catch (Exception ex) { if (!(ex is ThreadAbortException)) { this.CaughtException = ex; } this.Done(); } }
internal static AllSequences smethod_1(CodeFile codeFile_0, CodeFile codeFile_1, int int_2) { AllSequences result; if (codeFile_0 == codeFile_1) { result = Analysis.smethod_2(codeFile_0, int_2); } else { int[] hashes = codeFile_0.Hashes; int[] hashes2 = codeFile_1.Hashes; AllSequences allSequences = new AllSequences(); if (hashes.Intersect(hashes2).Count <int>() == 0) { Analysis.int_0++; result = allSequences; } else if (hashes.Length == 0 || hashes2.Length == 0) { result = allSequences; } else { int[] array = new int[hashes2.Length]; int[] array2 = new int[hashes2.Length]; for (int i = 0; i < hashes.Length; i++) { for (int j = 0; j < hashes2.Length; j++) { if (hashes[i] != hashes2[j]) { array2[j] = 0; } else { if (i == 0 || j == 0) { array2[j] = 1; } else { array2[j] = 1 + array[j - 1]; } if (array2[j] > int_2) { allSequences.AddCoordToAppropriateSequence(new Coord { I = i, J = j, Size = array2[j] }); } } } int[] array3 = array; array = array2; array2 = array3; } result = allSequences; } } return(result); }