/// <summary>Helper: create a new instance to deserializing into</summary> public static KVLogin DeserializeLength(Stream stream, int length) { KVLogin instance = new KVLogin(); DeserializeLength(stream, length, instance); return(instance); }
/// <summary>Helper: create a new instance to deserializing into</summary> public static KVLogin DeserializeLengthDelimited(Stream stream) { KVLogin instance = new KVLogin(); DeserializeLengthDelimited(stream, instance); return(instance); }
/// <summary>Helper: create a new instance to deserializing into</summary> public static KVLogin Deserialize(Stream stream) { KVLogin instance = new KVLogin(); Deserialize(stream, instance); return(instance); }
/// <summary>Helper: Serialize into a MemoryStream and return its byte array</summary> public static byte[] SerializeToBytes(KVLogin 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 KVLogin Deserialize(byte[] buffer) { KVLogin instance = new KVLogin(); 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, KVLogin instance) { if (instance.Username == null) { throw new ArgumentNullException("Username", "Required by proto specification."); } // Key for field: 1, LengthDelimited stream.WriteByte(10); global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Username)); if (instance.Password == null) { throw new ArgumentNullException("Password", "Required by proto specification."); } // Key for field: 2, LengthDelimited stream.WriteByte(18); global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Password)); }