예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
 /// <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());
     }
 }
예제 #5
0
        /// <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);
        }
예제 #6
0
 /// <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));
 }