public GenericParamVM(GenericParamOptions options, ModuleDef ownerModule, IDecompilerManager decompilerManager, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.origOptions = options; this.Number = new UInt16VM(a => { OnPropertyChanged(nameof(FullName)); HasErrorUpdated(); }); this.TypeDefOrRefAndCAsVM = new TypeDefOrRefAndCAsVM <GenericParamConstraint>(dnSpy_AsmEditor_Resources.EditGenericParameterConstraint, dnSpy_AsmEditor_Resources.CreateGenericParameterConstraint, ownerModule, decompilerManager, ownerType, ownerMethod); this.CustomAttributesVM = new CustomAttributesVM(ownerModule, decompilerManager); this.GPVarianceVM = new EnumListVM(EnumVM.Create(typeof(GPVariance))); var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, decompilerManager) { 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, 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(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); }
GenericParamOptions CopyTo(GenericParamOptions options) { options.Number = Number.Value; options.Flags = Attributes; options.Name = Name; options.Kind = TypeSigCreator.TypeSig.ToTypeDefOrRef(); options.GenericParamConstraints.Clear(); options.GenericParamConstraints.AddRange(TypeDefOrRefAndCAsVM.Collection.Select(a => a.CreateTypeDefOrRefAndCAOptions().CreateGenericParamConstraint(ownerModule))); options.CustomAttributes.Clear(); options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create())); return(options); }
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(); }
GenericParamOptions CopyTo(GenericParamOptions options) { options.Number = Number.Value; options.Flags = Attributes; options.Name = Name; options.Kind = TypeSigCreator.TypeSig.ToTypeDefOrRef(); options.GenericParamConstraints.Clear(); options.GenericParamConstraints.AddRange(TypeDefOrRefAndCAsVM.Collection.Select(a => a.CreateTypeDefOrRefAndCAOptions().CreateGenericParamConstraint(ownerModule))); options.CustomAttributes.Clear(); options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create())); return options; }
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(); }