DarkEmu_LoginServer.PacketWriter2.AddString C# (CSharp) Method

AddString() public method

public AddString ( string s, int size ) : void
s string
size int
return void
        public void AddString(string s, int size)
        {
            byte[] bytes = Encoding.ASCII.GetBytes(s);
            ms.Write(bytes, 0, bytes.Length);

            AddByteTimes(0x00, size - s.Length);
        }

Usage Example

Beispiel #1
0
        private static void SendServerUnk1(int ClientIndex)
        {
            /*
             * 43 00 L
             * 07 A1 Opcode
             * 00 00 Secu
             *
             * 03 00 count
             *
             * 11 00
             * 67 73 70 6B 72 31 2E 6A 6F 79 6D 61 78 2E 63 6F 6D BD string_ip
             * 32 01 port
             */
            PacketWriter2 writer = new PacketWriter2(SERVER_OPCODES.LOGIN_SERVER_AUTH_UNK1);

            writer.AddByte(0x01);
            writer.AddByte(0x00);
            string str_ip = "127.0.0.1";

            writer.AddByte(0x09);
            writer.AddByte(0x00);
            writer.AddString(str_ip, str_ip.Length);
            writer.AddByte(0x3D);
            writer.AddByte(0xA4);
            ServerSocket.Send(writer.GetBytes(), ClientIndex);
        }
All Usage Examples Of DarkEmu_LoginServer.PacketWriter2::AddString