コード例 #1
0
        public void sendPacket(SendBaseLoginPacket bp)
        {
            bp.write();
            byte[]      array = bp.ToByteArray();
            short       value = Convert.ToInt16(array.Length - 2);
            List <byte> list  = new List <byte>(array.Length + 2);

            list.AddRange(BitConverter.GetBytes(value));
            list.AddRange(array);
            byte[] array2 = list.ToArray();
            byte[] value2 = new byte[]
            {
                array2[2],
                array2[3]
            };
            ushort num  = BitConverter.ToUInt16(value2, 0);
            bool   flag = this.networkDebug;

            if (flag)
            {
                string[] array3 = BitConverter.ToString(array2).Split(new char[]
                {
                    '-',
                    ',',
                    '.',
                    ':',
                    '\t'
                });
                string   str    = "";
                string[] array4 = array3;
                for (int i = 0; i < array4.Length; i++)
                {
                    string str2 = array4[i];
                    str = str + "0x" + str2 + " ";
                }
            }
            bool flag2 = array2.Length != 0;

            if (flag2)
            {
                this._stream.BeginWrite(array2, 0, array2.Length, new AsyncCallback(this.EndSendCallBackStatic), null);
            }
            bool flag3 = num != 545;

            if (flag3)
            {
                CLogger.getInstance().console("-------------------------------------------------------------------------------");
                CLogger.getInstance().packet("Send: " + array2.Length);
                CLogger.getInstance().packet("Opcode [Send Login]: " + num);
                CLogger.getInstance().console("-------------------------------------------------------------------------------");
                CLogger.getInstance().sendpacket(Utils.HexDump(array2));
                CLogger.getInstance().console("-------------------------------------------------------------------------------");
            }
        }
コード例 #2
0
ファイル: LoginClient.cs プロジェクト: sortaloc/PBlackout
        public void sendPacket(SendBaseLoginPacket bp)
        {
            bp.write();
            byte[]      numArray1 = bp.ToByteArray();
            short       num       = Convert.ToInt16(numArray1.Length - 2);
            List <byte> list      = new List <byte>(numArray1.Length + 2);

            list.AddRange((IEnumerable <byte>)BitConverter.GetBytes(num));
            list.AddRange((IEnumerable <byte>)numArray1);
            byte[] buffer    = list.ToArray();
            byte[] numArray2 = new byte[2]
            {
                buffer[2],
                buffer[3]
            };
            CLogger.getInstance().extra_info(string.Concat(new object[4]
            {
                (object)"Send :",
                (object)buffer.Length,
                (object)"; Opcode: ",
                (object)BitConverter.ToUInt16(numArray2, 0)
            }));
            if (this.networkDebug)
            {
                string[] strArray = BitConverter.ToString(buffer).Split('-', ',', '.', ':', '\t');
                string   str1     = "";
                foreach (string str2 in strArray)
                {
                    str1 = str1 + "0x" + str2 + " ";
                }
            }
            if (buffer.Length <= 0)
            {
                return;
            }
            this._stream.BeginWrite(buffer, 0, buffer.Length, new AsyncCallback(this.EndSendCallBackStatic), (object)null);
        }