コード例 #1
0
        TypeDefSettingsCommand(ModuleDef module, TypeTreeNode typeNode, TypeDefOptions options)
        {
            this.module      = module;
            this.typeNode    = typeNode;
            this.newOptions  = options;
            this.origOptions = new TypeDefOptions(typeNode.TypeDef);

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

            this.nameChanged = origOptions.Name != newOptions.Name;
            if (this.origParentNode is NamespaceTreeNode)
            {
                var asmNode = (AssemblyTreeNode)this.origParentNode.Parent;
                if (!AssemblyTreeNode.NamespaceStringEqualsComparer.Equals(newOptions.Namespace, origOptions.Namespace))
                {
                    this.nsNodeCreator = new NamespaceTreeNodeCreator(newOptions.Namespace, asmNode);
                }
            }

            if (this.nameChanged || origOptions.Namespace != newOptions.Namespace)
            {
                this.typeRefInfos = RefFinder.FindTypeRefsToThisModule(module).Where(a => RefFinder.TypeEqualityComparerInstance.Equals(a, typeNode.TypeDef)).Select(a => new TypeRefInfo(a)).ToArray();
            }
        }
コード例 #2
0
ファイル: TypeDefCommands.cs プロジェクト: jorik041/dnSpy
		CreateTypeDefCommand(IList<TypeDef> ownerList, ILSpyTreeNode ownerNode, TypeDefOptions options)
		{
			this.ownerList = ownerList;
			var modNode = ILSpyTreeNode.GetNode<AssemblyTreeNode>(ownerNode);
			Debug.Assert(modNode != null);
			if (modNode == null)
				throw new InvalidOperationException();
			this.nsNodeCreator = new NamespaceTreeNodeCreator(options.Namespace, modNode);
			this.typeNode = new TypeTreeNode(options.CreateTypeDef(modNode.LoadedAssembly.ModuleDefinition), modNode.Parent as AssemblyTreeNode ?? modNode);
		}
コード例 #3
0
ファイル: TypeDefCommands.cs プロジェクト: jorik041/dnSpy
		TypeDefSettingsCommand(ModuleDef module, TypeTreeNode typeNode, TypeDefOptions options)
		{
			this.module = module;
			this.typeNode = typeNode;
			this.newOptions = options;
			this.origOptions = new TypeDefOptions(typeNode.TypeDefinition);

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

			this.nameChanged = origOptions.Name != newOptions.Name;
			if (this.origParentNode is NamespaceTreeNode) {
				var asmNode = (AssemblyTreeNode)this.origParentNode.Parent;
				if (AssemblyTreeNode.NamespaceStringComparer.Compare(newOptions.Namespace, origOptions.Namespace) != 0)
					this.nsNodeCreator = new NamespaceTreeNodeCreator(newOptions.Namespace, asmNode);
			}
		}
コード例 #4
0
ファイル: TypeDefCommands.cs プロジェクト: nakijun/dnSpy
		TypeDefSettingsCommand(ModuleDef module, TypeTreeNode typeNode, TypeDefOptions options) {
			this.module = module;
			this.typeNode = typeNode;
			this.newOptions = options;
			this.origOptions = new TypeDefOptions(typeNode.TypeDefinition);

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

			this.nameChanged = origOptions.Name != newOptions.Name;
			if (this.origParentNode is NamespaceTreeNode) {
				var asmNode = (AssemblyTreeNode)this.origParentNode.Parent;
				if (!AssemblyTreeNode.NamespaceStringEqualsComparer.Equals(newOptions.Namespace, origOptions.Namespace))
					this.nsNodeCreator = new NamespaceTreeNodeCreator(newOptions.Namespace, asmNode);
			}

			if (this.nameChanged || origOptions.Namespace != newOptions.Namespace)
				this.typeRefInfos = RefFinder.FindTypeRefsToThisModule(module).Where(a => RefFinder.TypeEqualityComparerInstance.Equals(a, typeNode.TypeDefinition)).Select(a => new TypeRefInfo(a)).ToArray();
		}
コード例 #5
0
ファイル: TypeDefCommands.cs プロジェクト: nakijun/dnSpy
		CreateTypeDefCommand(IList<TypeDef> ownerList, ILSpyTreeNode ownerNode, TypeDefOptions options) {
			this.ownerList = ownerList;
			var modNode = ILSpyTreeNode.GetNode<AssemblyTreeNode>(ownerNode);
			Debug.Assert(modNode != null);
			if (modNode == null)
				throw new InvalidOperationException();
			this.nsNodeCreator = new NamespaceTreeNodeCreator(options.Namespace, modNode);
			this.typeNode = new TypeTreeNode(options.CreateTypeDef(modNode.LoadedAssembly.ModuleDefinition), modNode.Parent as AssemblyTreeNode ?? modNode);
		}
コード例 #6
0
ファイル: TypeDefCommands.cs プロジェクト: BahNahNah/dnSpy
        TypeDefSettingsCommand(ModuleDef module, TypeTreeNode typeNode, TypeDefOptions options)
        {
            this.module = module;
            this.typeNode = typeNode;
            this.newOptions = options;
            this.origOptions = new TypeDefOptions(typeNode.TypeDefinition);

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

            this.nameChanged = origOptions.Name != newOptions.Name;
            if (this.origParentNode is NamespaceTreeNode) {
                var asmNode = (AssemblyTreeNode)this.origParentNode.Parent;
                if (AssemblyTreeNode.NamespaceStringComparer.Compare(newOptions.Namespace, origOptions.Namespace) != 0)
                    this.nsNodeCreator = new NamespaceTreeNodeCreator(newOptions.Namespace, asmNode);
            }
        }