public CreateTypeSigArrayVM(TypeSigCreatorOptions options, int? requiredCount) { this.title = options.Title; this.typeSigCreator = new TypeSigCreatorVM(options); this.RequiredCount = requiredCount; this.TypeSigCollection.CollectionChanged += (s, e) => UpdateNumberLeftProperties(); }
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(); }
public LocalVM(TypeSigCreatorOptions typeSigCreatorOptions, LocalOptions options) { this.typeSigCreatorOptions = typeSigCreatorOptions.Clone("Create a Local Type"); this.typeSigCreatorOptions.IsLocal = true; this.typeSigCreatorOptions.NullTypeSigAllowed = false; this.origOptions = options; Reinitialize(); }
public TypeSig[] Create(TypeSigCreatorOptions options, int? count, TypeSig[] typeSigs) { var data = new CreateTypeSigArrayVM(options, count); if (typeSigs != null) data.TypeSigCollection.AddRange(typeSigs); var win = new CreateTypeSigArrayDlg(); win.DataContext = data; win.Owner = ownerWindow ?? Application.Current.MainWindow; if (win.ShowDialog() != true) return null; return data.TypeSigArray; }
public MethodSpecVM(MethodSpecOptions options, TypeSigCreatorOptions typeSigCreatorOptions) { origOptions = options; this.typeSigCreatorOptions = typeSigCreatorOptions; CustomAttributesVM = new CustomAttributesVM(typeSigCreatorOptions.OwnerModule, typeSigCreatorOptions.DecompilerService); this.typeSigCreatorOptions.CanAddGenericMethodVar = true; this.typeSigCreatorOptions.CanAddGenericTypeVar = true; this.typeSigCreatorOptions.IsLocal = false; this.typeSigCreatorOptions.NullTypeSigAllowed = false; CreateTypeSigArrayVM = new CreateTypeSigArrayVM(typeSigCreatorOptions, null); Reinitialize(); }
public TypeSig Create(TypeSigCreatorOptions options, TypeSig typeSig, out bool canceled) { var data = new TypeSigCreatorVM(options, typeSig); data.TypeSig = typeSig; var win = new TypeSigCreatorDlg(); win.DataContext = data; win.Owner = ownerWindow ?? MainWindow.Instance; if (win.ShowDialog() != true) { canceled = true; return null; } canceled = false; return data.TypeSig; }
public MethodSpecVM(MethodSpecOptions options, TypeSigCreatorOptions typeSigCreatorOptions) { this.origOptions = options; this.typeSigCreatorOptions = typeSigCreatorOptions; this.customAttributesVM = new CustomAttributesVM(typeSigCreatorOptions.OwnerModule, typeSigCreatorOptions.LanguageManager); this.typeSigCreatorOptions.CanAddGenericMethodVar = true; this.typeSigCreatorOptions.CanAddGenericTypeVar = true; this.typeSigCreatorOptions.IsLocal = false; this.typeSigCreatorOptions.NullTypeSigAllowed = false; this.createTypeSigArrayVM = new CreateTypeSigArrayVM(typeSigCreatorOptions, null); Reinitialize(); }
public ExceptionHandlerVM(TypeSigCreatorOptions typeSigCreatorOptions, ExceptionHandlerOptions options) { this.typeSigCreatorOptions = typeSigCreatorOptions.Clone(dnSpy_AsmEditor_Resources.CreateAnExceptionCatchType); this.typeSigCreatorOptions.IsLocal = false; this.typeSigCreatorOptions.NullTypeSigAllowed = true; origOptions = options; HandlerTypeVM = new EnumListVM(exceptionHandlerTypeList); TryStartVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction }; TryEndVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction }; FilterStartVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction }; HandlerStartVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction }; HandlerEndVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction }; Reinitialize(); }
public object Create(ModuleDef ownerModule, object value, ConstantType[] validConstants, bool allowNullString, bool arraysCanBeNull, TypeSigCreatorOptions options, out object resultNoSpecialNull, out bool canceled) { var data = new ConstantTypeVM(ownerModule, value, validConstants ?? DefaultConstants, true, true, options); var win = new ConstantTypeDlg(); win.DataContext = data; win.Owner = ownerWindow ?? Application.Current.MainWindow; if (win.ShowDialog() != true) { canceled = true; resultNoSpecialNull = null; return null; } canceled = false; resultNoSpecialNull = data.ValueNoSpecialNull; return data.Value; }
public ExceptionHandlerVM(TypeSigCreatorOptions typeSigCreatorOptions, ExceptionHandlerOptions options) { this.typeSigCreatorOptions = typeSigCreatorOptions.Clone("Create an Exception Catch Type"); this.typeSigCreatorOptions.IsLocal = false; this.typeSigCreatorOptions.NullTypeSigAllowed = true; this.origOptions = options; this.handlerTypeVM = new EnumListVM(exceptionHandlerTypeList); this.tryStartVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction }; this.tryEndVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction }; this.filterStartVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction }; this.handlerStartVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction }; this.handlerEndVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction }; Reinitialize(); }
public TypeSigCreatorVM(TypeSigCreatorOptions options, TypeSig defaultTypeSig = null) { this.options = options.Clone(); this.defaultTypeSig = defaultTypeSig; this.arrayRank = new UInt32VM(2, a => { }); this.arraySizes = new UInt32ListDataFieldVM(a => { }) { Min = ModelUtils.COMPRESSED_UINT32_MIN, Max = ModelUtils.COMPRESSED_UINT32_MAX, }; this.arrayLowerBounds = new Int32ListDataFieldVM(a => { }) { Min = ModelUtils.COMPRESSED_INT32_MIN, Max = ModelUtils.COMPRESSED_INT32_MAX, }; this.genericVariableNumber = new UInt32VM(0, a => { }); Reinitialize(); }
public TypeDefOrRefAndCAVM(TypeDefOrRefAndCAOptions options, ModuleDef ownerModule, ILanguageManager languageManager, TypeDef ownerType, MethodDef ownerMethod) { this.origOptions = options; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, languageManager) { 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); TypeSigCreator.PropertyChanged += TypeSigCreator_PropertyChanged; this.customAttributesVM = new CustomAttributesVM(ownerModule, languageManager); Reinitialize(); }
public TypeDefOrRefAndCAVM(TypeDefOrRefAndCAOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { origOptions = options; 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); TypeSigCreator.PropertyChanged += TypeSigCreator_PropertyChanged; CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); Reinitialize(); }
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(); }
public EventOptionsVM(EventDefOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType) { this.ownerModule = ownerModule; var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = true, OwnerType = ownerType, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) typeSigCreatorOptions.CanAddGenericTypeVar = false; this.typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); this.typeSigCreator.PropertyChanged += typeSigCreator_PropertyChanged; this.customAttributesVM = new CustomAttributesVM(ownerModule, language); this.otherMethodsVM = new MethodDefsVM(ownerModule, language); this.origOptions = options; this.typeSigCreator.CanAddFnPtr = false; Reinitialize(); }
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.DecompilerManager); this.typeSigCreatorOptions.CanAddGenericMethodVar = true; this.typeSigCreatorOptions.CanAddGenericTypeVar = true; this.typeSigCreatorOptions.IsLocal = false; this.typeSigCreatorOptions.NullTypeSigAllowed = false; this.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; this.MethodSigCreatorVM = new MethodSigCreatorVM(mopts); MethodSigCreatorVM.PropertyChanged += (s, e) => HasErrorUpdated(); 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 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(); }
public TypeSigListDataFieldVM(Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options) : this(new TypeSig[0], onUpdated, options) { }
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(); }
public TypeSigVM(TypeSig value, Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options) : base(value, onUpdated, options) { }
public TypeDefOrRefListDataFieldVM(Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options) : this(Array.Empty <ITypeDefOrRef>(), onUpdated, options) { }
public ObjectListDataFieldVM(ModuleDef ownerModule, IList <object> value, Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options) : base(onUpdated) { this.ownerModule = ownerModule; if (options != null) { this.options = options.Clone(dnSpy_AsmEditor_Resources.CreateType); this.options.NullTypeSigAllowed = true; } SetValueFromConstructor(value); }
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 CANamedArgumentVM(ModuleDef ownerModule, CANamedArgument namedArg, TypeSigCreatorOptions options) { this.ownerModule = ownerModule; originalNamedArg = namedArg.Clone(); ConstantTypeEnumList = new EnumListVM(ConstantTypeVM.CreateEnumArray(validTypes), (a, b) => OnConstantTypeChanged()); NamedArgTypeEnumList = new EnumListVM(namedArgTypeEnumList, (a, b) => OnNamedArgTypeChanged()); InitializeFrom(namedArg, options); modified = false; }
public ObjectListDataFieldVM(ModuleDef ownerModule, Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options) : this(ownerModule, Array.Empty <object>(), onUpdated, options) { }
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 MethodSigCreatorOptions(TypeSigCreatorOptions typeSigCreatorOptions) => TypeSigCreatorOptions = typeSigCreatorOptions;
public LocalVM(TypeSigCreatorOptions typeSigCreatorOptions, LocalOptions options) { this.typeSigCreatorOptions = typeSigCreatorOptions.Clone(dnSpy_AsmEditor_Resources.CreateLocalType); this.typeSigCreatorOptions.IsLocal = true; this.typeSigCreatorOptions.NullTypeSigAllowed = false; this.origOptions = options; Reinitialize(); }
public LocalVM Import(TypeSigCreatorOptions typeSigCreatorOptions, ModuleDef ownerModule) { var opts = CreateLocalOptions(); var importer = new Importer(ownerModule, ImporterOptions.TryToUseDefs); opts.Type = importer.Import(opts.Type); return new LocalVM(typeSigCreatorOptions, opts); }
public MethodSigCreatorOptions(TypeSigCreatorOptions typeSigCreatorOptions) { TypeSigCreatorOptions = typeSigCreatorOptions; }
public ObjectListDataFieldVM(ModuleDef ownerModule, Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options) : this(ownerModule, new object[0], onUpdated, options) { }
public MethodSigCreatorOptions(TypeSigCreatorOptions typeSigCreatorOptions) { this.TypeSigCreatorOptions = typeSigCreatorOptions; }
protected TypeListDataFieldVMBase(IList <T> value, Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options) : base(onUpdated) { if (options != null) { this.options = options.Clone(dnSpy_AsmEditor_Resources.CreateType); this.options.NullTypeSigAllowed = true; } SetValueFromConstructor(value); }
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 TypeDefOrRefListDataFieldVM(IList <ITypeDefOrRef> value, Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options) : base(value, onUpdated, options) { }
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 TypeDefOrRefVM(Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options) : this(null, onUpdated, options) { }
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(); }
static TypeSigCreatorVM CreateTypeSigCreatorVM(ModuleDef ownerModule, ILanguageManager languageManager, TypeDef ownerType, MethodDef ownerMethod, bool allowNullTypeSig, PropertyChangedEventHandler handler) { var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, languageManager) { IsLocal = false, CanAddGenericTypeVar = true, CanAddGenericMethodVar = false, OwnerType = ownerType, OwnerMethod = ownerMethod, NullTypeSigAllowed = allowNullTypeSig, }; if (ownerType != null && ownerType.GenericParameters.Count == 0) typeSigCreatorOptions.CanAddGenericTypeVar = false; if (ownerMethod != null && ownerMethod.GenericParameters.Count > 0) typeSigCreatorOptions.CanAddGenericMethodVar = true; var typeSigCreator = new TypeSigCreatorVM(typeSigCreatorOptions); typeSigCreator.PropertyChanged += handler; return typeSigCreator; }
public TypeDefOrRefListDataFieldVM(Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options) : this(new ITypeDefOrRef[0], onUpdated, options) { }
void InitializeFrom(CANamedArgument namedArg, TypeSigCreatorOptions options) { if (CAArgumentVM != null) CAArgumentVM.PropertyChanged -= caArgumentVM_PropertyChanged; CAArgumentVM = new CAArgumentVM(ownerModule, namedArg.Argument, options, null); OnPropertyChanged(nameof(CAArgumentVM)); CAArgumentVM.PropertyChanged += caArgumentVM_PropertyChanged; Name = namedArg.Name; IsField = namedArg.IsField; ITypeDefOrRef newEnumType; ConstantTypeEnumList.SelectedItem = GetConstantType(namedArg.Type, out newEnumType); EnumType = newEnumType; CAArgumentVM.StorageType = GetType((ConstantType)ConstantTypeEnumList.SelectedItem); }
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(); }