コード例 #1
0
 public static void Load()
 {
     if (queue == null)
     {
         queue = new Dictionary <long, User>();
     }
     lock (queue)
         queue = ObjectSerilizer.DeserializeFromBinary <Dictionary <long, User> >(File.ReadAllBytes("./database.bin"));
 }
コード例 #2
0
ファイル: BotClient.cs プロジェクト: deilkaserlend/pporise
        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);
            }
        }
コード例 #3
0
 private void Client_SmartFoxApiOk()
 {
     Game.SendAuthentication(Account.Name, ObjectSerilizer.CalcSH1(Account.Name.ToLowerInvariant() + Account.Password));
 }
コード例 #4
0
 public static void Save()
 {
     lock (queue)
         File.WriteAllBytes("./database.bin", ObjectSerilizer.SerializeToBinary(queue));
 }