//Public Overloads Function BeforeCast(ByVal sqlLiteralType As StringSqlLiteralType, _ // ByVal propertyType As StringPropertyType, _ // ByVal aColumnInfo As ColumnInfo, _ // ByVal propertyValue As Object) As Object // Return JkCastEditor.FillWithDefaultValue(propertyValue, aColumnInfo) //End Function public object BeforeCast(NumberSqlLiteralType sqlLiteralType , StringPropertyType propertyType , ColumnInfo aColumnInfo , object propertyValue) { string numStr = (string)propertyValue; decimal dec = default(decimal); decimal.TryParse(numStr, out dec); return(dec.ToString()); }
private static void ConvertItem(object item, List <Field> fields) { System.Type type = item.GetType(); if (type == typeof(BooleanPropertyType)) { BooleanPropertyType booleanProperty = (BooleanPropertyType)item; fields.Add(new Field(booleanProperty.Name, booleanProperty.Value, FieldType.Boolean)); } else if (type == typeof(EnumPropertyType)) { //--- Note: EnumPropertyType is not converted. } else if (type == typeof(LocalizableTextPropertyType)) { LocalizableTextPropertyType localizableTextProperty = (LocalizableTextPropertyType)item; string baseFieldTitle = localizableTextProperty.Name; if (!string.IsNullOrEmpty(baseFieldTitle) && localizableTextProperty.LocalizedString != null) { foreach (var localizedStringItem in localizableTextProperty.LocalizedString) { if (string.IsNullOrEmpty(localizedStringItem.Lang)) { fields.Add(new Field(baseFieldTitle, localizedStringItem.Value, FieldType.Text)); } else { string localizedTitle = string.Format("{0} {1}", baseFieldTitle, localizedStringItem.Lang); fields.Add(new Field(localizedTitle, localizedStringItem.Value, FieldType.Localization)); } } } } else if (type == typeof(ReferenceSlotPropertyType)) { //--- Note: ReferenceSlotPropertyType type is not converted. } else if (type == typeof(NumberPropertyType)) { NumberPropertyType numberPropertyType = (NumberPropertyType)item; fields.Add(new Field(numberPropertyType.Name, numberPropertyType.Value, FieldType.Number)); } else if (type == typeof(ReferenceStripPropertyType)) { //--- Note: ReferenceStripPropertyType is not converted. } else if (type == typeof(StringPropertyType)) { StringPropertyType stringPropertyType = (StringPropertyType)item; fields.Add(new Field(stringPropertyType.Name, stringPropertyType.Value, FieldType.Text)); } }
public string GetStringProperty(StringPropertyType propertType, string defaultValue) { string propertyValue = defaultValue; if (IsOpen) { IntPtr strEmpty = Marshal.StringToHGlobalUni(string.Empty); uint uicch = 0; if (NativeMethods.MsiSummaryInfoGetProperty(hSummary, (uint)propertType, out uint _, out _, out _, strEmpty, ref uicch) == 234) // ERROR_MORE_DATA { IntPtr strBuffer = Marshal.AllocHGlobal((int)uicch++ *2); ErrorCode = NativeMethods.MsiSummaryInfoGetProperty(hSummary, (uint)propertType, out _, out _, out _, strBuffer, ref uicch); if (ErrorCode == 0) { propertyValue = Marshal.PtrToStringUni(strBuffer); } Marshal.FreeHGlobal(strBuffer); } Marshal.FreeHGlobal(strEmpty); } return(propertyValue); }
private static void ConvertItem(object item, List <Field> fields) { System.Type type = item.GetType(); if (type == typeof(BooleanPropertyType)) { BooleanPropertyType booleanProperty = (BooleanPropertyType)item; fields.Add(new Field(booleanProperty.Name, string.Equals(booleanProperty.Value, "1").ToString(), FieldType.Boolean)); } else if (type == typeof(EnumPropertyType)) { EnumPropertyType enumProperty = (EnumPropertyType)item; if (PixelCrushers.DialogueSystem.Articy.ArticyTools.IsQuestStateArticyPropertyName(enumProperty.Name)) { fields.Add(new Field(enumProperty.Name, PixelCrushers.DialogueSystem.Articy.ArticyTools.EnumValueToQuestState(Tools.StringToInt(enumProperty.Value), GetEnumStringValue(enumProperty.Name, Tools.StringToInt(enumProperty.Value))), FieldType.Text)); } else { var asString = _convertDropdownAsString; if (_prefs != null) { switch (_prefs.ConversionSettings.GetDropdownOverrideSetting(enumProperty.Name).mode) { case ConversionSettings.DropdownOverrideMode.Int: asString = false; break; case ConversionSettings.DropdownOverrideMode.String: asString = true; break; } } if (asString) { fields.Add(new Field(enumProperty.Name, GetEnumStringValue(enumProperty.Name, Tools.StringToInt(enumProperty.Value)), FieldType.Text)); } else { fields.Add(new Field(enumProperty.Name, enumProperty.Value, FieldType.Number)); } } } else if (type == typeof(LocalizableTextPropertyType)) { LocalizableTextPropertyType localizableTextProperty = (LocalizableTextPropertyType)item; string baseFieldTitle = localizableTextProperty.Name; if (!string.IsNullOrEmpty(baseFieldTitle) && localizableTextProperty.LocalizedString != null) { foreach (var localizedStringItem in localizableTextProperty.LocalizedString) { if (string.IsNullOrEmpty(localizedStringItem.Lang)) { fields.Add(new Field(baseFieldTitle, localizedStringItem.Value, FieldType.Text)); } else { string localizedTitle = string.Format("{0} {1}", baseFieldTitle, localizedStringItem.Lang); fields.Add(new Field(localizedTitle, localizedStringItem.Value, FieldType.Localization)); } } } } else if (type == typeof(ReferenceSlotPropertyType)) { ReferenceSlotPropertyType slotProperty = (ReferenceSlotPropertyType)item; if (_convertSlotsAs == ConverterPrefs.ConvertSlotsModes.DisplayName) { fields.Add(new Field(slotProperty.Name, GetDisplayName(slotProperty.IdRef), FieldType.Text)); } else { fields.Add(new Field(slotProperty.Name, slotProperty.IdRef, FieldType.Text)); } } else if (type == typeof(NumberPropertyType)) { NumberPropertyType numberPropertyType = (NumberPropertyType)item; fields.Add(new Field(numberPropertyType.Name, numberPropertyType.Value, FieldType.Number)); } else if (type == typeof(ReferenceStripPropertyType)) { ReferenceStripPropertyType stripPropertyType = (ReferenceStripPropertyType)item; fields.Add(new Field(ArticyTools.SubtableFieldPrefix + stripPropertyType.Name, GetStripStringValue(stripPropertyType), FieldType.Text)); } else if (type == typeof(StringPropertyType)) { StringPropertyType stringPropertyType = (StringPropertyType)item; fields.Add(new Field(stringPropertyType.Name, stringPropertyType.Value, FieldType.Text)); } }
private static void ConvertItem(object item, List <Field> fields) { System.Type type = item.GetType(); if (type == typeof(BooleanPropertyType)) { BooleanPropertyType booleanProperty = (BooleanPropertyType)item; fields.Add(new Field(booleanProperty.Name, string.Equals(booleanProperty.Value, "1").ToString(), FieldType.Boolean)); } else if (type == typeof(EnumPropertyType)) { EnumPropertyType enumProperty = (EnumPropertyType)item; if (PixelCrushers.DialogueSystem.Articy.ArticyTools.IsQuestStateArticyPropertyName(enumProperty.Name)) { fields.Add(new Field(enumProperty.Name, PixelCrushers.DialogueSystem.Articy.ArticyTools.EnumValueToQuestState(Tools.StringToInt(enumProperty.Value), string.Empty), FieldType.Text)); } else { fields.Add(new Field(enumProperty.Name, enumProperty.Value, FieldType.Number)); } } else if (type == typeof(LocalizableTextPropertyType)) { LocalizableTextPropertyType localizableTextProperty = (LocalizableTextPropertyType)item; string baseFieldTitle = localizableTextProperty.Name; if (!string.IsNullOrEmpty(baseFieldTitle) && localizableTextProperty.LocalizedString != null) { foreach (var localizedStringItem in localizableTextProperty.LocalizedString) { if (string.IsNullOrEmpty(localizedStringItem.Lang)) { fields.Add(new Field(baseFieldTitle, localizedStringItem.Value, FieldType.Text)); } else { string localizedTitle = string.Format("{0} {1}", baseFieldTitle, localizedStringItem.Lang); fields.Add(new Field(localizedTitle, localizedStringItem.Value, FieldType.Localization)); } } } } else if (type == typeof(ReferenceSlotPropertyType)) { ReferenceSlotPropertyType slotProperty = (ReferenceSlotPropertyType)item; fields.Add(new Field(slotProperty.Name, slotProperty.IdRef, FieldType.Text)); } else if (type == typeof(NumberPropertyType)) { NumberPropertyType numberPropertyType = (NumberPropertyType)item; fields.Add(new Field(numberPropertyType.Name, numberPropertyType.Value, FieldType.Number)); } else if (type == typeof(ReferenceStripPropertyType)) { //--- Note: ReferenceStripPropertyType is not converted. Debug.LogWarning("Dialogue System: Skipping import of ReferenceStripPropertyType: " + (item as ReferenceStripPropertyType).Name); } else if (type == typeof(StringPropertyType)) { StringPropertyType stringPropertyType = (StringPropertyType)item; fields.Add(new Field(stringPropertyType.Name, stringPropertyType.Value, FieldType.Text)); } }