Пример #1
0
        private void LoginUpdate()
        {
            GameConnection gameConnection;
            WebConnection  webConnection;

            if (Account.Socks.Version != SocksVersion.None)
            {
                gameConnection = new GameConnection((int)Account.Socks.Version, Account.Socks.Host,
                                                    Account.Socks.Port, Account.Socks.Username, Account.Socks.Password);
            }
            else
            {
                gameConnection = new GameConnection();
            }

            if (!string.IsNullOrEmpty(Account.HttpProxy.Host) && Account.HttpProxy.Port > 0)
            {
                webConnection = new WebConnection(Account.HttpProxy.Host, Account.HttpProxy.Port);
            }
            else
            {
                webConnection = new WebConnection();
            }

            if (Settings.ExtraHttpHeaders.Count > 0)
            {
                foreach (var header in Settings.ExtraHttpHeaders)
                {
                    webConnection.Client.DefaultRequestHeaders.Add(header.Key, header.Value);
                    if (header.Key.ToLowerInvariant() == "cookie")
                    {
                        webConnection.ParseCookies(header.Value);
                    }
                }
            }

            SetClient(new GameClient(gameConnection, webConnection, Settings.ProtocolKeys[0], Settings.ProtocolKeys[1]));
            if (!string.IsNullOrEmpty(Account.ID) && !string.IsNullOrEmpty(Account.Username))
            {
                Account.HashPassword = ObjectSerilizer.CalcSH1(Account.Username + Account.Password);
                Game.Open();
            }
            else
            {
                Game.SendWebsiteLogin(Account.Name, Account.Password);
            }
        }
Пример #2
0
 private void Client_SmartFoxApiOk()
 {
     Game.SendAuthentication(Account.Name, ObjectSerilizer.CalcSH1(Account.Name.ToLowerInvariant() + Account.Password));
 }