Example #1
0
        /// <summary>
        /// Sends the message.
        /// </summary>
        internal void Send()
        {
            if (this.UseRC4)
            {
                Authentification Auth = new Authentification();
                Auth.ClientVersion = this.Version;
                Auth.Encode();

                byte[] Encrypted = Auth.Writer.ToArray();

                this.RC4.Encrypt(ref Encrypted);

                Auth.Writer.Clear();
                Auth.Writer.AddRange(Encrypted);

                Auth.Header.Length = (uint)Encrypted.Length;

                int Sent = this.Socket.Send(Auth.ToBytes);

                Debug.WriteLine("-> We sent " + Auth.Header.Identifier + ". [" + this.Version[0] + "." + this.Version[1] + "." + this.Version[2] + "]");
            }
            else
            {
                Pre_Authentification _PreAuth = new Pre_Authentification();
                _PreAuth.Version = this.Version;
                _PreAuth.Encode();

                int Sent = this.Socket.Send(_PreAuth.ToBytes);

                Debug.WriteLine("-> We sent " + _PreAuth.Header.Identifier + ". [" + this.Version[0] + "." + this.Version[1] + "." + this.Version[2] + "]");
            }
        }