Represents an event in the TreeView.
Inheritance: ILSpyTreeNode, IMemberTreeNode
Beispiel #1
0
 CreateEventDefCommand(TypeTreeNode ownerNode, EventDefOptions options)
 {
     this.ownerNode = ownerNode;
     this.eventNode = new EventTreeNode(options.CreateEventDef(ownerNode.TypeDefinition.Module));
 }
Beispiel #2
0
        EventDefSettingsCommand(EventTreeNode eventNode, EventDefOptions options)
        {
            this.eventNode = eventNode;
            this.newOptions = options;
            this.origOptions = new EventDefOptions(eventNode.EventDefinition);

            this.origParentNode = (ILSpyTreeNode)eventNode.Parent;
            this.origParentChildIndex = this.origParentNode.Children.IndexOf(eventNode);
            Debug.Assert(this.origParentChildIndex >= 0);
            if (this.origParentChildIndex < 0)
                throw new InvalidOperationException();

            this.nameChanged = origOptions.Name != newOptions.Name;
        }
Beispiel #3
0
            public void Delete(EventTreeNode[] nodes)
            {
                Debug.Assert(infos == null);
                if (infos != null)
                    throw new InvalidOperationException();

                infos = new ModelInfo[nodes.Length];

                for (int i = 0; i < infos.Length; i++) {
                    var node = nodes[i];

                    var info = new ModelInfo(node.EventDefinition);
                    infos[i] = info;
                    info.OwnerType.Events.RemoveAt(info.EventIndex);

                    for (int j = 0; j < info.Methods.Length; j++) {
                        int index = info.OwnerType.Methods.IndexOf(info.Methods[j]);
                        Debug.Assert(index >= 0);
                        if (index < 0)
                            throw new InvalidOperationException();
                        info.OwnerType.Methods.RemoveAt(index);
                        info.MethodIndexes[j] = index;
                    }
                }
            }
Beispiel #4
0
            public void Restore(EventTreeNode[] nodes)
            {
                Debug.Assert(infos != null);
                if (infos == null)
                    throw new InvalidOperationException();
                Debug.Assert(infos.Length == nodes.Length);
                if (infos.Length != nodes.Length)
                    throw new InvalidOperationException();

                for (int i = infos.Length - 1; i >= 0; i--) {
                    var node = nodes[i];
                    var info = infos[i];
                    info.OwnerType.Events.Insert(info.EventIndex, node.EventDefinition);

                    for (int j = info.Methods.Length - 1; j >= 0; j--)
                        info.OwnerType.Methods.Insert(info.MethodIndexes[j], info.Methods[j]);
                }

                infos = null;
            }
Beispiel #5
0
 DeleteEventDefCommand(EventTreeNode[] eventNodes)
 {
     this.nodes = new DeletableNodes<EventTreeNode>(eventNodes);
 }