public Command52(byte[] commandID, byte[] senderPeerID, byte[] sourceSearchID, byte[] hashedFileHash)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (sourceSearchID == null)
                throw new ArgumentNullException("sourceSearchID");
            if (sourceSearchID.Length != 48)
                throw new ArgumentException();
            if (hashedFileHash == null)
                throw new ArgumentNullException("hashedFileHash");
            if (hashedFileHash.Length != 64)
                throw new ArgumentException();

            m_CommandID = commandID;
            m_SenderPeerID = senderPeerID;
            m_SourceSearchID = sourceSearchID;
            m_HashedFileHash = hashedFileHash;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x52);
            m_Command.Write(0x52);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_SourceSearchID);
            m_Command.Write(m_HashedFileHash);
        }
        public Command22(byte[] commandID, byte[] senderPeerID, byte[] searchID, string searchPattern)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (searchID == null)
                throw new ArgumentNullException("searchID");
            if (searchID.Length != 48)
                throw new ArgumentException();
            if (searchPattern == null)
                throw new ArgumentNullException("searchPattern");

            m_CommandID = commandID;
            m_SenderPeerID = senderPeerID;
            m_SearchID = searchID;
            m_SearchPattern = searchPattern;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x22);
            m_Command.Write(0x22);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_SearchID);
            m_Command.Write(m_SearchPattern);
        }
        public Command63(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] sourceSearchID)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (receiverPeerID == null)
                throw new ArgumentNullException("receiverPeerID");
            if (receiverPeerID.Length != 48)
                throw new ArgumentException();
            if (sourceSearchID == null)
                throw new ArgumentNullException("sourceSearchID");
            if (sourceSearchID.Length != 48)
                throw new ArgumentException();

            m_CommandID = commandID;
            m_SenderPeerID = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_SourceSearchID = sourceSearchID;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x63);
            m_Command.Write(0x63);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_SourceSearchID);
        }
        public Command44(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] downloadID)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (receiverPeerID == null)
                throw new ArgumentNullException("receiverPeerID");
            if (receiverPeerID.Length != 48)
                throw new ArgumentException();
            if (downloadID == null)
                throw new ArgumentNullException("downloadID");
            if (downloadID.Length != 48)
                throw new ArgumentException();

            m_CommandID = commandID;
            m_SenderPeerID = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_DownloadID = downloadID;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x44);
            m_Command.Write((byte)0x44);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_DownloadID);
        }
        public Command72(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] feedbackID)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (receiverPeerID == null)
                throw new ArgumentNullException("receiverPeerID");
            if (receiverPeerID.Length != 48)
                throw new ArgumentException();
            if (feedbackID == null)
                throw new ArgumentNullException("feedbackID");
            if (feedbackID.Length != 48)
                throw new ArgumentException();

            m_CommandID = commandID;
            m_SenderPeerID = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_FeedbackID = feedbackID;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x72);
            m_Command.Write((byte)0x72);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_FeedbackID);
        }
 public Command10(RSAParameters keys)
 {
     m_Keys = keys;
     m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.None, 0x10);
     m_Command.Write((byte)0x10);
     m_Command.Write((ushort)keys.Modulus.Length);
     m_Command.Write(keys.Modulus);
     m_Command.Write((ushort)keys.Exponent.Length);
     m_Command.Write(keys.Exponent);
 }
Exemple #7
0
 public Command11(RSAParameters keys)
 {
     m_Keys    = keys;
     m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.None, 0x11);
     m_Command.Write((byte)0x11);
     m_Command.Write((ushort)keys.Modulus.Length);
     m_Command.Write(keys.Modulus);
     m_Command.Write((ushort)keys.Exponent.Length);
     m_Command.Write(keys.Exponent);
 }
Exemple #8
0
 public Command12(RijndaelParameters keys)
 {
     m_Keys    = keys;
     m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.RSA, 0x12);
     m_Command.Write((byte)0x12);
     m_Command.Write((ushort)m_Keys.BlockSize);
     m_Command.Write((ushort)m_Keys.FeedbackSize);
     m_Command.Write((ushort)m_Keys.KeySize);
     m_Command.Write((byte)m_Keys.Mode);
     m_Command.Write((byte)m_Keys.Padding);
     m_Command.Write((byte)m_Keys.IV.Length);
     m_Command.Write(m_Keys.IV);
     m_Command.Write((byte)m_Keys.Key.Length);
     m_Command.Write(m_Keys.Key);
 }
 public Command12(RijndaelParameters keys)
 {
     m_Keys = keys;
     m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.RSA, 0x12);
     m_Command.Write((byte)0x12);
     m_Command.Write((ushort)m_Keys.BlockSize);
     m_Command.Write((ushort)m_Keys.FeedbackSize);
     m_Command.Write((ushort)m_Keys.KeySize);
     m_Command.Write((byte)m_Keys.Mode);
     m_Command.Write((byte)m_Keys.Padding);
     m_Command.Write((byte)m_Keys.IV.Length);
     m_Command.Write(m_Keys.IV);
     m_Command.Write((byte)m_Keys.Key.Length);
     m_Command.Write(m_Keys.Key);
 }
Exemple #10
0
        public Command44(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] downloadID)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (receiverPeerID == null)
            {
                throw new ArgumentNullException("receiverPeerID");
            }
            if (receiverPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (downloadID == null)
            {
                throw new ArgumentNullException("downloadID");
            }
            if (downloadID.Length != 48)
            {
                throw new ArgumentException();
            }

            m_CommandID      = commandID;
            m_SenderPeerID   = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_DownloadID     = downloadID;
            m_Command        = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x44);
            m_Command.Write((byte)0x44);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_DownloadID);
        }
Exemple #11
0
        public Command72(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] feedbackID)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (receiverPeerID == null)
            {
                throw new ArgumentNullException("receiverPeerID");
            }
            if (receiverPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (feedbackID == null)
            {
                throw new ArgumentNullException("feedbackID");
            }
            if (feedbackID.Length != 48)
            {
                throw new ArgumentException();
            }

            m_CommandID      = commandID;
            m_SenderPeerID   = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_FeedbackID     = feedbackID;
            m_Command        = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x72);
            m_Command.Write((byte)0x72);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_FeedbackID);
        }
Exemple #12
0
        public Command52(byte[] commandID, byte[] senderPeerID, byte[] sourceSearchID, byte[] hashedFileHash)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (sourceSearchID == null)
            {
                throw new ArgumentNullException("sourceSearchID");
            }
            if (sourceSearchID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (hashedFileHash == null)
            {
                throw new ArgumentNullException("hashedFileHash");
            }
            if (hashedFileHash.Length != 64)
            {
                throw new ArgumentException();
            }

            m_CommandID      = commandID;
            m_SenderPeerID   = senderPeerID;
            m_SourceSearchID = sourceSearchID;
            m_HashedFileHash = hashedFileHash;
            m_Command        = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x52);
            m_Command.Write(0x52);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_SourceSearchID);
            m_Command.Write(m_HashedFileHash);
        }
Exemple #13
0
        public Command63(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] sourceSearchID)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (receiverPeerID == null)
            {
                throw new ArgumentNullException("receiverPeerID");
            }
            if (receiverPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (sourceSearchID == null)
            {
                throw new ArgumentNullException("sourceSearchID");
            }
            if (sourceSearchID.Length != 48)
            {
                throw new ArgumentException();
            }

            m_CommandID      = commandID;
            m_SenderPeerID   = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_SourceSearchID = sourceSearchID;
            m_Command        = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x63);
            m_Command.Write(0x63);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_SourceSearchID);
        }
Exemple #14
0
        public Command21(byte[] commandID, ushort reserved, ushort hopCount, byte[] senderPeerID, byte[] searchID, string searchPattern)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (searchID == null)
                throw new ArgumentNullException("searchID");
            if (searchID.Length != 48)
                throw new ArgumentException();
            if (searchPattern == null)
                throw new ArgumentNullException("searchPattern");

            m_CommandID = commandID;
            m_Reserved = reserved;
            m_HopCount = hopCount;
            m_SenderPeerID = senderPeerID;
            m_SearchID = searchID;
            m_SearchPattern = searchPattern;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x21);
            m_Command.Write(0x21);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_Reserved);
            m_Command.Write(m_HopCount);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_SearchID);
            m_Command.Write(m_SearchPattern);
        }
Exemple #15
0
        public Command61(byte[] commandID, ushort reserved, ushort hopCount, byte[] senderPeerID, byte[] sourceSearchID, byte[] hashedFileHash)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (sourceSearchID == null)
                throw new ArgumentNullException("sourceSearchID");
            if (sourceSearchID.Length != 48)
                throw new ArgumentException();
            if (hashedFileHash == null)
                throw new ArgumentNullException("hashedFileHash");
            if (hashedFileHash.Length != 64)
                throw new ArgumentException();

            m_CommandID = commandID;
            m_Reserved = reserved;
            m_HopCount = hopCount;
            m_SenderPeerID = senderPeerID;
            m_SourceSearchID = sourceSearchID;
            m_HashedFileHash = hashedFileHash;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x61);
            m_Command.Write(0x61);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_Reserved);
            m_Command.Write(m_HopCount);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_SourceSearchID);
            m_Command.Write(m_HashedFileHash);
        }
Exemple #16
0
        public Command22(byte[] commandID, byte[] senderPeerID, byte[] searchID, string searchPattern)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (searchID == null)
            {
                throw new ArgumentNullException("searchID");
            }
            if (searchID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (searchPattern == null)
            {
                throw new ArgumentNullException("searchPattern");
            }

            m_CommandID     = commandID;
            m_SenderPeerID  = senderPeerID;
            m_SearchID      = searchID;
            m_SearchPattern = searchPattern;
            m_Command       = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x22);
            m_Command.Write(0x22);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_SearchID);
            m_Command.Write(m_SearchPattern);
        }
Exemple #17
0
        public Command7A(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] downloadID, byte[] fileHashCodeResult)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (receiverPeerID == null)
            {
                throw new ArgumentNullException("receiverPeerID");
            }
            if (receiverPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (downloadID == null)
            {
                throw new ArgumentNullException("downloadID");
            }
            if (downloadID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (fileHashCodeResult == null)
            {
                throw new ArgumentNullException("fileHashCodeResult");
            }
            if (fileHashCodeResult.Length != 64)
            {
                throw new ArgumentException();
            }

            m_CommandID          = commandID;
            m_SenderPeerID       = senderPeerID;
            m_ReceiverPeerID     = receiverPeerID;
            m_DownloadID         = downloadID;
            m_FileHashCodeResult = fileHashCodeResult;
            m_Command            = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x7A);
            m_Command.Write((byte)0x7A);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_DownloadID);
            m_Command.Write(m_FileHashCodeResult);
        }
Exemple #18
0
        public Command61(byte[] commandID, ushort reserved, ushort hopCount, byte[] senderPeerID, byte[] sourceSearchID, byte[] hashedFileHash)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (sourceSearchID == null)
            {
                throw new ArgumentNullException("sourceSearchID");
            }
            if (sourceSearchID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (hashedFileHash == null)
            {
                throw new ArgumentNullException("hashedFileHash");
            }
            if (hashedFileHash.Length != 64)
            {
                throw new ArgumentException();
            }

            m_CommandID      = commandID;
            m_Reserved       = reserved;
            m_HopCount       = hopCount;
            m_SenderPeerID   = senderPeerID;
            m_SourceSearchID = sourceSearchID;
            m_HashedFileHash = hashedFileHash;
            m_Command        = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x61);
            m_Command.Write(0x61);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_Reserved);
            m_Command.Write(m_HopCount);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_SourceSearchID);
            m_Command.Write(m_HashedFileHash);
        }
Exemple #19
0
        public Command21(byte[] commandID, ushort reserved, ushort hopCount, byte[] senderPeerID, byte[] searchID, string searchPattern)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (searchID == null)
            {
                throw new ArgumentNullException("searchID");
            }
            if (searchID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (searchPattern == null)
            {
                throw new ArgumentNullException("searchPattern");
            }

            m_CommandID     = commandID;
            m_Reserved      = reserved;
            m_HopCount      = hopCount;
            m_SenderPeerID  = senderPeerID;
            m_SearchID      = searchID;
            m_SearchPattern = searchPattern;
            m_Command       = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x21);
            m_Command.Write(0x21);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_Reserved);
            m_Command.Write(m_HopCount);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_SearchID);
            m_Command.Write(m_SearchPattern);
        }
Exemple #20
0
        public Command7A(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] downloadID, byte[] fileHashCodeResult)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (receiverPeerID == null)
                throw new ArgumentNullException("receiverPeerID");
            if (receiverPeerID.Length != 48)
                throw new ArgumentException();
            if (downloadID == null)
                throw new ArgumentNullException("downloadID");
            if (downloadID.Length != 48)
                throw new ArgumentException();
            if (fileHashCodeResult == null)
                throw new ArgumentNullException("fileHashCodeResult");
            if (fileHashCodeResult.Length != 64)
                throw new ArgumentException();

            m_CommandID = commandID;
            m_SenderPeerID = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_DownloadID = downloadID;
            m_FileHashCodeResult = fileHashCodeResult;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x7A);
            m_Command.Write((byte)0x7A);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_DownloadID);
            m_Command.Write(m_FileHashCodeResult);
        }
Exemple #21
0
        public Command53(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] sourceSearchID, uint fileSize, string fileName, RIndexedHashtable<string, string> metaData, string comment, byte rating)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (receiverPeerID == null)
                throw new ArgumentNullException("receiverPeerID");
            if (receiverPeerID.Length != 48)
                throw new ArgumentException();
            if (sourceSearchID == null)
                throw new ArgumentNullException("sourceSearchID");
            if (sourceSearchID.Length != 48)
                throw new ArgumentException();
            if (fileName == null)
                throw new ArgumentNullException("fileName");
            if (metaData == null)
                throw new ArgumentNullException("metaData");
            if (comment == null)
                throw new ArgumentNullException("comment");

            m_CommandID = commandID;
            m_SenderPeerID = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_SourceSearchID = sourceSearchID;
            m_FileSize = fileSize;
            m_FileName = fileName;
            m_MetaData = metaData;
            m_Rating = rating;
            m_Comment = comment;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x53);
            m_Command.Write(0x53);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_SourceSearchID);
            m_Command.Write(m_FileSize);
            m_Command.Write(m_FileName);
            m_Command.Write((ushort)m_MetaData.Count);
            foreach (KeyValuePair<string, string> metaDataItem in metaData)
            {
                m_Command.Write(metaDataItem.Key);
                m_Command.Write(metaDataItem.Value);
            }
            m_Command.Write(m_Comment);
            m_Command.Write(m_Rating);
        }
Exemple #22
0
        public Command79(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] downloadID, uint sector, byte[] sectorData, byte[] sectorHashCodeResult)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (receiverPeerID == null)
                throw new ArgumentNullException("receiverPeerID");
            if (receiverPeerID.Length != 48)
                throw new ArgumentException();
            if (downloadID == null)
                throw new ArgumentNullException("downloadID");
            if (downloadID.Length != 48)
                throw new ArgumentException();
            if (sectorData == null)
                throw new ArgumentNullException("sectorData");
            if (sectorHashCodeResult == null)
                throw new ArgumentNullException("sectorHashCodeResult");
            if (sectorHashCodeResult.Length != 64)
                throw new ArgumentException();

            m_CommandID = commandID;
            m_SenderPeerID = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_DownloadID = downloadID;
            m_Sector = sector;
            m_SectorData = sectorData;
            m_SectorHashCodeResult = sectorHashCodeResult;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x79);
            m_Command.Write((byte)0x79);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_DownloadID);
            m_Command.Write(m_Sector);
            m_Command.Write((ushort)m_SectorData.Length);
            m_Command.Write(m_SectorData);
            m_Command.Write(m_SectorHashCodeResult);
        }
Exemple #23
0
        public Command79(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] downloadID, uint sector, byte[] sectorData, byte[] sectorHashCodeResult)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (receiverPeerID == null)
            {
                throw new ArgumentNullException("receiverPeerID");
            }
            if (receiverPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (downloadID == null)
            {
                throw new ArgumentNullException("downloadID");
            }
            if (downloadID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (sectorData == null)
            {
                throw new ArgumentNullException("sectorData");
            }
            if (sectorHashCodeResult == null)
            {
                throw new ArgumentNullException("sectorHashCodeResult");
            }
            if (sectorHashCodeResult.Length != 64)
            {
                throw new ArgumentException();
            }

            m_CommandID            = commandID;
            m_SenderPeerID         = senderPeerID;
            m_ReceiverPeerID       = receiverPeerID;
            m_DownloadID           = downloadID;
            m_Sector               = sector;
            m_SectorData           = sectorData;
            m_SectorHashCodeResult = sectorHashCodeResult;
            m_Command              = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x79);
            m_Command.Write((byte)0x79);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_DownloadID);
            m_Command.Write(m_Sector);
            m_Command.Write((ushort)m_SectorData.Length);
            m_Command.Write(m_SectorData);
            m_Command.Write(m_SectorHashCodeResult);
        }
Exemple #24
0
        public Command23(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] searchID, RList<SearchResult> searchResults)
        {
            if (commandID == null)
                throw new ArgumentNullException("commandID");
            if (commandID.Length != 48)
                throw new ArgumentException();
            if (senderPeerID == null)
                throw new ArgumentNullException("senderPeerID");
            if (senderPeerID.Length != 48)
                throw new ArgumentException();
            if (receiverPeerID == null)
                throw new ArgumentNullException("receiverPeerID");
            if (receiverPeerID.Length != 48)
                throw new ArgumentException();
            if (searchID == null)
                throw new ArgumentNullException("searchID");
            if (searchID.Length != 48)
                throw new ArgumentException();
            if (searchResults == null)
                throw new ArgumentNullException("searchResults");

            m_CommandID = commandID;
            m_SenderPeerID = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_SearchID = searchID;
            m_SearchResults = searchResults;
            m_Command = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x23);
            m_Command.Write(0x23);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_SearchID);
            m_Command.Write((ushort)m_SearchResults.Count);
            foreach (SearchResult searchResult in searchResults)
            {
                m_Command.Write(searchResult.FileHash);
                m_Command.Write(searchResult.FileSize);
                m_Command.Write(searchResult.FileName);
                m_Command.Write((ushort)searchResult.MetaData.Count);
                foreach (KeyValuePair<string, string> metaData in searchResult.MetaData)
                {
                    m_Command.Write(metaData.Key);
                    m_Command.Write(metaData.Value);
                }
                m_Command.Write(searchResult.Comment);
                m_Command.Write(searchResult.Rating);
            }
        }
Exemple #25
0
        public Command23(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] searchID, RList <SearchResult> searchResults)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (receiverPeerID == null)
            {
                throw new ArgumentNullException("receiverPeerID");
            }
            if (receiverPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (searchID == null)
            {
                throw new ArgumentNullException("searchID");
            }
            if (searchID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (searchResults == null)
            {
                throw new ArgumentNullException("searchResults");
            }

            m_CommandID      = commandID;
            m_SenderPeerID   = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_SearchID       = searchID;
            m_SearchResults  = searchResults;
            m_Command        = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x23);
            m_Command.Write(0x23);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_SearchID);
            m_Command.Write((ushort)m_SearchResults.Count);
            foreach (SearchResult searchResult in searchResults)
            {
                m_Command.Write(searchResult.FileHash);
                m_Command.Write(searchResult.FileSize);
                m_Command.Write(searchResult.FileName);
                m_Command.Write((ushort)searchResult.MetaData.Count);
                foreach (KeyValuePair <string, string> metaData in searchResult.MetaData)
                {
                    m_Command.Write(metaData.Key);
                    m_Command.Write(metaData.Value);
                }
                m_Command.Write(searchResult.Comment);
                m_Command.Write(searchResult.Rating);
            }
        }
Exemple #26
0
        public Command54(byte[] commandID, byte[] senderPeerID, byte[] receiverPeerID, byte[] sourceSearchID, uint fileSize, string fileName, RIndexedHashtable <string, string> metaData, string comment, byte rating, byte[] sectorsMap)
        {
            if (commandID == null)
            {
                throw new ArgumentNullException("commandID");
            }
            if (commandID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (senderPeerID == null)
            {
                throw new ArgumentNullException("senderPeerID");
            }
            if (senderPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (receiverPeerID == null)
            {
                throw new ArgumentNullException("receiverPeerID");
            }
            if (receiverPeerID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (sourceSearchID == null)
            {
                throw new ArgumentNullException("sourceSearchID");
            }
            if (sourceSearchID.Length != 48)
            {
                throw new ArgumentException();
            }
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }
            if (metaData == null)
            {
                throw new ArgumentNullException("metaData");
            }
            if (comment == null)
            {
                throw new ArgumentNullException("comment");
            }
            if (sectorsMap == null)
            {
                throw new ArgumentNullException("sectorsMap");
            }

            m_CommandID      = commandID;
            m_SenderPeerID   = senderPeerID;
            m_ReceiverPeerID = receiverPeerID;
            m_SourceSearchID = sourceSearchID;
            m_FileSize       = fileSize;
            m_FileName       = fileName;
            m_MetaData       = metaData;
            m_Rating         = rating;
            m_Comment        = comment;
            m_SectorsMap     = sectorsMap;
            m_Command        = new CommandBuilder(CommandBuilder.EncryptionMethod.Rijndael, 0x54);
            m_Command.Write(0x54);
            m_Command.Write(m_CommandID);
            m_Command.Write(m_SenderPeerID);
            m_Command.Write(m_ReceiverPeerID);
            m_Command.Write(m_SourceSearchID);
            m_Command.Write(m_FileSize);
            m_Command.Write(m_FileName);
            m_Command.Write((ushort)m_MetaData.Count);
            foreach (KeyValuePair <string, string> metaDataItem in metaData)
            {
                m_Command.Write(metaDataItem.Key);
                m_Command.Write(metaDataItem.Value);
            }
            m_Command.Write(m_Comment);
            m_Command.Write(m_Rating);
            m_Command.Write((ushort)m_SectorsMap.Length);
            m_Command.Write(m_SectorsMap);
        }