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 GenericParamVM(GenericParamOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.origOptions = options; this.number = new UInt16VM(a => { OnPropertyChanged("FullName"); HasErrorUpdated(); }); this.typeDefOrRefAndCAsVM = new TypeDefOrRefAndCAsVM <GenericParamConstraint>("Edit Generic Parameter Constraint", "Create Generic Parameter Constraint", ownerModule, language, ownerType, ownerMethod); this.customAttributesVM = new CustomAttributesVM(ownerModule, language); this.gpVarianceVM = new EnumListVM(EnumVM.Create(typeof(GPVariance))); var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) { typeSigCreatorOptions.CanAddGenericMethodVar = true; } this.typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); Reinitialize(); }
public GenericParamVM(GenericParamOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; origOptions = options; Number = new UInt16VM(a => { OnPropertyChanged(nameof(FullName)); HasErrorUpdated(); }); TypeDefOrRefAndCAsVM = new TypeDefOrRefAndCAsVM <GenericParamConstraint>(dnSpy_AsmEditor_Resources.EditGenericParameterConstraint, dnSpy_AsmEditor_Resources.CreateGenericParameterConstraint, ownerModule, decompilerService, ownerType, ownerMethod); CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); GPVarianceVM = new EnumListVM(EnumVM.Create(typeof(GPVariance))); var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) { typeSigCreatorOptions.CanAddGenericTypeVar = false; } if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) { typeSigCreatorOptions.CanAddGenericMethodVar = true; } TypeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); Reinitialize(); }
public ResourceElementVM(ResourceElementOptions options, ModuleDef ownerModule, bool canDeserialize) { origOptions = options; this.canDeserialize = canDeserialize; BooleanVM = new BooleanVM(a => HasErrorUpdated()); CharVM = new CharVM(a => HasErrorUpdated()); ByteVM = new ByteVM(a => HasErrorUpdated()); SByteVM = new SByteVM(a => HasErrorUpdated()); Int16VM = new Int16VM(a => HasErrorUpdated()); UInt16VM = new UInt16VM(a => HasErrorUpdated()); Int32VM = new Int32VM(a => HasErrorUpdated()); UInt32VM = new UInt32VM(a => HasErrorUpdated()); Int64VM = new Int64VM(a => HasErrorUpdated()); UInt64VM = new UInt64VM(a => HasErrorUpdated()); SingleVM = new SingleVM(a => HasErrorUpdated()); DoubleVM = new DoubleVM(a => HasErrorUpdated()); DecimalVM = new DecimalVM(a => HasErrorUpdated()); DateTimeVM = new DateTimeVM(a => HasErrorUpdated()); TimeSpanVM = new TimeSpanVM(a => HasErrorUpdated()); UserTypeVM = new UserTypeVM(ownerModule, canDeserialize); ResourceElementTypeVM = new EnumListVM(resourceElementTypeList, (a, b) => OnResourceElementTypeChanged()); UserTypeVM.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(UserTypeVM.HasError)) { HasErrorUpdated(); } }; Reinitialize(); }
public CilBodyVM(CilBodyOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.ownerMethod = ownerMethod; this.origOptions = options; typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) { CanAddGenericTypeVar = ownerType.HasGenericParameters, CanAddGenericMethodVar = ownerMethod.MethodSig.GetGenParamCount() > 0, OwnerType = ownerType, OwnerMethod = ownerMethod, }; this.localsListVM = new IndexObservableCollection <LocalVM>(() => new LocalVM(typeSigCreatorOptions, new LocalOptions(new Local(ownerModule.CorLibTypes.Int32)))); this.instructionsListVM = new IndexObservableCollection <InstructionVM>(() => CreateInstructionVM()); this.exceptionHandlersListVM = new IndexObservableCollection <ExceptionHandlerVM>(() => new ExceptionHandlerVM(typeSigCreatorOptions, new ExceptionHandlerOptions())); this.LocalsListVM.UpdateIndexesDelegate = LocalsUpdateIndexes; this.InstructionsListVM.UpdateIndexesDelegate = InstructionsUpdateIndexes; this.ExceptionHandlersListVM.UpdateIndexesDelegate = ExceptionHandlersUpdateIndexes; this.InstructionsListVM.CollectionChanged += InstructionsListVM_CollectionChanged; this.LocalsListVM.CollectionChanged += LocalsListVM_CollectionChanged; this.ExceptionHandlersListVM.CollectionChanged += ExceptionHandlersListVM_CollectionChanged; this.maxStack = new UInt16VM(a => CallHasErrorUpdated()); this.localVarSigTok = new UInt32VM(a => CallHasErrorUpdated()); this.headerSize = new ByteVM(a => CallHasErrorUpdated()); this.headerRVA = new UInt32VM(a => CallHasErrorUpdated()); this.headerFileOffset = new UInt64VM(a => CallHasErrorUpdated()); this.rva = new UInt32VM(a => CallHasErrorUpdated()); this.fileOffset = new UInt64VM(a => CallHasErrorUpdated()); Reinitialize(); }
public ResourceElementVM(ResourceElementOptions options, ModuleDef ownerModule, bool canDeserialize) { this.origOptions = options; this.canDeserialize = canDeserialize; this.booleanVM = new BooleanVM(a => HasErrorUpdated()); this.charVM = new CharVM(a => HasErrorUpdated()); this.byteVM = new ByteVM(a => HasErrorUpdated()); this.sbyteVM = new SByteVM(a => HasErrorUpdated()); this.int16VM = new Int16VM(a => HasErrorUpdated()); this.uint16VM = new UInt16VM(a => HasErrorUpdated()); this.int32VM = new Int32VM(a => HasErrorUpdated()); this.uint32VM = new UInt32VM(a => HasErrorUpdated()); this.int64VM = new Int64VM(a => HasErrorUpdated()); this.uint64VM = new UInt64VM(a => HasErrorUpdated()); this.singleVM = new SingleVM(a => HasErrorUpdated()); this.doubleVM = new DoubleVM(a => HasErrorUpdated()); this.decimalVM = new DecimalVM(a => HasErrorUpdated()); this.dateTimeVM = new DateTimeVM(a => HasErrorUpdated()); this.timeSpanVM = new TimeSpanVM(a => HasErrorUpdated()); this.userTypeVM = new UserTypeVM(ownerModule, canDeserialize); this.resourceElementTypeVM = new EnumListVM(resourceElementTypeList, (a, b) => OnResourceElementTypeChanged()); this.UserTypeVM.PropertyChanged += (s, e) => { if (e.PropertyName == "HasError") { HasErrorUpdated(); } }; Reinitialize(); }
public UInt16HexField(HexDocument doc, string parentName, string name, ulong start, bool useDecimal = false) : base(doc, parentName, name, start, 2) { var val = doc.ReadUInt16(start); this.data = new UInt16VM(val, a => UpdateValue()) { UseDecimal = useDecimal }; if (useDecimal) { this.data.Value = val; } }
public ParamDefVM(ParamDefOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.origOptions = options; this.sequence = new UInt16VM(a => { OnPropertyChanged("FullName"); HasErrorUpdated(); }); this.customAttributesVM = new CustomAttributesVM(ownerModule, language); this.constantVM = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, "Default value for this parameter"); ConstantVM.PropertyChanged += constantVM_PropertyChanged; this.marshalTypeVM = new MarshalTypeVM(ownerModule, language, ownerType != null ? ownerType : ownerMethod == null ? null : ownerMethod.DeclaringType, ownerMethod); MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged; ConstantVM.IsEnabled = HasDefault; MarshalTypeVM.IsEnabled = HasFieldMarshal; Reinitialize(); }
public ParamDefVM(ParamDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; origOptions = options; Sequence = new UInt16VM(a => { OnPropertyChanged(nameof(FullName)); HasErrorUpdated(); }); CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); ConstantVM = new ConstantVM(ownerModule, options.Constant?.Value, dnSpy_AsmEditor_Resources.Parameter_DefaultValueInfo); ConstantVM.PropertyChanged += constantVM_PropertyChanged; MarshalTypeVM = new MarshalTypeVM(ownerModule, decompilerService, ownerType != null ? ownerType : ownerMethod?.DeclaringType, ownerMethod); MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged; ConstantVM.IsEnabled = HasDefault; MarshalTypeVM.IsEnabled = HasFieldMarshal; Reinitialize(); }
public ParamDefVM(ParamDefOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.origOptions = options; this.sequence = new UInt16VM(a => { OnPropertyChanged("FullName"); HasErrorUpdated(); }); this.customAttributesVM = new CustomAttributesVM(ownerModule, language); this.constantVM = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, "Default value for this parameter"); ConstantVM.PropertyChanged += constantVM_PropertyChanged; this.marshalTypeVM = new MarshalTypeVM(ownerModule, language, ownerType != null ? ownerType : ownerMethod == null ? null : ownerMethod.DeclaringType, ownerMethod); MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged; ConstantVM.IsEnabled = HasDefault; MarshalTypeVM.IsEnabled = HasFieldMarshal; Reinitialize(); }
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(); }
public GenericParamVM(GenericParamOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.origOptions = options; this.number = new UInt16VM(a => { OnPropertyChanged("FullName"); HasErrorUpdated(); }); this.typeDefOrRefAndCAsVM = new TypeDefOrRefAndCAsVM<GenericParamConstraint>("Edit Generic Parameter Constraint", "Create Generic Parameter Constraint", ownerModule, language, ownerType, ownerMethod); this.customAttributesVM = new CustomAttributesVM(ownerModule, language); this.gpVarianceVM = new EnumListVM(EnumVM.Create(typeof(GPVariance))); var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) typeSigCreatorOptions.CanAddGenericTypeVar = false; if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) typeSigCreatorOptions.CanAddGenericMethodVar = true; this.typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); Reinitialize(); }
public CilBodyVM(CilBodyOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod, bool initialize) { OwnerModule = ownerModule; this.ownerMethod = ownerMethod; origOptions = options; TypeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { CanAddGenericTypeVar = ownerType.HasGenericParameters, CanAddGenericMethodVar = ownerMethod.MethodSig.GetGenParamCount() > 0, OwnerType = ownerType, OwnerMethod = ownerMethod, }; LocalsListVM = new LocalsIndexObservableCollection(this, () => new LocalVM(TypeSigCreatorOptions, new LocalOptions(new Local(ownerModule.CorLibTypes.Int32)))); InstructionsListVM = new IndexObservableCollection <InstructionVM>(() => CreateInstructionVM()); ExceptionHandlersListVM = new IndexObservableCollection <ExceptionHandlerVM>(() => new ExceptionHandlerVM(TypeSigCreatorOptions, new ExceptionHandlerOptions())); LocalsListVM.UpdateIndexesDelegate = LocalsUpdateIndexes; InstructionsListVM.UpdateIndexesDelegate = InstructionsUpdateIndexes; ExceptionHandlersListVM.UpdateIndexesDelegate = ExceptionHandlersUpdateIndexes; InstructionsListVM.CollectionChanged += InstructionsListVM_CollectionChanged; LocalsListVM.CollectionChanged += LocalsListVM_CollectionChanged; ExceptionHandlersListVM.CollectionChanged += ExceptionHandlersListVM_CollectionChanged; MaxStack = new UInt16VM(a => CallHasErrorUpdated()); LocalVarSigTok = new UInt32VM(a => CallHasErrorUpdated()); HeaderSize = new ByteVM(a => CallHasErrorUpdated()); HeaderRVA = new UInt32VM(a => CallHasErrorUpdated()); HeaderFileOffset = new UInt64VM(a => CallHasErrorUpdated()); RVA = new UInt32VM(a => CallHasErrorUpdated()); FileOffset = new UInt64VM(a => CallHasErrorUpdated()); if (initialize) { Reinitialize(); } }
public UInt16HexField(UInt16Data data, string fieldName, bool useDecimal = false) : base(data, fieldName) { this.data = new UInt16VM(buffer.ReadUInt16(Span.Start), a => UpdateValue(), useDecimal); }
public UInt16HexField(HexDocument doc, string parentName, string name, ulong start, bool useDecimal = false) : base(doc, parentName, name, start, 2) { this.data = new UInt16VM(doc.ReadUInt16(start), a => UpdateValue(), useDecimal); }
public UInt16FlagsHexField(HexDocument doc, string parentName, string name, ulong start) : base(doc, parentName, name, start, 2) { this.data = new UInt16VM(doc.ReadUInt16(start), a => UpdateValue(), false); }
public UInt16HexField(HexDocument doc, string parentName, string name, ulong start, bool useDecimal = false) : base(doc, parentName, name, start, 2) { var val = doc.ReadUInt16(start); this.data = new UInt16VM(val, a => UpdateValue()) { UseDecimal = useDecimal }; if (useDecimal) this.data.Value = val; }
public ConstantTypeVM(ModuleDef ownerModule, object value, ConstantType[] validConstants, bool allowNullString, bool arraysCanBeNull, TypeSigCreatorOptions options = null) { if (options == null) { IList<ConstantType> clist = validConstants; if (clist.IndexOf(ConstantType.Type) >= 0 || clist.IndexOf(ConstantType.TypeArray) >= 0 || clist.IndexOf(ConstantType.ObjectArray) >= 0) { throw new ArgumentNullException(); } } this.arraysCanBeNull = arraysCanBeNull; var list = validConstants.Select(a => typeToEnumVM[a]); this.constantTypeEnumListVM = new EnumListVM(list, (a, b) => OnConstantChanged()); this.boolean = new BooleanVM(a => FieldUpdated()); this.@char = new CharVM(a => FieldUpdated()); this.@sbyte = new SByteVM(a => FieldUpdated()); this.@byte = new ByteVM(a => FieldUpdated()); this.int16 = new Int16VM(a => FieldUpdated()); this.uint16 = new UInt16VM(a => FieldUpdated()); this.int32 = new Int32VM(a => FieldUpdated()); this.uint32 = new UInt32VM(a => FieldUpdated()); this.int64 = new Int64VM(a => FieldUpdated()); this.uint64 = new UInt64VM(a => FieldUpdated()); this.single = new SingleVM(a => FieldUpdated()); this.@double = new DoubleVM(a => FieldUpdated()); this.@string = new StringVM(a => FieldUpdated(), allowNullString); this.@enum = new EnumDataFieldVM(ownerModule, a => FieldUpdated()); this.type = new TypeSigVM(a => FieldUpdated(), options); this.objectArray = new ObjectListDataFieldVM(ownerModule, a => FieldUpdated(), options); this.booleanArray = new BooleanListDataFieldVM(a => FieldUpdated()); this.charArray = new CharListDataFieldVM(a => FieldUpdated()); this.sbyteArray = new SByteListDataFieldVM(a => FieldUpdated()); this.byteArray = new ByteListDataFieldVM(a => FieldUpdated()); this.int16Array = new Int16ListDataFieldVM(a => FieldUpdated()); this.uint16Array = new UInt16ListDataFieldVM(a => FieldUpdated()); this.int32Array = new Int32ListDataFieldVM(a => FieldUpdated()); this.uint32Array = new UInt32ListDataFieldVM(a => FieldUpdated()); this.int64Array = new Int64ListDataFieldVM(a => FieldUpdated()); this.uint64Array = new UInt64ListDataFieldVM(a => FieldUpdated()); this.singleArray = new SingleListDataFieldVM(a => FieldUpdated()); this.doubleArray = new DoubleListDataFieldVM(a => FieldUpdated()); this.stringArray = new StringListDataFieldVM(a => FieldUpdated()); this.enumArray = new EnumListDataFieldVM(ownerModule, a => FieldUpdated()); this.typeArray = new TypeSigListDataFieldVM(a => FieldUpdated(), options); this.Value = value; }
public ResourceElementVM(ResourceElementOptions options, ModuleDef ownerModule, bool canDeserialize) { origOptions = options; this.canDeserialize = canDeserialize; BooleanVM = new BooleanVM(a => HasErrorUpdated()); CharVM = new CharVM(a => HasErrorUpdated()); ByteVM = new ByteVM(a => HasErrorUpdated()); SByteVM = new SByteVM(a => HasErrorUpdated()); Int16VM = new Int16VM(a => HasErrorUpdated()); UInt16VM = new UInt16VM(a => HasErrorUpdated()); Int32VM = new Int32VM(a => HasErrorUpdated()); UInt32VM = new UInt32VM(a => HasErrorUpdated()); Int64VM = new Int64VM(a => HasErrorUpdated()); UInt64VM = new UInt64VM(a => HasErrorUpdated()); SingleVM = new SingleVM(a => HasErrorUpdated()); DoubleVM = new DoubleVM(a => HasErrorUpdated()); DecimalVM = new DecimalVM(a => HasErrorUpdated()); DateTimeVM = new DateTimeVM(a => HasErrorUpdated()); TimeSpanVM = new TimeSpanVM(a => HasErrorUpdated()); UserTypeVM = new UserTypeVM(ownerModule, canDeserialize); ResourceElementTypeVM = new EnumListVM(resourceElementTypeList, (a, b) => OnResourceElementTypeChanged()); UserTypeVM.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(UserTypeVM.HasError)) HasErrorUpdated(); }; Reinitialize(); }
public ParamDefVM(ParamDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; origOptions = options; Sequence = new UInt16VM(a => { OnPropertyChanged(nameof(FullName)); HasErrorUpdated(); }); CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); ConstantVM = new ConstantVM(ownerModule, options.Constant?.Value, dnSpy_AsmEditor_Resources.Parameter_DefaultValueInfo); ConstantVM.PropertyChanged += constantVM_PropertyChanged; MarshalTypeVM = new MarshalTypeVM(ownerModule, decompilerService, ownerType != null ? ownerType : ownerMethod?.DeclaringType, ownerMethod); MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged; ConstantVM.IsEnabled = HasDefault; MarshalTypeVM.IsEnabled = HasFieldMarshal; Reinitialize(); }
public UInt16HexField(HexBuffer buffer, string parentName, string name, HexPosition start, bool useDecimal = false) : base(buffer, parentName, name, start, 2) { data = new UInt16VM(buffer.ReadUInt16(start), a => UpdateValue(), useDecimal); }
public UInt16FlagsHexField(HexBuffer buffer, string parentName, string name, HexPosition start) : base(buffer, parentName, name, start, 2) { data = new UInt16VM(buffer.ReadUInt16(start), a => UpdateValue(), false); }
public GenericParamVM(GenericParamOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; origOptions = options; Number = new UInt16VM(a => { OnPropertyChanged(nameof(FullName)); HasErrorUpdated(); }); TypeDefOrRefAndCAsVM = new TypeDefOrRefAndCAsVM<GenericParamConstraint>(dnSpy_AsmEditor_Resources.EditGenericParameterConstraint, dnSpy_AsmEditor_Resources.CreateGenericParameterConstraint, ownerModule, decompilerService, ownerType, ownerMethod); CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); GPVarianceVM = new EnumListVM(EnumVM.Create(typeof(GPVariance))); var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerService) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) typeSigCreatorOptions.CanAddGenericTypeVar = false; if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) typeSigCreatorOptions.CanAddGenericMethodVar = true; TypeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); Reinitialize(); }
public UInt16HexField(HexDocument doc, string parentName, string name, ulong start, bool useDecimal = false) : base(doc, parentName, name, start, 2) { this.data = new UInt16VM(doc.ReadUInt16(start), a => UpdateValue(), useDecimal); }
public ResourceElementVM(ResourceElementOptions options, ModuleDef ownerModule, bool canDeserialize) { this.origOptions = options; this.canDeserialize = canDeserialize; this.booleanVM = new BooleanVM(a => HasErrorUpdated()); this.charVM = new CharVM(a => HasErrorUpdated()); this.byteVM = new ByteVM(a => HasErrorUpdated()); this.sbyteVM = new SByteVM(a => HasErrorUpdated()); this.int16VM = new Int16VM(a => HasErrorUpdated()); this.uint16VM = new UInt16VM(a => HasErrorUpdated()); this.int32VM = new Int32VM(a => HasErrorUpdated()); this.uint32VM = new UInt32VM(a => HasErrorUpdated()); this.int64VM = new Int64VM(a => HasErrorUpdated()); this.uint64VM = new UInt64VM(a => HasErrorUpdated()); this.singleVM = new SingleVM(a => HasErrorUpdated()); this.doubleVM = new DoubleVM(a => HasErrorUpdated()); this.decimalVM = new DecimalVM(a => HasErrorUpdated()); this.dateTimeVM = new DateTimeVM(a => HasErrorUpdated()); this.timeSpanVM = new TimeSpanVM(a => HasErrorUpdated()); this.userTypeVM = new UserTypeVM(ownerModule, canDeserialize); this.resourceElementTypeVM = new EnumListVM(resourceElementTypeList, (a, b) => OnResourceElementTypeChanged()); this.UserTypeVM.PropertyChanged += (s, e) => { if (e.PropertyName == "HasError") HasErrorUpdated(); }; Reinitialize(); }
public UInt16HexField(StructField <UInt16Data> field, bool useDecimal = false) : base(field) { data = new UInt16VM(buffer.ReadUInt16(Span.Start), a => UpdateValue(), useDecimal); }
public CilBodyVM(CilBodyOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.ownerMethod = ownerMethod; this.origOptions = options; typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) { CanAddGenericTypeVar = ownerType.HasGenericParameters, CanAddGenericMethodVar = ownerMethod.MethodSig.GetGenParamCount() > 0, OwnerType = ownerType, OwnerMethod = ownerMethod, }; this.localsListVM = new IndexObservableCollection<LocalVM>(() => new LocalVM(typeSigCreatorOptions, new LocalOptions(new Local(ownerModule.CorLibTypes.Int32)))); this.instructionsListVM = new IndexObservableCollection<InstructionVM>(() => CreateInstructionVM()); this.exceptionHandlersListVM = new IndexObservableCollection<ExceptionHandlerVM>(() => new ExceptionHandlerVM(typeSigCreatorOptions, new ExceptionHandlerOptions())); this.LocalsListVM.UpdateIndexesDelegate = LocalsUpdateIndexes; this.InstructionsListVM.UpdateIndexesDelegate = InstructionsUpdateIndexes; this.ExceptionHandlersListVM.UpdateIndexesDelegate = ExceptionHandlersUpdateIndexes; this.InstructionsListVM.CollectionChanged += InstructionsListVM_CollectionChanged; this.LocalsListVM.CollectionChanged += LocalsListVM_CollectionChanged; this.ExceptionHandlersListVM.CollectionChanged += ExceptionHandlersListVM_CollectionChanged; this.maxStack = new UInt16VM(a => CallHasErrorUpdated()); this.localVarSigTok = new UInt32VM(a => CallHasErrorUpdated()); this.headerSize = new ByteVM(a => CallHasErrorUpdated()); this.headerRVA = new UInt32VM(a => CallHasErrorUpdated()); this.headerFileOffset = new UInt64VM(a => CallHasErrorUpdated()); this.rva = new UInt32VM(a => CallHasErrorUpdated()); this.fileOffset = new UInt64VM(a => CallHasErrorUpdated()); Reinitialize(); }
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 UInt16HexField(HexBuffer buffer, string parentName, string name, HexPosition start, bool useDecimal = false) : base(buffer, parentName, name, start, 2) { data = new UInt16VM(buffer.ReadUInt16(start), a => UpdateValue(), useDecimal); }
public UInt16FlagsHexField(StructField <UInt16EnumData> field) : base(field) { data = new UInt16VM(buffer.ReadUInt16(Span.Start), a => UpdateValue(), false); }
public UInt16FlagsHexField(HexBuffer buffer, string parentName, string name, HexPosition start) : base(buffer, parentName, name, start, 2) { data = new UInt16VM(buffer.ReadUInt16(start), a => UpdateValue(), false); }
public UInt16FlagsHexField(HexDocument doc, string parentName, string name, ulong start) : base(doc, parentName, name, start, 2) { this.data = new UInt16VM(doc.ReadUInt16(start), a => UpdateValue(), false); }
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(); }