public static byte[] CreateFileUnparticipate(BinaryID fileID)
        {
            using (MemoryStream mS = new MemoryStream(fileID.ID.Length + 1 + 1))
            {
                mS.WriteByte((byte)BitChatMessageType.FileShareUnparticipate); //1 byte
                fileID.WriteTo(mS);

                return(mS.ToArray());
            }
        }
        public static byte[] CreateFileBlockAvailable(BinaryID fileID, int blockNumber)
        {
            using (MemoryStream mS = new MemoryStream(fileID.ID.Length + 1 + 1 + 4))
            {
                mS.WriteByte((byte)BitChatMessageType.FileBlockAvailable); //1 byte
                fileID.WriteTo(mS);
                mS.Write(BitConverter.GetBytes(blockNumber), 0, 4);        //4 bytes

                return(mS.ToArray());
            }
        }
        public static byte[] CreateFileBlockRequest(BinaryID fileID, int blockNumber, ushort dataPort)
        {
            using (MemoryStream mS = new MemoryStream(fileID.ID.Length + 1 + 1 + 4 + 2))
            {
                mS.WriteByte((byte)BitChatMessageType.FileBlockRequest); //1 byte
                fileID.WriteTo(mS);
                mS.Write(BitConverter.GetBytes(blockNumber), 0, 4);      //4 bytes
                mS.Write(BitConverter.GetBytes(dataPort), 0, 2);         //2 bytes

                return(mS.ToArray());
            }
        }
Пример #4
0
 public void WriteTo(Stream s)
 {
     _hmac.WriteTo(s);
 }
Пример #5
0
 public void WriteTo(Stream s)
 {
     _nonce.WriteTo(s);
     s.WriteByte((byte)_cryptoOptions);
 }
Пример #6
0
 public override void WriteTo(Stream s)
 {
     _hmac.WriteTo(s);
 }