Exemplo n.º 1
0
        public TypeSig[] Create(TypeSigCreatorOptions options, int? count, TypeSig[] typeSigs)
        {
            var data = new CreateTypeSigArrayVM(options, count);
            if (typeSigs != null)
                data.TypeSigCollection.AddRange(typeSigs);
            var win = new CreateTypeSigArrayDlg();
            win.DataContext = data;
            win.Owner = ownerWindow ?? MainWindow.Instance;
            if (win.ShowDialog() != true)
                return null;

            return data.TypeSigArray;
        }
Exemplo n.º 2
0
        public MethodSpecVM(MethodSpecOptions options, TypeSigCreatorOptions typeSigCreatorOptions)
        {
            this.origOptions = options;
            this.typeSigCreatorOptions = typeSigCreatorOptions;
            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.createTypeSigArrayVM = new CreateTypeSigArrayVM(typeSigCreatorOptions, null);

            Reinitialize();
        }
Exemplo n.º 3
0
        public MethodSpecVM(MethodSpecOptions options, TypeSigCreatorOptions typeSigCreatorOptions)
        {
            this.origOptions           = options;
            this.typeSigCreatorOptions = typeSigCreatorOptions;
            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.createTypeSigArrayVM = new CreateTypeSigArrayVM(typeSigCreatorOptions, null);

            Reinitialize();
        }
Exemplo n.º 4
0
 public MethodSigCreatorVM(MethodSigCreatorOptions options)
 {
     this.options = options.Clone();
     this.title   = options.TypeSigCreatorOptions.Title;
     this.parametersCreateTypeSigArray = new CreateTypeSigArrayVM(options.TypeSigCreatorOptions.Clone(null), null);
     this.ParametersCreateTypeSigArray.TypeSigCollection.CollectionChanged += (s, e) => OnPropertyChanged("SignatureFullName");
     this.sentinelCreateTypeSigArray = new CreateTypeSigArrayVM(options.TypeSigCreatorOptions.Clone(null), null);
     this.SentinelCreateTypeSigArray.TypeSigCollection.CollectionChanged += (s, e) => OnPropertyChanged("SignatureFullName");
     this.sentinelCreateTypeSigArray.IsEnabled = CanHaveSentinel;
     this.genericParameterCount = new UInt32VM(0, a => {
         HasErrorUpdated();
         OnPropertyChanged("SignatureFullName");
         if (GenericParameterCount != null && !GenericParameterCount.HasError)
         {
             IsGeneric = GenericParameterCount.Value != 0;
         }
     })
     {
         Min = ModelUtils.COMPRESSED_UINT32_MIN,
         Max = ModelUtils.COMPRESSED_UINT32_MAX,
     };
     this.methodCallingConvVM = new EnumListVM(methodCallingConvList, (a, b) => {
         if (!IsMethodSig)
         {
             throw new InvalidOperationException();
         }
         CallingConvention = (CallingConvention & ~dnlib.DotNet.CallingConvention.Mask) |
                             (dnlib.DotNet.CallingConvention)(MethodCallingConv) MethodCallingConv.SelectedItem;
     });
     if (!CanHaveSentinel)
     {
         MethodCallingConv.Items.RemoveAt(MethodCallingConv.GetIndex(DnlibDialogs.MethodCallingConv.VarArg));
         MethodCallingConv.Items.RemoveAt(MethodCallingConv.GetIndex(DnlibDialogs.MethodCallingConv.NativeVarArg));
     }
     if (IsMethodSig)
     {
         MethodCallingConv.SelectedItem = DnlibDialogs.MethodCallingConv.Default;
     }
     else
     {
         CallingConvention = (CallingConvention & ~dnlib.DotNet.CallingConvention.Mask) | dnlib.DotNet.CallingConvention.Property;
     }
     ReturnType = options.TypeSigCreatorOptions.OwnerModule.CorLibTypes.Void;
 }