static IEnumerable <UndoRedoInfo> GetUndoRedoInfo(IUndoCommandManager undoCommandManager, IEnumerable <IDnSpyFileNode> nodes) { var modifiedUndoAsms = new HashSet <IUndoObject>(undoCommandManager.UndoObjects); var modifiedRedoAsms = new HashSet <IUndoObject>(undoCommandManager.RedoObjects); foreach (var node in nodes) { var uo = undoCommandManager.GetUndoObject(node.DnSpyFile); bool isInUndo = modifiedUndoAsms.Contains(uo); bool isInRedo = modifiedRedoAsms.Contains(uo); yield return(new UndoRedoInfo(node, isInUndo, isInRedo)); } }
public void Execute() { Debug.Assert(modNode.TreeNode.Parent == null); if (modNode.TreeNode.Parent != null) { throw new InvalidOperationException(); } asmNode.TreeNode.EnsureChildrenLoaded(); asmNode.DnSpyFile.AssemblyDef.Modules.Add(modNode.DnSpyFile.ModuleDef); asmNode.DnSpyFile.Children.Add(modNode.DnSpyFile); asmNode.TreeNode.AddChild(modNode.TreeNode); if (modNodeWasCreated) { undoCommandManager.MarkAsModified(undoCommandManager.GetUndoObject(modNode.DnSpyFile)); } }
public void Execute() { fileNodeCreator.Add(); undoCommandManager.MarkAsModified(undoCommandManager.GetUndoObject(fileNodeCreator.DnSpyFileNode.DnSpyFile)); }
static IEnumerable<UndoRedoInfo> GetUndoRedoInfo(IUndoCommandManager undoCommandManager, IEnumerable<IDnSpyFileNode> nodes) { var modifiedUndoAsms = new HashSet<IUndoObject>(undoCommandManager.UndoObjects); var modifiedRedoAsms = new HashSet<IUndoObject>(undoCommandManager.RedoObjects); foreach (var node in nodes) { var uo = undoCommandManager.GetUndoObject(node.DnSpyFile); bool isInUndo = modifiedUndoAsms.Contains(uo); bool isInRedo = modifiedRedoAsms.Contains(uo); yield return new UndoRedoInfo(node, isInUndo, isInRedo); } }