示例#1
0
        protected StreamWriter GetStreamWriter(AccountItem userItem)
        {
            switch (userItem.State)
            {
            case LoginState.LoginSucceed:
            case LoginState.RegistrationInvalid:
                OutputMgt.Instance.SucceedCount++;
                return(this.GetStream(Succeed));

            case LoginState.EnterGame:
                OutputMgt.Instance.SucceedCount++;
                return(this.GetStream(EnterGame));

            case LoginState.LoginFalied:
                OutputMgt.Instance.FailedCount++;
                return(this.GetStream(Failed));

            case LoginState.Unknown:
                OutputMgt.Instance.UnknownCount++;
                return(this.GetStream(Unknown));

            default:
                OutputMgt.Instance.FailedCount++;
                return(this.GetStream(Failed));
            }
        }
示例#2
0
 public void GetAccountStateFromUCLogin(AccountItem account, AutoResetEvent resetEvent)
 {
     if (ucLogin == null)
     {
         throw new InvalidOperationException("ucLogin");
     }
     ucLogin.GetState(account, resetEvent);
 }
示例#3
0
        private void GetAccountSummary(AccountItem account, string html)
        {
            string summary = string.Empty;
            //<span class="bold">Country:</span> United States
            string s = HtmlParser.GetOuterTextFromHtml("Country:</span>", "</div>", 1, html);

            if (!string.IsNullOrEmpty(s))
            {
                account.AccountSummary = HtmlParser.GetInnerTextFromHtml(s).Replace("Country:", "");
            }
        }
示例#4
0
        public void Output(AccountItem userItem, DetectionParamsItem paramsItem)
        {
            if ((null == userItem) || (null == paramsItem))
            {
                XBOXLogManager.Instance.ErrorWithCallback("FileExportManager.Output error, parameters has null");
                return;
            }

            this.CreateFileExporter(paramsItem);
            this.fileExporter.Output(userItem);
        }
示例#5
0
        private void GetLoginState(AccountItem account)
        {
            if ((null == account))
            {
                return;
            }

            GameServer gameServer = this.DetectionParamsItem.CurrentGameServer;

            if (!string.IsNullOrEmpty((gameServer.AccountDetailUrl)))
            {
            }
        }
示例#6
0
        public virtual void Output(AccountItem userItem)
        {
            lock (output)
            {
                if ((null != userItem))
                {
                    DBHelper.InsertHistory(userItem);
                    DBHelper.InsertQueriedItems(userItem);

                    StreamWriter sw      = GetStreamWriter(userItem);
                    string       content = userItem.ToString();
                    this.Output(content, sw);
                }
            }
        }
示例#7
0
        private void FrmTest_Load(object sender, EventArgs e)
        {
            DetectionParamsItem paramsItem = new DetectionParamsItem();

            paramsItem.CurrentGameServer = GameServers.XBOXServer;
            AccountItem account = new AccountItem();

            account.User     = "******";
            account.Password = "******";
            UCXBoxLogin uc = new UCXBoxLogin(paramsItem, XBOXLogManager.Instance)
            {
                Dock = DockStyle.Fill
            };

            panel1.Controls.Add(uc);
            using (uc)
            {
                uc.GetState(account, new AutoResetEvent(false));
            }
        }
示例#8
0
        public static bool InsertQueriedItems(AccountItem account)
        {
            lock (lockInsertObj)
            {
                if (IsSqlConOpened)
                {
                    string sql = string.Format(" insert into QueriedXBOX (QueriedIndex,Email) values ({0},\'{1}\')",
                                               account.Index, account.EMail);

                    if (!string.IsNullOrEmpty(sql))
                    {
                        sqlList.Add(sql);
                        if (sqlList.Count % INSERTMAX == 0)
                        {
                            return(InsertData(sqlList));
                        }
                    }
                }
                return(false);
            }
        }
示例#9
0
        public static bool InsertHistory(AccountItem account)
        {
            if (IsSqlConOpened)
            {
                string sql = string.Format(" insert into XBOXResult (AccountId,Email,State,Result)" +
                                           " values ({0},\'{1}\',\'{2}\',\'{3}\') ",
                                           account.Index, account.EMail, account.State, account.StateComment);

                if (!string.IsNullOrEmpty(sql))
                {
                    //return RunSql(sql);
                    sqlHistoryList.Add(sql);
                    if (sqlHistoryList.Count % INSERTMAX == 0)
                    {
                        return(InsertData(sqlHistoryList));
                    }
                }
            }

            return(false);
        }
示例#10
0
        public void GetState(AccountItem account)
        {
            if (account == null)
            {
                return;
            }
            XBOXLogManager.Instance.Info(string.Format("正在查询{0} ,{1}", account.Index, account.EMail));
            this.Account = account;
            GameServer gameServer = this.DetectionParamsItem.CurrentGameServer;

            string msnLoginUrl = "https://login.live.com/pp1300/";
            string html        = ReadFromUrl(msnLoginUrl);

            string actionUrl = GetLoginPostActionUri(html);

            if (!string.IsNullOrEmpty(actionUrl))
            {
                gameServer.LoginPostActionUrl = actionUrl;
                this.refererUrl = msnLoginUrl;
            }

            if (!string.IsNullOrEmpty(gameServer.LoginPostActionUrl))
            {
                string ppftValue = GetPPFT(html);
                if (!string.IsNullOrEmpty(ppftValue))
                {
                    string data = string.Format(PostFormat, Uri.EscapeDataString(this.Account.EMail), Uri.EscapeDataString(this.Account.Password).Replace("!", "%21"), ppftValue.Replace("!", "%21"));
                    html = this.ReadUrlContent(gameServer.LoginPostActionUrl, data);
                }
            }

            this.GetState(account, html);

            //if (account.IsLoginSucceed)
            //{
            //    GetAccountSummary(account, html);
            //}
        }
示例#11
0
 private void GetState(AccountItem account, string html)
 {
     if ((null == account))
     {
         return;
     }
     if (this.IsContains(html, "idProfileInformation", "idUniqueIdLb", "idWinLiveIdValue", "idFullNameValue"))
     {
         account.State = LoginState.LoginSucceed;
     }
     else if (this.IsContains(html, "Login Failed", "Invalid Login or Password"))
     {
         account.State = LoginState.LoginFalied;
     }
     else if (string.IsNullOrEmpty(html) || this.IsContains(html, HttpHelperBase.HTTPERROR))
     {
         account.State = LoginState.NetworkFailure;
     }
     else
     {
         account.State = LoginState.Unknown;
     }
 }
示例#12
0
        public void GetState(AccountItem account)
        {
            if (account == null)
            {
                return;
            }
            XBOXLogManager.Instance.Info(string.Format("正在查询{0} ,{1}", account.Index, account.EMail));
            this.Account = account;
            GameServer gameServer = this.DetectionParamsItem.CurrentGameServer;
            string     html       = string.Empty;

            if (!string.IsNullOrEmpty(gameServer.LoginUrl))
            {
                string realLoginUri = GetResponseUri(gameServer.LoginUrl, ref html);
                if (!string.IsNullOrEmpty(html))
                {
                    string actionUrl = GetLoginPostActionUri(html);
                    if (!string.IsNullOrEmpty(actionUrl))
                    {
                        gameServer.LoginPostActionUrl = actionUrl;
                        this.refererUrl = actionUrl;
                    }
                }
            }

            if (!string.IsNullOrEmpty(gameServer.LoginPostActionUrl))
            {
                string data = string.Format(PostFormat, this.Account.EMail, this.Account.Password);
                html = this.ReadUrlContent(gameServer.LoginPostActionUrl, data);
            }
            this.GetState(account, html);

            //if (account.IsLoginSucceed)
            //{
            //    GetAccountSummary(account, html);
            //}
        }
示例#13
0
 private void GetState(AccountItem account, string html)
 {
     if ((null == account))
     {
         return;
     }
     if (this.IsContains(html, "Login Successful", "Your login was successful"))
     {
         account.State = LoginState.LoginSucceed;
         this.GetLoginState(account);
     }
     else if (this.IsContains(html, "Login Failed", "Invalid Login or Password"))
     {
         account.State = LoginState.LoginFalied;
     }
     else if (string.IsNullOrEmpty(html) || this.IsContains(html, HttpHelperBase.HTTPERROR))
     {
         account.State = LoginState.NetworkFailure;
     }
     else
     {
         account.State = LoginState.Unknown;
     }
 }