コード例 #1
0
        public PropertyOptionsVM(PropertyDefOptions options, ModuleDef ownerModule, ILanguageManager languageManager, TypeDef ownerType)
        {
            this.ownerModule = ownerModule;
            this.origOptions = options;

            var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, languageManager)
            {
                IsLocal = false,
                CanAddGenericTypeVar   = true,
                CanAddGenericMethodVar = true,
                OwnerType = ownerType,
            };

            if (ownerType != null && ownerType.GenericParameters.Count == 0)
            {
                typeSigCreatorOptions.CanAddGenericTypeVar = false;
            }
            var methodSigCreatorOptions = new MethodSigCreatorOptions(typeSigCreatorOptions);

            methodSigCreatorOptions.IsPropertySig = true;
            this.methodSigCreator = new MethodSigCreatorVM(methodSigCreatorOptions);
            this.methodSigCreator.PropertyChanged += methodSigCreator_PropertyChanged;
            this.methodSigCreator.ParametersCreateTypeSigArray.PropertyChanged           += methodSigCreator_PropertyChanged;
            this.methodSigCreator.ParametersCreateTypeSigArray.TypeSigCreator.CanAddFnPtr = false;
            this.getMethodsVM                = new MethodDefsVM(ownerModule, languageManager);
            this.setMethodsVM                = new MethodDefsVM(ownerModule, languageManager);
            this.otherMethodsVM              = new MethodDefsVM(ownerModule, languageManager);
            this.customAttributesVM          = new CustomAttributesVM(ownerModule, languageManager);
            this.constantVM                  = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, dnSpy_AsmEditor_Resources.Property_DefaultValue);
            this.constantVM.PropertyChanged += constantVM_PropertyChanged;

            ConstantVM.IsEnabled = HasDefault;
            Reinitialize();
        }
コード例 #2
0
ファイル: PropertyOptionsVM.cs プロジェクト: BahNahNah/dnSpy
        public PropertyOptionsVM(PropertyDefOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType)
        {
            this.ownerModule = ownerModule;
            this.origOptions = options;

            var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) {
                IsLocal = false,
                CanAddGenericTypeVar = true,
                CanAddGenericMethodVar = true,
                OwnerType = ownerType,
            };
            if (ownerType != null && ownerType.GenericParameters.Count == 0)
                typeSigCreatorOptions.CanAddGenericTypeVar = false;
            var methodSigCreatorOptions = new MethodSigCreatorOptions(typeSigCreatorOptions);
            methodSigCreatorOptions.IsPropertySig = true;
            this.methodSigCreator = new MethodSigCreatorVM(methodSigCreatorOptions);
            this.methodSigCreator.PropertyChanged += methodSigCreator_PropertyChanged;
            this.methodSigCreator.ParametersCreateTypeSigArray.PropertyChanged += methodSigCreator_PropertyChanged;
            this.methodSigCreator.ParametersCreateTypeSigArray.TypeSigCreator.CanAddFnPtr = false;
            this.getMethodsVM = new MethodDefsVM(ownerModule, language);
            this.setMethodsVM = new MethodDefsVM(ownerModule, language);
            this.otherMethodsVM = new MethodDefsVM(ownerModule, language);
            this.customAttributesVM = new CustomAttributesVM(ownerModule, language);
            this.constantVM = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, "Default value for this property");
            this.constantVM.PropertyChanged += constantVM_PropertyChanged;

            ConstantVM.IsEnabled = HasDefault;
            Reinitialize();
        }
コード例 #3
0
		public MethodBaseSig Create(MethodSigCreatorOptions options, MethodBaseSig origSig) {
			var data = new MethodSigCreatorVM(options);
			if (origSig is MethodSig)
				data.MethodSig = (MethodSig)origSig;
			else if (origSig is PropertySig)
				data.PropertySig = (PropertySig)origSig;
			var win = new MethodSigCreatorDlg();
			win.DataContext = data;
			win.Owner = ownerWindow ?? Application.Current.MainWindow;
			if (win.ShowDialog() != true)
				return null;

			return data.MethodBaseSig;
		}
コード例 #4
0
ファイル: MethodOptionsVM.cs プロジェクト: zquans/dnSpy
        public MethodOptionsVM(MethodDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod)
        {
            this.ownerModule = ownerModule;
            var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService)
            {
                IsLocal = false,
                CanAddGenericTypeVar   = true,
                CanAddGenericMethodVar = ownerMethod == null || ownerMethod.GenericParameters.Count > 0,
                OwnerType   = ownerType,
                OwnerMethod = ownerMethod,
            };

            if (ownerType != null && ownerType.GenericParameters.Count == 0)
            {
                typeSigCreatorOptions.CanAddGenericTypeVar = false;
            }

            var methodSigCreatorOptions = new MethodSigCreatorOptions(typeSigCreatorOptions);

            methodSigCreatorOptions.IsPropertySig = false;
            MethodSigCreator = new MethodSigCreatorVM(methodSigCreatorOptions);
            MethodSigCreator.PropertyChanged += methodSigCreator_PropertyChanged;
            MethodSigCreator.ParametersCreateTypeSigArray.PropertyChanged += methodSigCreator_PropertyChanged;
            MethodSigCreator.ParametersCreateTypeSigArray.TypeSigCreator.ShowTypeFullName = true;
            MethodSigCreator.ParametersCreateTypeSigArray.TypeSigCreator.CanAddFnPtr      = false;

            CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService, ownerType, ownerMethod);
            DeclSecuritiesVM   = new DeclSecuritiesVM(ownerModule, decompilerService, ownerType, ownerMethod);
            ParamDefsVM        = new ParamDefsVM(ownerModule, decompilerService, ownerType, ownerMethod);
            GenericParamsVM    = new GenericParamsVM(ownerModule, decompilerService, ownerType, ownerMethod);
            MethodOverridesVM  = new MethodOverridesVM(ownerModule, decompilerService, ownerType, ownerMethod);

            origOptions = options;

            ImplMapVM = new ImplMapVM(ownerModule);
            ImplMapVM.PropertyChanged += implMapVM_PropertyChanged;

            ImplMapVM.IsEnabled = PinvokeImpl;
            Reinitialize();
        }
コード例 #5
0
ファイル: MemberRefVM.cs プロジェクト: 4058665/dnSpy
        public MemberRefVM(MemberRefOptions options, TypeSigCreatorOptions typeSigCreatorOptions, bool isField)
        {
            this.isField = isField;
            this.typeSigCreatorOptions = typeSigCreatorOptions.Clone();
            this.origOptions = options;
            this.customAttributesVM = new CustomAttributesVM(typeSigCreatorOptions.OwnerModule, typeSigCreatorOptions.Language);

            this.typeSigCreatorOptions.CanAddGenericMethodVar = true;
            this.typeSigCreatorOptions.CanAddGenericTypeVar = true;
            this.typeSigCreatorOptions.IsLocal = false;
            this.typeSigCreatorOptions.NullTypeSigAllowed = false;

            this.typeSigCreatorVM = new TypeSigCreatorVM(this.typeSigCreatorOptions.Clone("Create Field TypeSig"));
            TypeSigCreatorVM.PropertyChanged += (s, e) => HasErrorUpdated();

            var mopts = new MethodSigCreatorOptions(this.typeSigCreatorOptions.Clone());
            mopts.CanHaveSentinel = true;
            this.methodSigCreatorVM = new MethodSigCreatorVM(mopts);
            MethodSigCreatorVM.PropertyChanged += (s, e) => HasErrorUpdated();

            Reinitialize();
        }
コード例 #6
0
        public MethodBaseSig Create(MethodSigCreatorOptions options, MethodBaseSig origSig)
        {
            var data = new MethodSigCreatorVM(options);

            if (origSig is MethodSig)
            {
                data.MethodSig = (MethodSig)origSig;
            }
            else if (origSig is PropertySig)
            {
                data.PropertySig = (PropertySig)origSig;
            }
            var win = new MethodSigCreatorDlg();

            win.DataContext = data;
            win.Owner       = ownerWindow ?? Application.Current.MainWindow;
            if (win.ShowDialog() != true)
            {
                return(null);
            }

            return(data.MethodBaseSig);
        }
コード例 #7
0
ファイル: MethodOptionsVM.cs プロジェクト: se7ensoft/dnSpy
        public MethodOptionsVM(MethodDefOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod)
        {
            this.ownerModule = ownerModule;
            var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) {
                IsLocal = false,
                CanAddGenericTypeVar = true,
                CanAddGenericMethodVar = ownerMethod == null || ownerMethod.GenericParameters.Count > 0,
                OwnerType = ownerType,
                OwnerMethod = ownerMethod,
            };
            if (ownerType != null && ownerType.GenericParameters.Count == 0)
                typeSigCreatorOptions.CanAddGenericTypeVar = false;

            var methodSigCreatorOptions = new MethodSigCreatorOptions(typeSigCreatorOptions);
            methodSigCreatorOptions.IsPropertySig = false;
            this.methodSigCreator = new MethodSigCreatorVM(methodSigCreatorOptions);
            this.methodSigCreator.PropertyChanged += methodSigCreator_PropertyChanged;
            this.methodSigCreator.ParametersCreateTypeSigArray.PropertyChanged += methodSigCreator_PropertyChanged;
            this.methodSigCreator.ParametersCreateTypeSigArray.TypeSigCreator.ShowTypeFullName = true;
            this.methodSigCreator.ParametersCreateTypeSigArray.TypeSigCreator.CanAddFnPtr = false;

            this.customAttributesVM = new CustomAttributesVM(ownerModule, language, ownerType, ownerMethod);
            this.declSecuritiesVM = new DeclSecuritiesVM(ownerModule, language, ownerType, ownerMethod);
            this.paramDefsVM = new ParamDefsVM(ownerModule, language, ownerType, ownerMethod);
            this.genericParamsVM = new GenericParamsVM(ownerModule, language, ownerType, ownerMethod);
            this.methodOverridesVM = new MethodOverridesVM(ownerModule, language, ownerType, ownerMethod);

            this.origOptions = options;

            this.implMapVM = new ImplMapVM(ownerModule);
            ImplMapVM.PropertyChanged += implMapVM_PropertyChanged;

            ImplMapVM.IsEnabled = PinvokeImpl;
            Reinitialize();
        }
コード例 #8
0
		public PropertyOptionsVM(PropertyDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType) {
			this.ownerModule = ownerModule;
			origOptions = options;

			var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) {
				IsLocal = false,
				CanAddGenericTypeVar = true,
				CanAddGenericMethodVar = true,
				OwnerType = ownerType,
			};
			if (ownerType != null && ownerType.GenericParameters.Count == 0)
				typeSigCreatorOptions.CanAddGenericTypeVar = false;
			var methodSigCreatorOptions = new MethodSigCreatorOptions(typeSigCreatorOptions);
			methodSigCreatorOptions.IsPropertySig = true;
			MethodSigCreator = new MethodSigCreatorVM(methodSigCreatorOptions);
			MethodSigCreator.PropertyChanged += methodSigCreator_PropertyChanged;
			MethodSigCreator.ParametersCreateTypeSigArray.PropertyChanged += methodSigCreator_PropertyChanged;
			MethodSigCreator.ParametersCreateTypeSigArray.TypeSigCreator.CanAddFnPtr = false;
			GetMethodsVM = new MethodDefsVM(ownerModule, decompilerService);
			SetMethodsVM = new MethodDefsVM(ownerModule, decompilerService);
			OtherMethodsVM = new MethodDefsVM(ownerModule, decompilerService);
			CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService);
			ConstantVM = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, dnSpy_AsmEditor_Resources.Property_DefaultValue);
			ConstantVM.PropertyChanged += constantVM_PropertyChanged;

			ConstantVM.IsEnabled = HasDefault;
			Reinitialize();
		}
コード例 #9
0
ファイル: MemberRefVM.cs プロジェクト: manojdjoshi/dnSpy
		public MemberRefVM(MemberRefOptions options, TypeSigCreatorOptions typeSigCreatorOptions, bool isField) {
			IsField = isField;
			this.typeSigCreatorOptions = typeSigCreatorOptions.Clone();
			origOptions = options;
			CustomAttributesVM = new CustomAttributesVM(typeSigCreatorOptions.OwnerModule, typeSigCreatorOptions.DecompilerService);

			this.typeSigCreatorOptions.CanAddGenericMethodVar = true;
			this.typeSigCreatorOptions.CanAddGenericTypeVar = true;
			this.typeSigCreatorOptions.IsLocal = false;
			this.typeSigCreatorOptions.NullTypeSigAllowed = false;

			TypeSigCreatorVM = new TypeSigCreatorVM(this.typeSigCreatorOptions.Clone(dnSpy_AsmEditor_Resources.CreateFieldTypeSig));
			TypeSigCreatorVM.PropertyChanged += (s, e) => HasErrorUpdated();

			var mopts = new MethodSigCreatorOptions(this.typeSigCreatorOptions.Clone());
			mopts.CanHaveSentinel = true;
			MethodSigCreatorVM = new MethodSigCreatorVM(mopts);
			MethodSigCreatorVM.PropertyChanged += (s, e) => HasErrorUpdated();

			Reinitialize();
		}