示例#1
0
        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();
        }
示例#2
0
 TypeDefOrRefAndCAOptions CopyTo(TypeDefOrRefAndCAOptions options)
 {
     options.TypeDefOrRef = TypeSigCreator.TypeSig.ToTypeDefOrRef();
     options.CustomAttributes.Clear();
     options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create()));
     return(options);
 }
示例#3
0
        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();
        }
示例#4
0
 void InitializeFrom(TypeDefOrRefAndCAOptions options)
 {
     TypeSigCreator.TypeSig = options.TypeDefOrRef.ToTypeSig();
     CustomAttributesVM.InitializeFrom(options.CustomAttributes);
 }
示例#5
0
 TypeDefOrRefAndCAOptions CopyTo(TypeDefOrRefAndCAOptions options)
 {
     options.TypeDefOrRef = TypeSigCreator.TypeSig.ToTypeDefOrRef();
     options.CustomAttributes.Clear();
     options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create()));
     return options;
 }
示例#6
0
 void InitializeFrom(TypeDefOrRefAndCAOptions options)
 {
     TypeSigCreator.TypeSig = options.TypeDefOrRef.ToTypeSig();
     CustomAttributesVM.InitializeFrom(options.CustomAttributes);
 }