예제 #1
0
        public static ServerListEntry Create(ref PacketBufferReader p)
        {
            ServerListEntry entry = new ServerListEntry()
            {
                Index       = p.ReadUShort(),
                Name        = p.ReadASCII(32).MakeSafe(),
                PercentFull = p.ReadByte(),
                Timezone    = p.ReadByte(),
                Address     = p.ReadUInt()
            };

            // some server sends invalid ip.
            try
            {
                entry._ipAddress = new IPAddress
                                   (
                    new byte[]
                {
                    (byte)((entry.Address >> 24) & 0xFF),
                    (byte)((entry.Address >> 16) & 0xFF),
                    (byte)((entry.Address >> 8) & 0xFF),
                    (byte)(entry.Address & 0xFF)
                }
                                   );
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }

            entry._pinger.PingCompleted += entry.PingerOnPingCompleted;

            return(entry);
        }
예제 #2
0
        public void ServerListReceived(ref PacketBufferReader p)
        {
            byte   flags = p.ReadByte();
            ushort count = p.ReadUShort();

            DisposeAllServerEntries();
            Servers = new ServerListEntry[count];

            for (ushort i = 0; i < count; i++)
            {
                Servers[i] = ServerListEntry.Create(ref p);
            }

            CurrentLoginStep = LoginSteps.ServerSelection;

            if (Settings.GlobalSettings.AutoLogin || Reconnect)
            {
                if (Servers.Length != 0)
                {
                    int index = Settings.GlobalSettings.LastServerNum;

                    if (index <= 0 || index > Servers.Length)
                    {
                        Log.Warn($"Wrong server index: {index}");
                        index = 1;
                    }

                    SelectServer((byte)Servers[index - 1].Index);
                }
            }
        }
예제 #3
0
        public void ServerListReceived(ref PacketBufferReader p)
        {
            byte   flags = p.ReadByte();
            ushort count = p.ReadUShort();

            DisposeAllServerEntries();
            Servers = new ServerListEntry[count];

            for (ushort i = 0; i < count; i++)
            {
                Servers[i] = ServerListEntry.Create(ref p);
            }

            CurrentLoginStep = LoginSteps.ServerSelection;

            if (Settings.GlobalSettings.AutoLogin || Reconnect)
            {
                if (Servers.Length != 0)
                {
                    int index = GetServerIndexFromSettings();

                    SelectServer((byte)Servers[index].Index);
                }
            }
        }
예제 #4
0
        public void ServerListReceived(ref StackDataReader p)
        {
            byte   flags = p.ReadUInt8();
            ushort count = p.ReadUInt16BE();

            DisposeAllServerEntries();
            Servers = new ServerListEntry[count];

            for (ushort i = 0; i < count; i++)
            {
                Servers[i] = ServerListEntry.Create(ref p);
            }

            CurrentLoginStep = LoginSteps.ServerSelection;

            if (CanAutologin)
            {
                if (Servers.Length != 0)
                {
                    int index = GetServerIndexFromSettings();

                    SelectServer((byte)Servers[index].Index);
                }
            }
        }
예제 #5
0
        private void ParseServerList(Packet reader)
        {
            byte   flags = reader.ReadByte();
            ushort count = reader.ReadUShort();

            Servers = new ServerListEntry[count];
            for (ushort i = 0; i < count; i++)
            {
                Servers[i] = new ServerListEntry(reader);
            }
        }