Ejemplo n.º 1
0
        public static AcColumnInfoDictionary Parse(string InString)
        {
            AcColumnInfoDictionary vlus = new AcColumnInfoDictionary();
            CsvCursor csr = new CsvCursor(InString);

            while (true)
            {
                csr.NextValue();
                if (csr.IsEndOfString == true)
                {
                    break;
                }
                else if (csr.ItemCursor.Word.IsBraced == false)
                {
                    throw new ApplicationException(
                              "serialized AcColumnInfoDictionary string in invalid format");
                }

                // each comma sep item is itself a CSV string consisting of the
                // dictionary key and the AcColumnInfo ( itself in CSV form )
                else
                {
                    string strKeyValuePair = csr.ItemValue;
                    KeyValuePair <string, AcColumnInfo> pair = ParsePair(strKeyValuePair);
                    vlus.Add(pair.Key, pair.Value);
                }
            }
            return(vlus);
        }
Ejemplo n.º 2
0
 // convert from string to AcColumnInfoDictionary
 public override object ConvertFrom(
     ITypeDescriptorContext context,
     CultureInfo culture,
     object InValue)
 {
     if (InValue is string)
     {
         return(AcColumnInfoDictionary.Parse((string)InValue));
     }
     else
     {
         return(base.ConvertFrom(context, culture, InValue));
     }
 }
Ejemplo n.º 3
0
 // Convert from AcColumnInfoDictionary to string.
 public override object ConvertTo(
     ITypeDescriptorContext context,
     CultureInfo culture,
     object InValue,
     Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         AcColumnInfoDictionary vlus = InValue as AcColumnInfoDictionary;
         return(vlus.ToString());
     }
     else
     {
         return(base.ConvertTo(context, culture, InValue, destinationType));
     }
 }