Ejemplo n.º 1
0
 void InitializeFrom(MemberRefOptions options)
 {
     this.Class = options.Class;
     this.Name  = options.Name;
     if (IsField)
     {
         var fs = options.Signature as FieldSig;
         TypeSigCreatorVM.TypeSig = fs?.Type;
     }
     else
     {
         MethodSigCreatorVM.MethodSig = options.Signature as MethodSig;
     }
     CustomAttributesVM.InitializeFrom(options.CustomAttributes);
 }
Ejemplo n.º 2
0
 MemberRefOptions CopyTo(MemberRefOptions options)
 {
     options.Class = this.Class;
     options.Name  = this.Name;
     if (IsField)
     {
         options.Signature = new FieldSig(TypeSigCreatorVM.TypeSig);
     }
     else
     {
         options.Signature = MethodSigCreatorVM.MethodSig;
     }
     options.CustomAttributes.Clear();
     options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create()));
     return(options);
 }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
		MemberRefOptions CopyTo(MemberRefOptions options) {
			options.Class = this.Class;
			options.Name = this.Name;
			if (IsField)
				options.Signature = new FieldSig(TypeSigCreatorVM.TypeSig);
			else
				options.Signature = MethodSigCreatorVM.MethodSig;
			options.CustomAttributes.Clear();
			options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create()));
			return options;
		}
Ejemplo n.º 6
0
		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);
		}
Ejemplo n.º 7
0
		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();
		}