public static object DeserializeFrom(ushort opcode, Type type, MemoryStream stream) { if (opcode >= 20000) { return(ProtobufHelper.FromStream(type, stream)); } return(MongoHelper.FromStream(type, stream)); }
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)); }
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 }
public object DeserializeFrom(Type type, MemoryStream stream) { return(MongoHelper.FromStream(type, stream)); }