public AnalyzingWindow(Options options)
		{
			this.InitializeComponent();
			this.analyzingViewModel_0 = new AnalyzingViewModel();
			this.analysis_0 = new Analysis(options.Directory);
			this.analysis_0.Options = options;
			base.DataContext = this.analyzingViewModel_0;
			base.Loaded += new RoutedEventHandler(this.AnalyzingWindow_Loaded);
		}
		public AnalyzingWindow(Options options)
		{
			InitializeComponent();
			_analyzingViewModel = new AnalyzingViewModel();
			Analysis = new Analysis(options.Directory);
			Analysis.Options = options;

			base.DataContext = _analyzingViewModel;
			base.Loaded += new RoutedEventHandler(AnalyzingWindow_Loaded);
		}
Beispiel #3
0
        private void method10()
        {
            try
            {
                DirectoryInfo directoryInfo           = new DirectoryInfo(Path);
                int           minSimilarityLineLength = Options.MinSimilarityLineLength;
                FileInfo[]    files          = directoryInfo.GetFiles(Options.FileSearchPattern, SearchOption.AllDirectories);
                int           num            = 0;
                List <Regex>  excludeRegexes = Options.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)
                {
                    AlertAction("No " + Options.FileSearchPattern + " Files Found");
                    Done();
                }
                else
                {
                    UpdateProgressAction(0, num, "Loading Files...");
                    CodeDir codeDir = method4(directoryInfo, Options.MinSimilarityLineLength, "");
                    RootDirectories.Add(codeDir);
                    ObservableCollection <CodeFile> codeFiles = Files;
                    UpdateProgressAction(0, codeFiles.Count * codeFiles.Count / 2, "Comparing Files...");
                    int           num2          = 0;
                    StringBuilder stringBuilder = new StringBuilder();

                    for (int j = 0; j < codeFiles.Count; j++)
                    {
                        CodeFile codeFile = codeFiles[j];

                        for (int k = j; k < codeFiles.Count; k++)
                        {
                            num2++;

                            if (num2 % 500 == 0)
                            {
                                this.UpdateProgressValue(num2);
                            }

                            try
                            {
                                CodeFile     codeFile_    = codeFiles[k];
                                AllSequences allSequences = Analysis.smethod1(codeFile, codeFile_, minSimilarityLineLength);

                                foreach (Sequence sequence in allSequences.Sequences)
                                {
                                    Analysis.smethod4(codeFile, codeFile_, sequence);
                                }
                                goto IL_24D;
                            }
                            catch (Exception ex)
                            {
                                stringBuilder.AppendLine(codeFile.Name + " - " + codeFiles[k].Name);
                                goto IL_24D;
                            }
                            break;
                            IL_24D :;
                        }

                        codeFile.method1();
                        codeFile.Similarities.Sort(new Comparison <Similarity>(Analysis.CompareSimilarities));
                    }

                    method2(codeDir);
                    method3();
                    method7();

                    if (stringBuilder.Length > 0)
                    {
                        this.AlertAction("Atomiq experienced an error with the following file combinations: " + stringBuilder.ToString());
                    }

                    bool0 = true;
                    Done();
                }
            }
            catch (Exception ex)
            {
                if (!(ex is ThreadAbortException))
                {
                    CaughtException = ex;
                }

                Done();
            }
        }
Beispiel #4
0
        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);
        }