Пример #1
0
 public static object Deserialize(string data, Type t)
 {
     if (t == null)
     {
         return(null);
     }
     if (((data != null) ? data.Length : 0) != 0)
     {
         if (t.IsEnum)
         {
             return(Enum.ToObject(t, BloxStringSerializer.ToInt(data)));
         }
         if (t.IsArray)
         {
             return(BloxStringSerializer.DeserializeArray(data, t));
         }
         if (t.IsGenericType)
         {
             if (t.GetGenericTypeDefinition() == typeof(List <>))
             {
                 return(BloxStringSerializer.DeserializeList(data, t));
             }
             return(null);
         }
         if (BloxStringSerializer.readers.ContainsKey(t))
         {
             return(BloxStringSerializer.readers[t](data));
         }
         return(JsonUtility.FromJson(data, t));
     }
     return(BloxMemberInfo.GetDefaultValue(t));
 }