public static object Deserialize(Stream stream, Type type) { if (protobufSerializer != null) { return(protobufSerializer.Deserialize(stream, type)); } return(null); }
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); }
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); }