public void LoadFrom(AssemblyComparison ac, bool preserveSelection) { string selection = null; if (preserveSelection && treeViewAdv1.SelectedNode != null) { selection = ((AssemblyGroupTreeItem)treeViewAdv1.SelectedNode.Tag).Group.Name; } treeViewAdv1.Model = new AssemblyComparisonModel(ac); int selIndex = 0; if (selection != null) { for (int i=0; i<treeViewAdv1.Root.Children.Count; i++) { if (((AssemblyGroupTreeItem)treeViewAdv1.Root.Children[i].Tag).Name == selection) { selIndex = i; break; } } } if (selIndex < treeViewAdv1.Root.Children.Count) { treeViewAdv1.Root.Children[selIndex].IsSelected = true; } }
public AssemblyComparisonTreeItem(AssemblyComparison ac) : base(Resources.VSObject_Assembly) { _ac = ac; }
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { _progress.Close(); _progress = null; if (e.Error != null) { ThreadExceptionDialog ted = new ThreadExceptionDialog(e.Error); ted.ShowDialog(); } else { SetStatus(_eltl.HighestLoggedLevel); _ac = (AssemblyComparison)e.Result; if (_ac != null) { ApplyFilter(); } } }
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(); return ac; }
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(); return ac; }
private void FilterResultSet(AssemblyComparison ac, ComparisonFilter filter) { if (ac == null || filter == null) { return; } if (filter.ChangedItemsOnly) { var removeList = ac.Groups.ToList().Where(g => g.Change == ChangeType.None && !g.HasErrors); removeList.ToList().ForEach(i => ac.Groups.Remove(i)); } }
private static ICanCompare FindInAssembly(AssemblyComparison ac, params string[] names) { ICanCompare current = ac.Groups[0].Assemblies[1]; for (int i = 0; i < names.Length; i++) { ICanCompare child = (ICanCompare)FindChildByName(current, names[i]); if ((i < names.Length - 1) && (child == null)) { Assert.Inconclusive("Did not find child named {0} in {1}.", names[i], current.Name); } current = child; } return current; }