Beispiel #1
0
 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());
 }
Beispiel #2
0
 public ModuleOptionsVM(ModuleDef module, ModuleOptions options, IDecompilerService decompilerService)
 {
     this.module      = module;
     this.options     = new ModuleOptions();
     this.origOptions = options;
     ModuleKind       = new EnumListVM(SaveModule.SaveModuleOptionsVM.moduleKindList, (a, b) => {
         Characteristics = SaveModule.CharacteristicsHelper.GetCharacteristics(Characteristics, (dnlib.DotNet.ModuleKind)ModuleKind.SelectedItem);
     });
     this.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();
 }
Beispiel #3
0
 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();
 }
Beispiel #4
0
		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();
		}
Beispiel #5
0
		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();
		}
Beispiel #6
0
 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();
 }
Beispiel #7
0
 public Cor20HeaderOptionsVM()
 {
     MajorRuntimeVersion = new NullableUInt16VM(a => HasErrorUpdated());
     MinorRuntimeVersion = new NullableUInt16VM(a => HasErrorUpdated());
     EntryPoint          = new NullableUInt32VM(a => HasErrorUpdated());
 }
Beispiel #8
0
 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());
 }
Beispiel #9
0
 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 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 Cor20HeaderOptionsVM() {
			MajorRuntimeVersion = new NullableUInt16VM(a => HasErrorUpdated());
			MinorRuntimeVersion = new NullableUInt16VM(a => HasErrorUpdated());
			EntryPoint = new NullableUInt32VM(a => HasErrorUpdated());
		}