Ejemplo n.º 1
0
 public static object Deserialize(Stream stream, Type type)
 {
     if (protobufSerializer != null)
     {
         return(protobufSerializer.Deserialize(stream, type));
     }
     return(null);
 }
Ejemplo n.º 2
0
        public object DeserializeByteBuffer(byte[] buffer, int offset, int size, Type protoType)
        {
            MemoryStream source = new MemoryStream(buffer, offset, size);
            object       result = null;

            try
            {
                result = protobufSerializer.Deserialize(source, protoType);
            }
            catch (Exception ex)
            {
                LoggerManager.Instance.Error(ex.StackTrace);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public Object DeserializeByteBuffer(Common.NetworkBuffer inBuffer, int offset, int size, Type protoType)
        {
            MemoryStream stream    = new MemoryStream(inBuffer.GetBuffer(), offset, size);
            Object       outObject = null;

            try
            {
                outObject            = protobufSerializer.Deserialize(stream, protoType);
                inBuffer.ReadOffset += size;
            }
            catch (Exception ex)
            {
                Logger.Error(ex.StackTrace);
            }
            return(outObject);
        }