Esempio n. 1
0
 public override MemoryStream[] WritePacket()
 {
     m_answerTimer.StartCountDown(4000);
     // [ChallengeResult 32]
     using (BinaryWriter res = new BinaryWriter(new MemoryStream(64), Encoding.UTF8, true))
     {
         try
         {
             res.BaseStream.Position = 0 + BBProtocol.TCP_HEADERSIZE;
             BBProtocol.WriteByteArray(ChallengeResult, res);
             return(CreateFragments(res, Opcode));
         }
         catch (Exception e) when(e is IOException || e is IOException)
         {
             ParseError = "Error while writing packet - " + e.Message;
             Log.e(BbTcpPacket.TAG, ParseError);
             return(null);
         }
     }
 }
Esempio n. 2
0
        public override MemoryStream[] WritePacket()
        {
            m_answerTimer.StartCountDown(4000);
            // [KeySource 1] [LocalIV 16][RemoteIV 16] [LocalPublicKey 256]
            using (BinaryWriter res = new BinaryWriter(new MemoryStream(512), Encoding.UTF8, true))
            {
                try
                {
                    res.BaseStream.Position = 0 + BBProtocol.TCP_HEADERSIZE;
                    res.Write((byte)Method);
                    BBProtocol.WriteByteArray(LocalIV, res);
                    BBProtocol.WriteByteArray(RemoteIV, res);
                    BBProtocol.WriteByteArray(LocalPublicKey, res);

                    return(CreateFragments(res, Opcode));
                }
                catch (Exception e) when(e is IOException || e is IOException)
                {
                    ParseError = "Error while writing packet - " + e.Message;
                    Log.e(BbTcpPacket.TAG, ParseError);
                    return(null);
                }
            }
        }