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 ?? Application.Current.MainWindow; if (win.ShowDialog() != true) return null; return data.TypeSigArray; }
public MethodSpecVM(MethodSpecOptions options, TypeSigCreatorOptions typeSigCreatorOptions) { origOptions = options; this.typeSigCreatorOptions = typeSigCreatorOptions; CustomAttributesVM = new CustomAttributesVM(typeSigCreatorOptions.OwnerModule, typeSigCreatorOptions.DecompilerService); this.typeSigCreatorOptions.CanAddGenericMethodVar = true; this.typeSigCreatorOptions.CanAddGenericTypeVar = true; this.typeSigCreatorOptions.IsLocal = false; this.typeSigCreatorOptions.NullTypeSigAllowed = false; CreateTypeSigArrayVM = new CreateTypeSigArrayVM(typeSigCreatorOptions, null); Reinitialize(); }
public MethodSpecVM(MethodSpecOptions options, TypeSigCreatorOptions typeSigCreatorOptions) { this.origOptions = options; this.typeSigCreatorOptions = typeSigCreatorOptions; this.customAttributesVM = new CustomAttributesVM(typeSigCreatorOptions.OwnerModule, typeSigCreatorOptions.LanguageManager); this.typeSigCreatorOptions.CanAddGenericMethodVar = true; this.typeSigCreatorOptions.CanAddGenericTypeVar = true; this.typeSigCreatorOptions.IsLocal = false; this.typeSigCreatorOptions.NullTypeSigAllowed = false; this.createTypeSigArrayVM = new CreateTypeSigArrayVM(typeSigCreatorOptions, null); Reinitialize(); }
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; }