예제 #1
0
        private Hashtable RebuildDict(ISFSObject sfsObj)
        {
            Hashtable hashtable = new Hashtable();

            string[] keys = sfsObj.GetKeys();
            foreach (string key in keys)
            {
                hashtable[key] = UnwrapField(sfsObj.GetData(key));
            }
            return(hashtable);
        }
예제 #2
0
 private void ConvertSFSObject(ISFSArray fieldList, object csObj, Type objType)
 {
     for (int i = 0; i < fieldList.Size(); i++)
     {
         ISFSObject     sFSObject = fieldList.GetSFSObject(i);
         string         utfString = sFSObject.GetUtfString(FIELD_NAME_KEY);
         SFSDataWrapper data      = sFSObject.GetData(FIELD_VALUE_KEY);
         object         value     = UnwrapField(data);
         objType.GetField(utfString, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(csObj, value);
     }
 }
예제 #3
0
 private ByteArray Obj2bin(ISFSObject obj, ByteArray buffer)
 {
     string[] keys  = obj.GetKeys();
     string[] array = keys;
     foreach (string text in array)
     {
         SFSDataWrapper data = obj.GetData(text);
         buffer = EncodeSFSObjectKey(buffer, text);
         buffer = EncodeObject(buffer, data.Type, data.Data);
     }
     return(buffer);
 }
예제 #4
0
 public void flattenObject(Dictionary <string, object> map, ISFSObject sfsObj)
 {
     string[] keys = sfsObj.GetKeys();
     foreach (string key in keys)
     {
         SFSDataWrapper data = sfsObj.GetData(key);
         if (data.Type == 18)
         {
             Dictionary <string, object> dictionary = new Dictionary <string, object>();
             map.Add(key, dictionary);
             flattenObject(dictionary, (ISFSObject)data.Data);
         }
         else if (data.Type == 17)
         {
             List <object> list = new List <object>();
             map.Add(key, list);
             flattenArray(list, (ISFSArray)data.Data);
         }
         else
         {
             map.Add(key, data.Data);
         }
     }
 }