public TypeDefOrRefAndCAVM(TypeDefOrRefAndCAOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.origOptions = options; 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); TypeSigCreator.PropertyChanged += TypeSigCreator_PropertyChanged; this.customAttributesVM = new CustomAttributesVM(ownerModule, language); 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(); }
void InitializeFrom(DeclSecurityOptions options) { SecurityActionEnumList.SelectedItem = (SecAc)options.Action; CustomAttributesVM.InitializeFrom(options.CustomAttributes); SecurityAttributesVM.Collection.Clear(); SecurityAttributesVM.Collection.AddRange(options.SecurityAttributes.Select(a => new SecurityAttributeVM(a, ownerModule, language, ownerType, ownerMethod))); V1XMLString = options.V1XMLString; DeclSecVerEnumList.SelectedItem = options.V1XMLString == null ? DeclSecVer.V2 : DeclSecVer.V1; }
void InitializeFrom(GenericParamOptions options) { Number.Value = options.Number; Attributes = options.Flags; Name = options.Name; GPVarianceVM.SelectedItem = (GPVariance)((int)(options.Flags & GenericParamAttributes.VarianceMask) >> 0); TypeSigCreator.TypeSig = options.Kind.ToTypeSig(); TypeDefOrRefAndCAsVM.InitializeFrom(options.GenericParamConstraints); CustomAttributesVM.InitializeFrom(options.CustomAttributes); }
void InitializeFrom(MemberRefOptions options) { this.Class = options.Class; this.Name = options.Name; if (IsField) { var fs = options.Signature as FieldSig; TypeSigCreatorVM.TypeSig = fs == null ? null : fs.Type; } else { MethodSigCreatorVM.MethodSig = options.Signature as MethodSig; } CustomAttributesVM.InitializeFrom(options.CustomAttributes); }
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 DeclSecurityVM(DeclSecurityOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.language = language; this.ownerType = ownerType; this.ownerMethod = ownerMethod; this.origOptions = options; this.customAttributesVM = new CustomAttributesVM(ownerModule, language); CustomAttributesVM.PropertyChanged += CustomAttributesVM_PropertyChanged; this.declSecVerEnumListVM = new EnumListVM(declSecVerList, (a, b) => OnDeclSecVerChanged()); this.securityActionEnumListVM = new EnumListVM(secActList, (a, b) => OnSecurityActionChanged()); this.securityAttributesVM = new SecurityAttributesVM(ownerModule, language, ownerType, ownerMethod); this.SecurityAttributesVM.Collection.CollectionChanged += SecurityAttributesVM_CollectionChanged; Reinitialize(); }
public MethodSpecVM(MethodSpecOptions options, TypeSigCreatorOptions typeSigCreatorOptions) { this.origOptions = options; this.typeSigCreatorOptions = typeSigCreatorOptions; 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.createTypeSigArrayVM = new CreateTypeSigArrayVM(typeSigCreatorOptions, null); 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(); }