Пример #1
0
        public CustomAttributeVM(CustomAttributeOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod)
        {
            this.origOptions       = options;
            this.ownerModule       = ownerModule;
            this.decompilerService = decompilerService;
            this.ownerType         = ownerType;
            this.ownerMethod       = ownerMethod;

            this.RawData            = new HexStringVM(a => HasErrorUpdated());
            this.CANamedArgumentsVM = new CANamedArgumentsVM(ownerModule, decompilerService, ownerType, ownerMethod, a => !IsRawData && a.Collection.Count < ushort.MaxValue);
            ConstructorArguments.CollectionChanged          += Args_CollectionChanged;
            CANamedArgumentsVM.Collection.CollectionChanged += Args_CollectionChanged;

            Reinitialize();
        }
Пример #2
0
        public CustomAttributeVM(CustomAttributeOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod)
        {
            this.origOptions = options;
            this.ownerModule = ownerModule;
            this.language = language;
            this.ownerType = ownerType;
            this.ownerMethod = ownerMethod;

            this.rawData = new HexStringVM(a => HasErrorUpdated());
            this.caNamedArgumentsVM = new CANamedArgumentsVM(ownerModule, language, ownerType, ownerMethod, a => !IsRawData && a.Collection.Count < ushort.MaxValue);
            ConstructorArguments.CollectionChanged += Args_CollectionChanged;
            CANamedArgumentsVM.Collection.CollectionChanged += Args_CollectionChanged;

            Reinitialize();
        }
Пример #3
0
        public CustomAttributeVM(CustomAttributeOptions options, ModuleDef ownerModule, ILanguageManager languageManager, TypeDef ownerType, MethodDef ownerMethod)
        {
            this.origOptions     = options;
            this.ownerModule     = ownerModule;
            this.languageManager = languageManager;
            this.ownerType       = ownerType;
            this.ownerMethod     = ownerMethod;

            this.rawData            = new HexStringVM(a => HasErrorUpdated());
            this.caNamedArgumentsVM = new CANamedArgumentsVM(ownerModule, languageManager, ownerType, ownerMethod, a => !IsRawData && a.Collection.Count < ushort.MaxValue);
            ConstructorArguments.CollectionChanged          += Args_CollectionChanged;
            CANamedArgumentsVM.Collection.CollectionChanged += Args_CollectionChanged;

            Reinitialize();
        }
Пример #4
0
        void InitializeFrom(CustomAttributeOptions options)
        {
            IsRawData     = options.RawData != null;
            RawData.Value = options.RawData;
            Constructor   = options.Constructor;
            ConstructorArguments.Clear();
            var sig = Constructor == null ? null : Constructor.MethodSig;

            for (int i = 0; i < options.ConstructorArguments.Count; i++)
            {
                TypeSig type = null;
                if (sig != null && i < sig.Params.Count)
                {
                    type = sig.Params[i];
                }
                ConstructorArguments.Add(new CAArgumentVM(ownerModule, options.ConstructorArguments[i], new TypeSigCreatorOptions(ownerModule, decompilerService), type));
            }
            CANamedArgumentsVM.InitializeFrom(options.NamedArguments);
            CreateArguments();
        }
Пример #5
0
 CustomAttributeOptions CopyTo(CustomAttributeOptions options)
 {
     options.Constructor = Constructor;
     options.ConstructorArguments.Clear();
     options.NamedArguments.Clear();
     if (IsRawData)
     {
         options.RawData = RawData.Value.ToArray();
     }
     else
     {
         options.RawData = null;
         int count = Constructor == null ? 0 : Constructor.MethodSig.GetParamCount();
         for (int i = 0; i < count; i++)
         {
             options.ConstructorArguments.Add(ConstructorArguments[i].CreateCAArgument(Constructor.MethodSig.Params[i]));
         }
         options.NamedArguments.AddRange(CANamedArgumentsVM.Collection.Select(a => a.CreateCANamedArgument()));
     }
     return(options);
 }
Пример #6
0
		CustomAttributeOptions CopyTo(CustomAttributeOptions options) {
			options.Constructor = Constructor;
			options.ConstructorArguments.Clear();
			options.NamedArguments.Clear();
			if (IsRawData)
				options.RawData = RawData.Value.ToArray();
			else {
				options.RawData = null;
				int count = Constructor == null ? 0 : Constructor.MethodSig.GetParamCount();
				for (int i = 0; i < count; i++)
					options.ConstructorArguments.Add(ConstructorArguments[i].CreateCAArgument(Constructor.MethodSig.Params[i]));
				options.NamedArguments.AddRange(CANamedArgumentsVM.Collection.Select(a => a.CreateCANamedArgument()));
			}
			return options;
		}
Пример #7
0
		void InitializeFrom(CustomAttributeOptions options) {
			IsRawData = options.RawData != null;
			RawData.Value = options.RawData;
			Constructor = options.Constructor;
			ConstructorArguments.Clear();
			var sig = Constructor == null ? null : Constructor.MethodSig;
			for (int i = 0; i < options.ConstructorArguments.Count; i++) {
				TypeSig type = null;
				if (sig != null && i < sig.Params.Count)
					type = sig.Params[i];
				ConstructorArguments.Add(new CAArgumentVM(ownerModule, options.ConstructorArguments[i], new TypeSigCreatorOptions(ownerModule, decompilerService), type));
			}
			CANamedArgumentsVM.InitializeFrom(options.NamedArguments);
			CreateArguments();
		}
Пример #8
0
		public CustomAttributeVM(CustomAttributeOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) {
			origOptions = options;
			this.ownerModule = ownerModule;
			this.decompilerService = decompilerService;
			this.ownerType = ownerType;
			this.ownerMethod = ownerMethod;

			RawData = new HexStringVM(a => HasErrorUpdated());
			CANamedArgumentsVM = new CANamedArgumentsVM(ownerModule, decompilerService, ownerType, ownerMethod, a => !IsRawData && a.Collection.Count < ushort.MaxValue);
			ConstructorArguments.CollectionChanged += Args_CollectionChanged;
			CANamedArgumentsVM.Collection.CollectionChanged += Args_CollectionChanged;

			Reinitialize();
		}