示例#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);
        }
		public static AssemblyManager Create(AppDomainIsolationLevel level)
		{
			switch (level)
			{
				case AppDomainIsolationLevel.None: return new AssemblyManagerIsolationNone();
				case AppDomainIsolationLevel.Low: return new AssemblyManagerIsolationLow();
				case AppDomainIsolationLevel.Medium: return new AssemblyManagerIsolationMedium();
				case AppDomainIsolationLevel.High: return new AssemblyManagerIsolationHigh();
				default: throw new ArgumentException("level");
			}
		}
        public static AssemblyManager Create(AppDomainIsolationLevel level)
        {
            switch (level)
            {
            case AppDomainIsolationLevel.None: return(new AssemblyManagerIsolationNone());

            case AppDomainIsolationLevel.Low: return(new AssemblyManagerIsolationLow());

            case AppDomainIsolationLevel.Medium: return(new AssemblyManagerIsolationMedium());

            case AppDomainIsolationLevel.High: return(new AssemblyManagerIsolationHigh());

            default: throw new ArgumentException("level");
            }
        }
示例#4
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);
        }