コード例 #1
0
		public static void Serialize (Stream stream, ReplyCustomHash instance)
		{
			if (instance.ChunkHash != null) {
				ProtocolParser.WriteKey (stream, new ProtocolBuffers.Key (1, Wire.LengthDelimited));
				ProtocolParser.WriteBytes (stream, instance.ChunkHash);
			}
		}
コード例 #2
0
		public static byte[] SerializeToBytes (ReplyCustomHash instance)
		{
			using (MemoryStream ms = new MemoryStream()) {
				Serialize (ms, instance);
				return ms.ToArray ();
			}
		}
コード例 #3
0
ファイル: PipeServer.cs プロジェクト: hultqvist/Whisper
        void ProcessGetCustomHash()
        {
            RequestCustomHash request = RequestCustomHash.Deserialize (ProtocolParser.ReadBytes (input));

            ReplyCustomHash reply = new ReplyCustomHash ();
            ChunkHash ch = localRepo.GetCustomHash (CustomID.FromBytes (request.CustomID));
            if (ch == null)
                reply.ChunkHash = null;
            else
                reply.ChunkHash = ch.bytes;
            //Console.Error.WriteLine("PipeServer: Sending: " + reply);
            byte[] rbytes = ReplyCustomHash.SerializeToBytes (reply);
            //Console.Error.WriteLine("PipeServer: Sending: " + rbytes.Length + ", " + BitConverter.ToString(rbytes));
            ProtocolParser.WriteBytes (output, rbytes);
        }
コード例 #4
0
		public static ReplyCustomHash Deserialize (Stream stream)
		{
			ReplyCustomHash instance = new ReplyCustomHash ();
			Deserialize (stream, instance);
			return instance;
		}