コード例 #1
0
 /// <summary>Helper: put the buffer into a MemoryStream and create a new instance to deserializing into</summary>
 public static MessageTokenACK Deserialize(byte[] buffer)
 {
     var instance = new MessageTokenACK();
     using (var ms = new MemoryStream(buffer))
         Deserialize(ms, instance);
     return instance;
 }
コード例 #2
0
 /// <summary>Helper: Serialize into a MemoryStream and return its byte array</summary>
 public static byte[] SerializeToBytes(MessageTokenACK instance)
 {
     using (var ms = new MemoryStream())
     {
         Serialize(ms, instance);
         return ms.ToArray();
     }
 }
コード例 #3
0
 /// <summary>Helper: Serialize with a varint length prefix</summary>
 public static void SerializeLengthDelimited(Stream stream, MessageTokenACK instance)
 {
     var data = SerializeToBytes(instance);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, (uint)data.Length);
     stream.Write(data, 0, data.Length);
 }
コード例 #4
0
 /// <summary>Serialize the instance into the stream</summary>
 public static void Serialize(Stream stream, MessageTokenACK instance)
 {
     var msField = global::SilentOrbit.ProtocolBuffers.ProtocolParser.Stack.Pop();
     if (instance.Token == null)
         throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("Token is required by the proto specification.");
     // Key for field: 1, LengthDelimited
     stream.WriteByte(10);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Token));
     // Key for field: 2, Varint
     stream.WriteByte(16);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt64(stream,(ulong)instance.Expire);
     // Key for field: 3, Varint
     stream.WriteByte(24);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt64(stream,(ulong)instance.Index);
     if (instance.RequestId == null)
         throw new global::SilentOrbit.ProtocolBuffers.ProtocolBufferException("RequestId is required by the proto specification.");
     // Key for field: 4, LengthDelimited
     stream.WriteByte(34);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.RequestId));
     // Key for field: 5, Varint
     stream.WriteByte(40);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt64(stream,(ulong)instance.BlockId);
     // Key for field: 6, Varint
     stream.WriteByte(48);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt64(stream,(ulong)instance.ClientId);
     // Key for field: 7, Varint
     stream.WriteByte(56);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt64(stream,(ulong)instance.BlockSize);
     // Key for field: 8, Varint
     stream.WriteByte(64);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt64(stream,(ulong)instance.Offset);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.Stack.Push(msField);
 }
コード例 #5
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static MessageTokenACK Deserialize(Stream stream)
 {
     var instance = new MessageTokenACK();
     Deserialize(stream, instance);
     return instance;
 }
コード例 #6
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static MessageTokenACK DeserializeLengthDelimited(Stream stream)
 {
     var instance = new MessageTokenACK();
     DeserializeLengthDelimited(stream, instance);
     return instance;
 }
コード例 #7
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static MessageTokenACK DeserializeLength(Stream stream, int length)
 {
     var instance = new MessageTokenACK();
     DeserializeLength(stream, length, instance);
     return instance;
 }