ParamDefOptions CopyTo(ParamDefOptions options) { options.Name = Name; options.Sequence = Sequence.Value; options.Attributes = Attributes; options.Constant = HasDefault ? Constant : null; options.MarshalType = HasFieldMarshal ? MarshalTypeVM.Type : null; options.CustomAttributes.Clear(); options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create())); return(options); }
public ParamDefVM(ParamDefOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.origOptions = options; this.Sequence = new UInt16VM(a => { OnPropertyChanged(nameof(FullName)); HasErrorUpdated(); }); this.CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerService); this.ConstantVM = new ConstantVM(ownerModule, options.Constant?.Value, dnSpy_AsmEditor_Resources.Parameter_DefaultValueInfo); ConstantVM.PropertyChanged += constantVM_PropertyChanged; this.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(); }
void InitializeFrom(ParamDefOptions options) { Name = options.Name; Sequence.Value = options.Sequence; Attributes = options.Attributes; if (options.Constant != null) { HasDefault = true; ConstantVM.Value = options.Constant.Value; } else { HasDefault = false; ConstantVM.Value = null; } MarshalTypeVM.Type = options.MarshalType; CustomAttributesVM.InitializeFrom(options.CustomAttributes); }
ParamDefOptions CopyTo(ParamDefOptions options) { options.Name = Name; options.Sequence = Sequence.Value; options.Attributes = Attributes; options.Constant = HasDefault ? Constant : null; options.MarshalType = HasFieldMarshal ? MarshalTypeVM.Type : null; options.CustomAttributes.Clear(); options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create())); return options; }
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(); }