public AssemblyOptionsVM(AssemblyOptions options, ModuleDef ownerModule, Language language) { this.ownerModule = ownerModule; this.origOptions = options; this.hashAlgorithmVM = new EnumListVM(hashAlgorithmList, (a, b) => OnPropertyChanged("AssemblyFullName")); this.contentTypeVM = new EnumListVM(contentTypeList, (a, b) => OnPropertyChanged("AssemblyFullName")); this.versionMajor = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged("AssemblyFullName"); }) { UseDecimal = true }; this.versionMinor = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged("AssemblyFullName"); }) { UseDecimal = true }; this.versionBuild = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged("AssemblyFullName"); }) { UseDecimal = true }; this.versionRevision = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged("AssemblyFullName"); }) { UseDecimal = true }; this.publicKey = new HexStringVM(a => { HasErrorUpdated(); OnPropertyChanged("AssemblyFullName"); UpdatePublicKeyFlag(); }) { UpperCaseHex = false }; this.customAttributesVM = new CustomAttributesVM(ownerModule, language); this.declSecuritiesVM = new DeclSecuritiesVM(ownerModule, language, null, null); Reinitialize(); }
public TypeOptionsVM(TypeDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType) { this.ownerModule = ownerModule; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } TypeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); TypeSigCreator.PropertyChanged += typeSigCreator_PropertyChanged; CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService, ownerType, null); DeclSecuritiesVM = new DeclSecuritiesVM(ownerModule, decompilerService, ownerType, null); GenericParamsVM = new GenericParamsVM(ownerModule, decompilerService, ownerType, null); InterfaceImplsVM = new TypeDefOrRefAndCAsVM <InterfaceImpl>(dnSpy_AsmEditor_Resources.EditInterfaceImpl, dnSpy_AsmEditor_Resources.CreateInterfaceImpl, ownerModule, decompilerService, ownerType, null); origOptions = options; IsNestedType = (options.Attributes & TypeAttributes.VisibilityMask) > TypeAttributes.Public; TypeKind = new EnumListVM(typeKindList, (a, b) => OnTypeKindChanged()); TypeLayout = new EnumListVM(typeLayoutList, (a, b) => InitializeTypeKind()); TypeSemantics = new EnumListVM(typeSemanticsList, (a, b) => InitializeTypeKind()); PackingSize = new NullableUInt16VM(a => HasErrorUpdated()); ClassSize = new NullableUInt32VM(a => HasErrorUpdated()); Types.TypeVisibility start, end; if (!IsNestedType) { start = Types.TypeVisibility.NotPublic; end = Types.TypeVisibility.Public; } else { start = Types.TypeVisibility.NestedPublic; end = Types.TypeVisibility.NestedFamORAssem; } for (var t = Types.TypeVisibility.NotPublic; t <= Types.TypeVisibility.NestedFamORAssem; t++) { if (t < start || t > end) { TypeVisibility.Items.RemoveAt(TypeVisibility.GetIndex(t)); } } InitializeTypeKind(); TypeSigCreator.CanAddFnPtr = false; Reinitialize(); }
void InitializeFrom(MethodDefOptions options) { ImplAttributes = options.ImplAttributes; Attributes = options.Attributes; Name = options.Name; MethodSig = options.MethodSig; ImplMap = options.ImplMap; CodeType.SelectedItem = (Method.CodeType)((int)(options.ImplAttributes & MethodImplAttributes.CodeTypeMask) >> 0); ManagedType.SelectedItem = (Method.ManagedType)((int)(options.ImplAttributes & MethodImplAttributes.ManagedMask) >> 2); MethodAccess.SelectedItem = (Method.MethodAccess)((int)(options.Attributes & MethodAttributes.MemberAccessMask) >> 0); VtableLayout.SelectedItem = (Method.VtableLayout)((int)(options.Attributes & MethodAttributes.VtableLayoutMask) >> 8); CustomAttributesVM.InitializeFrom(options.CustomAttributes); DeclSecuritiesVM.InitializeFrom(options.DeclSecurities); ParamDefsVM.InitializeFrom(options.ParamDefs); GenericParamsVM.InitializeFrom(options.GenericParameters); MethodOverridesVM.InitializeFrom(options.Overrides); }
public AssemblyOptionsVM(AssemblyOptions options, ModuleDef ownerModule, IDecompilerService decompilerService) { this.ownerModule = ownerModule; origOptions = options; hashAlgorithmVM = new EnumListVM(hashAlgorithmList, (a, b) => OnPropertyChanged(nameof(AssemblyFullName))); contentTypeVM = new EnumListVM(contentTypeList, (a, b) => OnPropertyChanged(nameof(AssemblyFullName))); VersionMajor = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged(nameof(AssemblyFullName)); }, true); VersionMinor = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged(nameof(AssemblyFullName)); }, true); VersionBuild = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged(nameof(AssemblyFullName)); }, true); VersionRevision = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged(nameof(AssemblyFullName)); }, true); PublicKey = new HexStringVM(a => { HasErrorUpdated(); OnPropertyChanged(nameof(AssemblyFullName)); UpdatePublicKeyFlag(); }) { UpperCaseHex = false }; CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); DeclSecuritiesVM = new DeclSecuritiesVM(ownerModule, decompilerService, null, null); Reinitialize(); }
void InitializeFrom(TypeDefOptions options) { Attributes = options.Attributes; Namespace = options.Namespace; Name = options.Name; PackingSize.Value = options.PackingSize; ClassSize.Value = options.ClassSize; BaseTypeSig = options.BaseType.ToTypeSig(); TypeVisibility.SelectedItem = (Types.TypeVisibility)((int)(options.Attributes & TypeAttributes.VisibilityMask) >> 0); TypeLayout.SelectedItem = (Types.TypeLayout)(((int)options.Attributes >> 3) & 3); TypeSemantics.SelectedItem = (Types.TypeSemantics)(((int)options.Attributes >> 5) & 1); TypeStringFormat.SelectedItem = (Types.TypeStringFormat)(((int)options.Attributes >> 16) & 3); TypeCustomFormat.SelectedItem = (Types.TypeCustomFormat)(((int)options.Attributes >> 22) & 3); CustomAttributesVM.InitializeFrom(options.CustomAttributes); DeclSecuritiesVM.InitializeFrom(options.DeclSecurities); GenericParamsVM.InitializeFrom(options.GenericParameters); InterfaceImplsVM.InitializeFrom(options.Interfaces); }
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(); }
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(); }
public TypeOptionsVM(TypeDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType) { this.ownerModule = ownerModule; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) typeSigCreatorOptions.CanAddGenericTypeVar = false; TypeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); TypeSigCreator.PropertyChanged += typeSigCreator_PropertyChanged; CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService, ownerType, null); DeclSecuritiesVM = new DeclSecuritiesVM(ownerModule, decompilerService, ownerType, null); GenericParamsVM = new GenericParamsVM(ownerModule, decompilerService, ownerType, null); InterfaceImplsVM = new TypeDefOrRefAndCAsVM<InterfaceImpl>(dnSpy_AsmEditor_Resources.EditInterfaceImpl, dnSpy_AsmEditor_Resources.CreateInterfaceImpl, ownerModule, decompilerService, ownerType, null); origOptions = options; IsNestedType = (options.Attributes & TypeAttributes.VisibilityMask) > TypeAttributes.Public; TypeKind = new EnumListVM(typeKindList, (a, b) => OnTypeKindChanged()); TypeLayout = new EnumListVM(typeLayoutList, (a, b) => InitializeTypeKind()); TypeSemantics = new EnumListVM(typeSemanticsList, (a, b) => InitializeTypeKind()); PackingSize = new NullableUInt16VM(a => HasErrorUpdated()); ClassSize = new NullableUInt32VM(a => HasErrorUpdated()); Types.TypeVisibility start, end; if (!IsNestedType) { start = Types.TypeVisibility.NotPublic; end = Types.TypeVisibility.Public; } else { start = Types.TypeVisibility.NestedPublic; end = Types.TypeVisibility.NestedFamORAssem; } for (var t = Types.TypeVisibility.NotPublic; t <= Types.TypeVisibility.NestedFamORAssem; t++) { if (t < start || t > end) TypeVisibility.Items.RemoveAt(TypeVisibility.GetIndex(t)); } InitializeTypeKind(); TypeSigCreator.CanAddFnPtr = false; Reinitialize(); }