public PEHeadersOptionsVM(Machine defaultMachine, Subsystem defaultSubsystem) { this.defaultMachine = defaultMachine; this.defaultSubsystem = defaultSubsystem; Machine = new EnumListVM(machineList, (a, b) => { Characteristics = CharacteristicsHelper.GetCharacteristics(Characteristics ?? 0, (dnlib.PE.Machine)Machine.SelectedItem); }); TimeDateStamp = new NullableUInt32VM(a => HasErrorUpdated()); PointerToSymbolTable = new NullableUInt32VM(a => HasErrorUpdated()); NumberOfSymbols = new NullableUInt32VM(a => HasErrorUpdated()); MajorLinkerVersion = new NullableByteVM(a => HasErrorUpdated()); MinorLinkerVersion = new NullableByteVM(a => HasErrorUpdated()); ImageBase = new NullableUInt64VM(a => HasErrorUpdated()); SectionAlignment = new NullableUInt32VM(a => HasErrorUpdated()); FileAlignment = new NullableUInt32VM(a => HasErrorUpdated()); MajorOperatingSystemVersion = new NullableUInt16VM(a => HasErrorUpdated()); MinorOperatingSystemVersion = new NullableUInt16VM(a => HasErrorUpdated()); MajorImageVersion = new NullableUInt16VM(a => HasErrorUpdated()); MinorImageVersion = new NullableUInt16VM(a => HasErrorUpdated()); MajorSubsystemVersion = new NullableUInt16VM(a => HasErrorUpdated()); MinorSubsystemVersion = new NullableUInt16VM(a => HasErrorUpdated()); Win32VersionValue = new NullableUInt32VM(a => HasErrorUpdated()); SizeOfStackReserve = new NullableUInt64VM(a => HasErrorUpdated()); SizeOfStackCommit = new NullableUInt64VM(a => HasErrorUpdated()); SizeOfHeapReserve = new NullableUInt64VM(a => HasErrorUpdated()); SizeOfHeapCommit = new NullableUInt64VM(a => HasErrorUpdated()); LoaderFlags = new NullableUInt32VM(a => HasErrorUpdated()); NumberOfRvaAndSizes = new NullableUInt32VM(a => HasErrorUpdated()); }
public Cor20HeaderOptionsVM(Action onUpdated) { this.onUpdated = onUpdated; this.majorRuntimeVersion = new NullableUInt16VM(a => HasErrorUpdated()); this.minorRuntimeVersion = new NullableUInt16VM(a => HasErrorUpdated()); this.entryPoint = new NullableUInt32VM(a => HasErrorUpdated()); }
public TablesHeapOptionsVM() { Reserved1 = new NullableUInt32VM(a => HasErrorUpdated()); MajorVersion = new NullableByteVM(a => HasErrorUpdated()); MinorVersion = new NullableByteVM(a => HasErrorUpdated()); ExtraData = new NullableUInt32VM(a => HasErrorUpdated()); }
public MetaDataHeaderOptionsVM() { Signature = new NullableUInt32VM(a => HasErrorUpdated()); MajorVersion = new NullableUInt16VM(a => HasErrorUpdated()); MinorVersion = new NullableUInt16VM(a => HasErrorUpdated()); Reserved1 = new NullableUInt32VM(a => HasErrorUpdated()); StorageFlags = new NullableByteVM(a => HasErrorUpdated()); Reserved2 = new NullableByteVM(a => HasErrorUpdated()); }
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(); }
public ModuleOptionsVM(ModuleDef module, ModuleOptions options, ILanguageManager languageManager) { this.module = module; this.options = new ModuleOptions(); this.origOptions = options; moduleKindVM = new EnumListVM(SaveModule.SaveModuleOptionsVM.moduleKindList, (a, b) => { Characteristics = SaveModule.CharacteristicsHelper.GetCharacteristics(Characteristics, (dnlib.DotNet.ModuleKind)ModuleKind.SelectedItem); }); this.machineVM = new EnumListVM(SaveModule.PEHeadersOptionsVM.machineList, (a, b) => { Characteristics = SaveModule.CharacteristicsHelper.GetCharacteristics(Characteristics, (dnlib.PE.Machine)Machine.SelectedItem); }); mvid = new NullableGuidVM(a => HasErrorUpdated()); encId = new NullableGuidVM(a => HasErrorUpdated()); encBaseId = new NullableGuidVM(a => HasErrorUpdated()); clrVersionVM = new EnumListVM(NetModuleOptionsVM.clrVersionList, (a, b) => OnClrVersionChanged()); clrVersionVM.Items.Add(new EnumVM(Module.ClrVersion.Unknown, dnSpy_AsmEditor_Resources.Unknown)); clrVersionVM.SelectedItem = Module.ClrVersion.Unknown; cor20HeaderRuntimeVersion = new NullableUInt32VM(a => { HasErrorUpdated(); UpdateClrVersion(); }); tablesHeaderVersion = new NullableUInt16VM(a => { HasErrorUpdated(); UpdateClrVersion(); }); nativeEntryPointRva = new UInt32VM(a => HasErrorUpdated()); customAttributesVM = new CustomAttributesVM(module, languageManager); Reinitialize(); }
public FieldOptionsVM(FieldDefOptions 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); origOptions = options; ConstantVM = new ConstantVM(ownerModule, options.Constant?.Value, dnSpy_AsmEditor_Resources.Field_DefaultValueInfo); ConstantVM.PropertyChanged += constantVM_PropertyChanged; MarshalTypeVM = new MarshalTypeVM(ownerModule, decompilerService, ownerType, null); MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged; FieldOffset = new NullableUInt32VM(a => HasErrorUpdated()); InitialValue = new HexStringVM(a => HasErrorUpdated()); RVA = new UInt32VM(a => HasErrorUpdated()); ImplMapVM = new ImplMapVM(ownerModule); ImplMapVM.PropertyChanged += implMapVM_PropertyChanged; TypeSigCreator.CanAddFnPtr = false; ConstantVM.IsEnabled = HasDefault; MarshalTypeVM.IsEnabled = HasFieldMarshal; ImplMapVM.IsEnabled = PinvokeImpl; Reinitialize(); }
public FieldOptionsVM(FieldDefOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType) { this.ownerModule = ownerModule; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } this.typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); TypeSigCreator.PropertyChanged += typeSigCreator_PropertyChanged; this.customAttributesVM = new CustomAttributesVM(ownerModule, language); this.origOptions = options; this.constantVM = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, "Default value for this field"); ConstantVM.PropertyChanged += constantVM_PropertyChanged; this.marshalTypeVM = new MarshalTypeVM(ownerModule, language, ownerType, null); MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged; this.fieldOffset = new NullableUInt32VM(a => HasErrorUpdated()); this.initialValue = new HexStringVM(a => HasErrorUpdated()); this.rva = new UInt32VM(a => HasErrorUpdated()); this.implMapVM = new ImplMapVM(ownerModule); ImplMapVM.PropertyChanged += implMapVM_PropertyChanged; this.typeSigCreator.CanAddFnPtr = false; ConstantVM.IsEnabled = HasDefault; MarshalTypeVM.IsEnabled = HasFieldMarshal; 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(); }
public FieldOptionsVM(FieldDefOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType) { this.ownerModule = ownerModule; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) typeSigCreatorOptions.CanAddGenericTypeVar = false; this.typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); TypeSigCreator.PropertyChanged += typeSigCreator_PropertyChanged; this.customAttributesVM = new CustomAttributesVM(ownerModule, language); this.origOptions = options; this.constantVM = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, "Default value for this field"); ConstantVM.PropertyChanged += constantVM_PropertyChanged; this.marshalTypeVM = new MarshalTypeVM(ownerModule, language, ownerType, null); MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged; this.fieldOffset = new NullableUInt32VM(a => HasErrorUpdated()); this.initialValue = new HexStringVM(a => HasErrorUpdated()); this.rva = new UInt32VM(a => HasErrorUpdated()); this.implMapVM = new ImplMapVM(ownerModule); ImplMapVM.PropertyChanged += implMapVM_PropertyChanged; this.typeSigCreator.CanAddFnPtr = false; ConstantVM.IsEnabled = HasDefault; MarshalTypeVM.IsEnabled = HasFieldMarshal; ImplMapVM.IsEnabled = PinvokeImpl; Reinitialize(); }
public ModuleOptionsVM(ModuleDef module, ModuleOptions options, Language language) { this.module = module; this.options = new ModuleOptions(); this.origOptions = options; moduleKindVM = new EnumListVM(SaveModule.SaveModuleOptionsVM.moduleKindList, (a, b) => { Characteristics = SaveModule.CharacteristicsHelper.GetCharacteristics(Characteristics, (dnlib.DotNet.ModuleKind)ModuleKind.SelectedItem); }); this.machineVM = new EnumListVM(SaveModule.PEHeadersOptionsVM.machineList, (a, b) => { Characteristics = SaveModule.CharacteristicsHelper.GetCharacteristics(Characteristics, (dnlib.PE.Machine)Machine.SelectedItem); }); mvid = new NullableGuidVM(a => HasErrorUpdated()); encId = new NullableGuidVM(a => HasErrorUpdated()); encBaseId = new NullableGuidVM(a => HasErrorUpdated()); clrVersionVM = new EnumListVM(NetModuleOptionsVM.clrVersionList, (a, b) => OnClrVersionChanged()); clrVersionVM.Items.Add(new EnumVM(Module.ClrVersion.Unknown, "Unknown")); clrVersionVM.SelectedItem = Module.ClrVersion.Unknown; cor20HeaderRuntimeVersion = new NullableUInt32VM(a => { HasErrorUpdated(); UpdateClrVersion(); }); tablesHeaderVersion = new NullableUInt16VM(a => { HasErrorUpdated(); UpdateClrVersion(); }); nativeEntryPointRva = new UInt32VM(a => HasErrorUpdated()); customAttributesVM = new CustomAttributesVM(module, language); Reinitialize(); }
public FieldOptionsVM(FieldDefOptions 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); origOptions = options; ConstantVM = new ConstantVM(ownerModule, options.Constant?.Value, dnSpy_AsmEditor_Resources.Field_DefaultValueInfo); ConstantVM.PropertyChanged += constantVM_PropertyChanged; MarshalTypeVM = new MarshalTypeVM(ownerModule, decompilerService, ownerType, null); MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged; FieldOffset = new NullableUInt32VM(a => HasErrorUpdated()); InitialValue = new HexStringVM(a => HasErrorUpdated()); RVA = new UInt32VM(a => HasErrorUpdated()); ImplMapVM = new ImplMapVM(ownerModule); ImplMapVM.PropertyChanged += implMapVM_PropertyChanged; TypeSigCreator.CanAddFnPtr = false; ConstantVM.IsEnabled = HasDefault; MarshalTypeVM.IsEnabled = HasFieldMarshal; ImplMapVM.IsEnabled = PinvokeImpl; Reinitialize(); }
public PEHeadersOptionsVM(Machine defaultMachine, Subsystem defaultSubsystem) { this.defaultMachine = defaultMachine; this.defaultSubsystem = defaultSubsystem; this.machineVM = new EnumListVM(machineList, (a, b) => { Characteristics = CharacteristicsHelper.GetCharacteristics(Characteristics ?? 0, (dnlib.PE.Machine)Machine.SelectedItem); }); this.timeDateStamp = new NullableUInt32VM(a => HasErrorUpdated()); this.majorLinkerVersion = new NullableByteVM(a => HasErrorUpdated()); this.minorLinkerVersion = new NullableByteVM(a => HasErrorUpdated()); this.imageBase = new NullableUInt64VM(a => HasErrorUpdated()); this.sectionAlignment = new NullableUInt32VM(a => HasErrorUpdated()); this.fileAlignment = new NullableUInt32VM(a => HasErrorUpdated()); this.majorOperatingSystemVersion = new NullableUInt16VM(a => HasErrorUpdated()); this.minorOperatingSystemVersion = new NullableUInt16VM(a => HasErrorUpdated()); this.majorImageVersion = new NullableUInt16VM(a => HasErrorUpdated()); this.minorImageVersion = new NullableUInt16VM(a => HasErrorUpdated()); this.majorSubsystemVersion = new NullableUInt16VM(a => HasErrorUpdated()); this.minorSubsystemVersion = new NullableUInt16VM(a => HasErrorUpdated()); this.win32VersionValue = new NullableUInt32VM(a => HasErrorUpdated()); this.sizeOfStackReserve = new NullableUInt64VM(a => HasErrorUpdated()); this.sizeOfStackCommit = new NullableUInt64VM(a => HasErrorUpdated()); this.sizeOfHeapReserve = new NullableUInt64VM(a => HasErrorUpdated()); this.sizeOfHeapCommit = new NullableUInt64VM(a => HasErrorUpdated()); this.loaderFlags = new NullableUInt32VM(a => HasErrorUpdated()); this.numberOfRvaAndSizes = new NullableUInt32VM(a => HasErrorUpdated()); }
public MetaDataHeaderOptionsVM() { this.signature = new NullableUInt32VM(a => HasErrorUpdated()); this.majorVersion = new NullableUInt16VM(a => HasErrorUpdated()); this.minorVersion = new NullableUInt16VM(a => HasErrorUpdated()); this.reserved1 = new NullableUInt32VM(a => HasErrorUpdated()); this.storageFlags = new NullableByteVM(a => HasErrorUpdated()); this.reserved2 = new NullableByteVM(a => HasErrorUpdated()); }
public TablesHeapOptionsVM() { this.reserved1 = new NullableUInt32VM(a => HasErrorUpdated()); this.majorVersion = new NullableByteVM(a => HasErrorUpdated()); this.minorVersion = new NullableByteVM(a => HasErrorUpdated()); this.extraData = new NullableUInt32VM(a => HasErrorUpdated()); }
public ModuleOptionsVM(ModuleDef module, ModuleOptions options, IDecompilerService decompilerService) { this.module = module; this.options = new ModuleOptions(); origOptions = options; ModuleKind = new EnumListVM(SaveModule.SaveModuleOptionsVM.moduleKindList, (a, b) => { Characteristics = SaveModule.CharacteristicsHelper.GetCharacteristics(Characteristics, (dnlib.DotNet.ModuleKind)ModuleKind.SelectedItem); }); Machine = new EnumListVM(SaveModule.PEHeadersOptionsVM.machineList, (a, b) => { Characteristics = SaveModule.CharacteristicsHelper.GetCharacteristics(Characteristics, (dnlib.PE.Machine)Machine.SelectedItem); }); Mvid = new NullableGuidVM(a => HasErrorUpdated()); EncId = new NullableGuidVM(a => HasErrorUpdated()); EncBaseId = new NullableGuidVM(a => HasErrorUpdated()); ClrVersion = new EnumListVM(NetModuleOptionsVM.clrVersionList, (a, b) => OnClrVersionChanged()); ClrVersion.Items.Add(new EnumVM(Module.ClrVersion.Unknown, dnSpy_AsmEditor_Resources.Unknown)); ClrVersion.SelectedItem = Module.ClrVersion.Unknown; Cor20HeaderRuntimeVersion = new NullableUInt32VM(a => { HasErrorUpdated(); UpdateClrVersion(); }); TablesHeaderVersion = new NullableUInt16VM(a => { HasErrorUpdated(); UpdateClrVersion(); }); NativeEntryPointRva = new UInt32VM(a => HasErrorUpdated()); CustomAttributesVM = new CustomAttributesVM(module, decompilerService); Reinitialize(); }
public Cor20HeaderOptionsVM() { MajorRuntimeVersion = new NullableUInt16VM(a => HasErrorUpdated()); MinorRuntimeVersion = new NullableUInt16VM(a => HasErrorUpdated()); EntryPoint = new NullableUInt32VM(a => HasErrorUpdated()); }