/// <summary>Helper: create a new instance to deserializing into</summary> public static KVResponse DeserializeLength(Stream stream, int length) { KVResponse instance = new KVResponse(); DeserializeLength(stream, length, instance); return(instance); }
/// <summary>Helper: create a new instance to deserializing into</summary> public static KVResponse DeserializeLengthDelimited(Stream stream) { KVResponse instance = new KVResponse(); DeserializeLengthDelimited(stream, instance); return(instance); }
/// <summary>Helper: create a new instance to deserializing into</summary> public static KVResponse Deserialize(Stream stream) { KVResponse instance = new KVResponse(); Deserialize(stream, instance); return(instance); }
/// <summary>Helper: Serialize into a MemoryStream and return its byte array</summary> public static byte[] SerializeToBytes(KVResponse instance) { using (var ms = new MemoryStream()) { Serialize(ms, instance); return(ms.ToArray()); } }
/// <summary>Helper: put the buffer into a MemoryStream and create a new instance to deserializing into</summary> public static KVResponse Deserialize(byte[] buffer) { KVResponse instance = new KVResponse(); using (var ms = new MemoryStream(buffer)) Deserialize(ms, instance); return(instance); }
/// <summary>Serialize the instance into the stream</summary> public static void Serialize(Stream stream, KVResponse instance) { // Key for field: 1, Varint stream.WriteByte(8); global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, instance.Status); if (instance.Message != null) { // Key for field: 2, LengthDelimited stream.WriteByte(18); global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Message)); } }
public void HandleMsg(System.Object state, TNetMsg msg) { Example.KVResponse response = Example.KVResponse.Deserialize(msg.m_DataMsg); message = response.Message; }