Example #1
0
		public DeletedEventUpdater(ModuleDocumentNode modNode, EventDef originalEvent) {
			ownerNode = modNode.Context.DocumentTreeView.FindNode(originalEvent);
			if (ownerNode == null)
				throw new InvalidOperationException();
			parentNode = ownerNode.TreeNode.Parent.Data;
			ownerType = originalEvent.DeclaringType;
			@event = originalEvent;
		}
Example #2
0
		public EditedEventUpdater(ModuleDocumentNode modNode, EventDef originalEvent, EventDefOptions eventDefOptions) {
			ownerNode = modNode.Context.DocumentTreeView.FindNode(originalEvent);
			if (ownerNode == null)
				throw new InvalidOperationException();
			@event = originalEvent;
			originalEventDefOptions = new EventDefOptions(originalEvent);
			newEventDefOptions = eventDefOptions;
		}
Example #3
0
		EventDefSettingsCommand(EventNode eventNode, EventDefOptions options) {
			this.eventNode = eventNode;
			newOptions = options;
			origOptions = new EventDefOptions(eventNode.EventDef);

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

			nameChanged = origOptions.Name != newOptions.Name;
		}
Example #4
0
		CreateEventDefCommand(TypeNode ownerNode, EventDefOptions options) {
			this.ownerNode = ownerNode;
			eventNode = ownerNode.Create(options.CreateEventDef(ownerNode.TypeDef.Module));
		}
Example #5
0
		DeleteEventDefCommand(EventNode[] eventNodes) {
			nodes = new DeletableNodes<EventNode>(eventNodes);
		}
Example #6
0
			public void Restore(EventNode[] 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.EventDef);

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

				infos = null;
			}
Example #7
0
			public void Delete(EventNode[] 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.EventDef);
					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;
					}
				}
			}
Example #8
0
		public EventNodeCreator(ModuleDocumentNode modNode, TypeNode ownerNode, EventDef @event) {
			this.ownerNode = ownerNode;
			eventNode = modNode.Context.DocumentTreeView.Create(@event);
		}