Пример #1
0
 public static void GetRecordHashtable(ICharacterRecordEntry entry, Hashtable ht)
 {
     foreach (FieldInfo field in entry.GetType().GetFields())
     {
         if (_JSONTypes.Contains(field.FieldType))
         {
             ht[field.Name] = field.GetValue(entry);
         }
     }
     entry.SaveUniqueData(ht);
 }
Пример #2
0
    public static void ReadFromHashtable(ICharacterRecordEntry entry, Hashtable record)
    {
        foreach (FieldInfo field in entry.GetType().GetFields())
        {
            if (_JSONTypes.Contains(field.FieldType))
            {
                if (field.FieldType == typeof(bool))
                {
                    field.SetValue(entry, EB.Dot.Bool(field.Name, record, (bool)field.GetValue(entry)));
                }
                else if (field.FieldType == typeof(float))
                {
                    field.SetValue(entry, EB.Dot.Single(field.Name, record, (float)field.GetValue(entry)));
                }
                else if (field.FieldType == typeof(long))
                {
                    field.SetValue(entry, EB.Dot.Long(field.Name, record, (long)field.GetValue(entry)));
                }
                else if (field.FieldType == typeof(int))
                {
                    field.SetValue(entry, EB.Dot.Integer(field.Name, record, (int)field.GetValue(entry)));
                }
                else if (field.FieldType == typeof(uint))
                {
                    field.SetValue(entry, EB.Dot.UInteger(field.Name, record, (uint)field.GetValue(entry)));
                }
                else if (field.FieldType == typeof(string))
                {
                    field.SetValue(entry, EB.Dot.String(field.Name, record, (string)field.GetValue(entry)));
                }

                /*else if (field.FieldType == typeof(ArrayList))
                 * {
                 *      field.SetValue(entry, EB.Dot.Array(field.Name, record, (ArrayList)field.GetValue(entry)));
                 * }
                 * else if (field.FieldType == typeof(Hashtable))
                 * {
                 *      field.SetValue(entry, EB.Dot.Object(field.Name, record, (Hashtable)field.GetValue(entry)));
                 * }*/
            }
        }
        entry.LoadUniqueData(record);
    }