public static object DeserializeFrom(ushort opcode, Type type, MemoryStream stream)
        {
            if (opcode >= 20000)
            {
                return(ProtobufHelper.FromStream(type, stream));
            }

            return(MongoHelper.FromStream(type, stream));
        }
Exemple #2
0
        public static object DeserializeFrom(ushort opcode, Type type, MemoryStream memoryStream)
        {
            if (opcode < OpcodeRangeDefine.PbMaxOpcode)
            {
                return(ProtobufHelper.FromStream(type, memoryStream));
            }

            if (opcode >= OpcodeRangeDefine.JsonMinOpcode)
            {
                return(JsonHelper.FromJson(type, memoryStream.GetBuffer().ToStr((int)memoryStream.Position, (int)(memoryStream.Length - memoryStream.Position))));
            }
            return(MongoHelper.FromStream(type, memoryStream));
        }
Exemple #3
0
        public static object DeserializeFrom(ushort opcode, Type type, MemoryStream memoryStream)
        {
            if (opcode < OpcodeRangeDefine.PbMaxOpcode)
            {
                return(ProtobufHelper.FromStream(type, memoryStream));
            }

            if (opcode >= OpcodeRangeDefine.JsonMinOpcode)
            {
                return(JsonHelper.FromJson(type, memoryStream.GetBuffer().ToStr((int)memoryStream.Position, (int)(memoryStream.Length - memoryStream.Position))));
            }
#if NOT_UNITY
            return(MongoHelper.FromStream(type, memoryStream));
#else
            throw new Exception($"client no message: {opcode}");
#endif
        }
Exemple #4
0
 public object DeserializeFrom(Type type, MemoryStream stream)
 {
     return(MongoHelper.FromStream(type, stream));
 }