Ejemplo n.º 1
0
    public bool TryGetLocValue <T>(Locale locale, string column, out T val)
    {
        DbfField field;

        val = default(T);
        if (this.TryGetField(column, out field))
        {
            List <DbfLocValue> list = (List <DbfLocValue>)field.GetValue();
            for (int i = 0; i < list.Count; i++)
            {
                DbfLocValue value2 = list[i];
                if (value2.GetLocale() == locale)
                {
                    val = (T)value2.GetValue();
                    return(true);
                }
            }
        }
        return(false);
    }
 private static void AddLocStrings(DbfRecord record, List <LocalizedString> protoStrings)
 {
     for (int i = 0; i < protoStrings.Count; i++)
     {
         List <DbfLocValue> val = new List <DbfLocValue>();
         LocalizedString    str = protoStrings[i];
         string             key = str.Key;
         for (int j = 0; j < str.Values.Count; j++)
         {
             LocalizedStringValue value2 = str.Values[j];
             Locale      locale          = (Locale)value2.Locale;
             DbfLocValue item            = new DbfLocValue();
             item.SetLocale(locale);
             item.SetValue(TextUtils.DecodeWhitespaces(value2.Value));
             val.Add(item);
         }
         DbfField field = new DbfField();
         field.SetColumnName(key);
         field.SetValue(val);
         record.AddField(field);
     }
 }