Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
 }
Exemplo n.º 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;
		}
Exemplo n.º 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();
		}
Exemplo n.º 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();
		}