Exemplo n.º 1
0
        public LocalVM(TypeSigCreatorOptions typeSigCreatorOptions, LocalOptions options)
        {
            this.typeSigCreatorOptions = typeSigCreatorOptions.Clone("Create a Local Type");
            this.typeSigCreatorOptions.IsLocal = true;
            this.typeSigCreatorOptions.NullTypeSigAllowed = false;
            this.origOptions = options;

            Reinitialize();
        }
Exemplo n.º 2
0
 protected TypeVMBase(T value, Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options)
     : base(onUpdated)
 {
     if (options != null)
     {
         this.options = options.Clone("Create a Type");
         this.options.NullTypeSigAllowed = true;
     }
     SetValue(value);
 }
Exemplo n.º 3
0
 public ObjectListDataFieldVM(ModuleDef ownerModule, IList <object> value, Action <DataFieldVM> onUpdated, TypeSigCreatorOptions options)
     : base(onUpdated)
 {
     this.ownerModule = ownerModule;
     if (options != null)
     {
         this.options = options.Clone("Create a Type");
         this.options.NullTypeSigAllowed = true;
     }
     SetValue(value);
 }
Exemplo n.º 4
0
        void PickTypeSpec()
        {
            if (typeSigCreator == null)
            {
                throw new InvalidOperationException();
            }
            bool canceled;
            var  newType = typeSigCreator.Create(typeSigCreatorOptions.Clone("Create TypeSpec"), (Class as ITypeDefOrRef).ToTypeSig(), out canceled);

            if (!canceled)
            {
                Class = newType.ToTypeDefOrRef();
            }
        }
Exemplo n.º 5
0
        void AddFnPtrSig()
        {
            if (createMethodPropertySig == null)
            {
                throw new InvalidOperationException();
            }

            var createOptions = new MethodSigCreatorOptions(options.Clone("Create FnPtr Method Signature"));

            createOptions.IsPropertySig   = false;
            createOptions.CanHaveSentinel = true;

            var fnPtrSig = TypeSig as FnPtrSig;
            var msig     = fnPtrSig == null ? null : fnPtrSig.MethodSig;
            var sig      = createMethodPropertySig.Create(createOptions, msig);

            if (sig == null)
            {
                return;
            }

            TypeSig = new FnPtrSig(sig);
        }
Exemplo n.º 6
0
        public ExceptionHandlerVM(TypeSigCreatorOptions typeSigCreatorOptions, ExceptionHandlerOptions options)
        {
            this.typeSigCreatorOptions = typeSigCreatorOptions.Clone("Create an Exception Catch Type");
            this.typeSigCreatorOptions.IsLocal = false;
            this.typeSigCreatorOptions.NullTypeSigAllowed = true;
            this.origOptions = options;
            this.handlerTypeVM = new EnumListVM(exceptionHandlerTypeList);
            this.tryStartVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction };
            this.tryEndVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction };
            this.filterStartVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction };
            this.handlerStartVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction };
            this.handlerEndVM = new ListVM<InstructionVM>((a, b) => OnSelectionChanged()) { DataErrorInfoDelegate = VerifyInstruction };

            Reinitialize();
        }
Exemplo n.º 7
0
        public TypeSigCreatorVM(TypeSigCreatorOptions options, TypeSig defaultTypeSig = null)
        {
            this.options = options.Clone();
            this.defaultTypeSig = defaultTypeSig;
            this.arrayRank = new UInt32VM(2, a => { });
            this.arraySizes = new UInt32ListDataFieldVM(a => { }) {
                Min = ModelUtils.COMPRESSED_UINT32_MIN,
                Max = ModelUtils.COMPRESSED_UINT32_MAX,
            };
            this.arrayLowerBounds = new Int32ListDataFieldVM(a => { }) {
                Min = ModelUtils.COMPRESSED_INT32_MIN,
                Max = ModelUtils.COMPRESSED_INT32_MAX,
            };
            this.genericVariableNumber = new UInt32VM(0, a => { });

            Reinitialize();
        }
Exemplo n.º 8
0
        public TypeSigCreatorVM(TypeSigCreatorOptions options, TypeSig defaultTypeSig = null)
        {
            this.options        = options.Clone();
            this.defaultTypeSig = defaultTypeSig;
            this.arrayRank      = new UInt32VM(2, a => { });
            this.arraySizes     = new UInt32ListDataFieldVM(a => { })
            {
                Min = ModelUtils.COMPRESSED_UINT32_MIN,
                Max = ModelUtils.COMPRESSED_UINT32_MAX,
            };
            this.arrayLowerBounds = new Int32ListDataFieldVM(a => { })
            {
                Min = ModelUtils.COMPRESSED_INT32_MIN,
                Max = ModelUtils.COMPRESSED_INT32_MAX,
            };
            this.genericVariableNumber = new UInt32VM(0, a => { });

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