Ejemplo n.º 1
0
 ParamDefOptions CopyTo(ParamDefOptions options)
 {
     options.Name        = Name;
     options.Sequence    = Sequence.Value;
     options.Attributes  = Attributes;
     options.Constant    = HasDefault ? Constant : null;
     options.MarshalType = HasFieldMarshal ? MarshalTypeVM.Type : null;
     options.CustomAttributes.Clear();
     options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create()));
     return(options);
 }
Ejemplo n.º 2
0
        public ParamDefVM(ParamDefOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod)
        {
            this.ownerModule               = ownerModule;
            this.origOptions               = options;
            this.sequence                  = new UInt16VM(a => { OnPropertyChanged("FullName"); HasErrorUpdated(); });
            this.customAttributesVM        = new CustomAttributesVM(ownerModule, language);
            this.constantVM                = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, "Default value for this parameter");
            ConstantVM.PropertyChanged    += constantVM_PropertyChanged;
            this.marshalTypeVM             = new MarshalTypeVM(ownerModule, language, ownerType != null ? ownerType : ownerMethod == null ? null : ownerMethod.DeclaringType, ownerMethod);
            MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged;

            ConstantVM.IsEnabled    = HasDefault;
            MarshalTypeVM.IsEnabled = HasFieldMarshal;
            Reinitialize();
        }
Ejemplo n.º 3
0
        public ParamDefVM(ParamDefOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod)
        {
            this.ownerModule = ownerModule;
            this.origOptions = options;
            this.sequence = new UInt16VM(a => { OnPropertyChanged("FullName"); HasErrorUpdated(); });
            this.customAttributesVM = new CustomAttributesVM(ownerModule, language);
            this.constantVM = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, "Default value for this parameter");
            ConstantVM.PropertyChanged += constantVM_PropertyChanged;
            this.marshalTypeVM = new MarshalTypeVM(ownerModule, language, ownerType != null ? ownerType : ownerMethod == null ? null : ownerMethod.DeclaringType, ownerMethod);
            MarshalTypeVM.PropertyChanged += marshalTypeVM_PropertyChanged;

            ConstantVM.IsEnabled = HasDefault;
            MarshalTypeVM.IsEnabled = HasFieldMarshal;
            Reinitialize();
        }
Ejemplo n.º 4
0
 void InitializeFrom(ParamDefOptions options)
 {
     Name           = options.Name;
     Sequence.Value = options.Sequence;
     Attributes     = options.Attributes;
     if (options.Constant != null)
     {
         HasDefault       = true;
         ConstantVM.Value = options.Constant.Value;
     }
     else
     {
         HasDefault       = false;
         ConstantVM.Value = null;
     }
     MarshalTypeVM.Type = options.MarshalType;
     CustomAttributesVM.InitializeFrom(options.CustomAttributes);
 }
Ejemplo n.º 5
0
 void InitializeFrom(ParamDefOptions options)
 {
     Name = options.Name;
     Sequence.Value = options.Sequence;
     Attributes = options.Attributes;
     if (options.Constant != null) {
         HasDefault = true;
         ConstantVM.Value = options.Constant.Value;
     }
     else {
         HasDefault = false;
         ConstantVM.Value = null;
     }
     MarshalTypeVM.Type = options.MarshalType;
     CustomAttributesVM.InitializeFrom(options.CustomAttributes);
 }
Ejemplo n.º 6
0
 ParamDefOptions CopyTo(ParamDefOptions options)
 {
     options.Name = Name;
     options.Sequence = Sequence.Value;
     options.Attributes = Attributes;
     options.Constant = HasDefault ? Constant : null;
     options.MarshalType = HasFieldMarshal ? MarshalTypeVM.Type : null;
     options.CustomAttributes.Clear();
     options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create()));
     return options;
 }