Ejemplo n.º 1
0
        public AssemblyComparison CompareAssemblyFiles(DiffConfig config, ComparisonFilter filter, params string[] assemblyFiles)
        {
            _config = config;
            _filter = filter;

            if (_progress != null)
            {
                _progress.SetMaxRange(assemblyFiles.Length);
            }

            if (assemblyFiles.Length == 0)
            {
                return(null);
            }

            AppDomainIsolationLevel level = _config.IsolationLevel;

            if (level == AppDomainIsolationLevel.AutoDetect)
            {
                level = IsolationDetector.AutoDetectIsolationLevelFiles(assemblyFiles);
            }

            AssemblyManager    manager = AssemblyManagerFactory.Create(level);
            AssemblyComparison ac      = new AssemblyComparison();

            ac.Groups.Add(DoCompareFiles(manager, assemblyFiles));

            manager.AllExtractionsComplete();

            FilterResultSet(ac, filter);

            return(ac);
        }
Ejemplo n.º 2
0
        public AssemblyComparison CompareAssemblyDirectories(bool recurse, DiffConfig config, ComparisonFilter filter, params string[] assemblyDirectories)
        {
            _config = config;
            _filter = filter;

            int totalFiles = 0;
            List <List <ICanAlign> > allEntries = new List <List <ICanAlign> >();

            SearchOption option = recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;

            foreach (string dir in assemblyDirectories)
            {
                List <ICanAlign> entry = new List <ICanAlign>();

                entry.AddRange(AssemblyDirectoryEntry.From(dir, Directory.GetFiles(dir, "*.dll", option)));
                entry.AddRange(AssemblyDirectoryEntry.From(dir, Directory.GetFiles(dir, "*.exe", option)));

                totalFiles += entry.Count;
                allEntries.Add(entry);
            }

            if (allEntries.Count == 0)
            {
                return(null);
            }

            AppDomainIsolationLevel level = _config.IsolationLevel;

            if (level == AppDomainIsolationLevel.AutoDetect)
            {
                level = IsolationDetector.AutoDetectIsolationLevelDirs(assemblyDirectories);
            }

            ListOperations.AlignListsNoParent(allEntries.ToArray());

            AssemblyManager manager = AssemblyManagerFactory.Create(level);

            AssemblyComparison ac = new AssemblyComparison();

            if (_progress != null)
            {
                _progress.SetMaxRange(totalFiles);
            }

            for (int j = 0; j < allEntries[0].Count; j++)
            {
                List <string> thisRun = new List <string>();

                for (int i = 0; i < allEntries.Count; i++)
                {
                    if (allEntries[i][j].Status == Status.Present)
                    {
                        thisRun.Add(((AssemblyDirectoryEntry)allEntries[i][j]).Path);
                    }
                }

                ac.Groups.Add(DoCompareFiles(manager, thisRun.ToArray()));
            }

            manager.AllExtractionsComplete();

            FilterResultSet(ac, filter);

            return(ac);
        }