public static ActionExpression ConvertTo(ConvertToAction action, Expression argument, Type type) { Utils.Contract.RequiresNotNull(action, "action"); Utils.Contract.RequiresNotNull(argument, "argument"); Utils.Contract.RequiresNotNull(type, "type"); return(ActionExpression(action, new Expression[] { argument }, type)); }
public ConvertToActionWizard(ConvertToAction fixedConvertToAction) { InitializeComponent(); m_fixedConvertToAction = fixedConvertToAction; m_direction = fixedConvertToAction.Direction; m_byref = fixedConvertToAction.ByRef; m_managedType = fixedConvertToAction.ManagedTypeConvertTo; m_marshalAs = fixedConvertToAction.UnmanagedTypeMarshalAs; m_attributes = fixedConvertToAction.Attributes; }
private void comboBoxManageType_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxManageType.SelectedItem == null) { return; } string manageTypeString = comboBoxManageType.SelectedItem.ToString(); if (ConvertToActionConstants.GetManagedTypeConvertTo(manageTypeString) == ManagedTypeConvertTo.LPARRAY) { groupBoxAdditionalArrayAttribute.Enabled = true; if (m_attributes != null) { Dictionary <string, string> attributePairDictionary = ConvertToAction.GetConvertToAttributeDictionary(m_attributes); if (attributePairDictionary.ContainsKey(ConvertToActionDef.SizeConst)) { checkBoxEnableSizeControl.Checked = true; radioButtonSizeConst.Checked = true; numericUpDownSizeConst.Enabled = true; numericUpDownSizeConst.Value = Int32.Parse(attributePairDictionary[ConvertToActionDef.SizeConst], CultureInfo.InvariantCulture); } else if (attributePairDictionary.ContainsKey(ConvertToActionDef.SizeParamIndex)) { checkBoxEnableSizeControl.Checked = true; radioButtonSizeParamIndex.Checked = true; numericUpDownSizeParamIndex.Value = Int32.Parse(attributePairDictionary[ConvertToActionDef.SizeParamIndex], CultureInfo.InvariantCulture); } else if (attributePairDictionary.ContainsKey(ConvertToActionDef.SizeParamIndexOffset)) { checkBoxEnableSizeControl.Checked = true; radioButtonSizeParamIndexOffset.Checked = true; comboBoxSizeParamIndexOffset.Text = attributePairDictionary[ConvertToActionDef.SizeParamIndexOffset]; } } } else { groupBoxAdditionalArrayAttribute.Enabled = false; } comboBoxMarshalAs.Items.Clear(); comboBoxMarshalAs.Items.Add("(default)"); List <string> marshalAsTypes = ConvertToActionConstants.GetMarshalAsTypes(manageTypeString); if (marshalAsTypes != null) { foreach (string marshalAsType in marshalAsTypes) { comboBoxMarshalAs.Items.Add(marshalAsType); } } if (m_marshalAs != null && m_formLoad) { comboBoxMarshalAs.SelectedItem = m_marshalAs; m_formLoad = false; } else { comboBoxMarshalAs.SelectedIndex = 0; } CheckOKButtonEnabled(); }
public static ActionExpression ConvertTo(Type toType, ConversionResultKind kind, Expression argument) { Utils.Contract.RequiresNotNull(toType, "toType"); return(ConvertTo(ConvertToAction.Make(toType, kind), argument)); }
public static ActionExpression ConvertTo(ConvertToAction action, Expression argument) { return(ConvertTo(action, argument, action.ToType)); }
public override AbstractValue AbstractBuild(AbstractContext context, IList <AbstractValue> parameters) { AbstractValue value = parameters[_index]; return(context.Binder.AbstractExecute(ConvertToAction.Make(_parameterType), new AbstractValue[] { value })); }
public static ActionExpression ConvertTo(ConvertToAction action, Expression argument) { return ConvertTo(action, argument, action.ToType); }
public static ActionExpression ConvertTo(ConvertToAction action, Expression argument, Type type) { Utils.Contract.RequiresNotNull(action, "action"); Utils.Contract.RequiresNotNull(argument, "argument"); Utils.Contract.RequiresNotNull(type, "type"); return ActionExpression(action, new Expression[] { argument }, type); }