protected virtual void HttpProcess_ProcessItemChanged(object sender, ProcessEventArgs <T> e)
        {
            lock (eventLockObject)
            {
                UserAccountItem wowItem = e.Item as UserAccountItem;
                if ((null != wowItem) && wowItem.IsCaptchaError)
                {
                    if (!queriedIndexList.Contains(e.Item.Index))
                    {
                        queriedIndexList.Add(e.Item.Index);
                    }
                }

                if (IsReconnecting)
                {
                    return;
                }

                if ((null != wowItem) && !queriedIndexList.Contains(wowItem.Index))
                {
                    queriedIndexList.Add(wowItem.Index);
                }

                if (null != this.ProcessItemChanged)
                {
                    this.ProcessItemChanged(sender, e);
                }

                if (IsIPLimit)
                {
                    LogManager.InfoWithCallback(string.Format("当前每IP只允许访问 {0} 个帐号,已经到达限止,重新网络!", IPLimitCount));
                    this.Reconnect();
                }
            }
        }
        protected void OutputByRegion(UserAccountItem userItem)
        {
            lock (region)
            {
                string s = userItem.ToString();
                if ((null != userItem))
                {
                    StreamWriter sw = null;
                    if (TextHelper.IsContains(s, "(US)"))
                    {
                        sw = this.GetStream(SUCCEED_US);
                    }
                    else if (TextHelper.IsContains(s, "(EU)"))
                    {
                        sw = this.GetStream(SUCCEED_EU);
                    }

                    if (sw == null)
                    {
                        LogManager.Error("Account output US/EU account failed,that's other country account!");
                        return;
                    }

                    this.Output(s, sw);
                }
            }
        }
        protected StreamWriter GetStreamWriter(UserAccountItem userItem)
        {
            switch (userItem.State)
            {
            case WowLoginStates.SingleGameAccount:
            case WowLoginStates.MultiGameAccount:
            case WowLoginStates.Unbattle_TCB:
            case WowLoginStates.Unbattle_WLK:
            case WowLoginStates.Unbattle_OK:
                BattleOutptMgt.Instance.SucceedCount++;
                return(this.GetStream(SUCCEED));

            case WowLoginStates.NeedCaptcha:
            case WowLoginStates.IncorrectCaptcha:
            case WowLoginStates.TooMuchFailedChapcha:
                BattleOutptMgt.Instance.RetryCount++;
                return(this.GetStream(InvalidCaptcha));

            case WowLoginStates.HttpError:
            case WowLoginStates.SucceedUnknown:
            case WowLoginStates.WebSiteError:
            case WowLoginStates.TimeOut:
            case WowLoginStates.Locked:
            case WowLoginStates.LoginWithEmptyResponse:
            case WowLoginStates.TempDisabled:
            case WowLoginStates.PermanentDisabled:
            case WowLoginStates.AuthenticatorCode:
            case WowLoginStates.Frozen:
                BattleOutptMgt.Instance.UselessCount++;
                return(this.GetStream(USELESS));

            case WowLoginStates.TestAccountOutOfExpire:
                BattleOutptMgt.Instance.UselessCount++;
                return(this.GetStream(TestOrExpire));

            case WowLoginStates.Trial:
                BattleOutptMgt.Instance.SucceedCount++;
                return(this.GetStream(TestOrExpire));

            case WowLoginStates.Unknown:
            case WowLoginStates.InvalidPassword:

            case WowLoginStates.MissAccount:
            case WowLoginStates.IsNotExist:
            case WowLoginStates.LoginWithNoGameAccount:
                BattleOutptMgt.Instance.FailedCount++;
                return(this.GetStream(FAILED));

            case WowLoginStates.TooManyAttempt:
                BattleOutptMgt.Instance.RetryCount++;
                return(this.GetStream(RETRY));

            default:
                BattleOutptMgt.Instance.FailedCount++;
                return(this.GetStream(FAILED));
            }
        }
        public void Output(UserAccountItem userItem, DetectionParamsItem paramsItem)
        {
            if ((null == userItem) || (null == paramsItem))
            {
                LogManager.ErrorWithCallback("FileExportManager.Output error, parameters has null");
                return;
            }

            this.CreateFileExporter(paramsItem);
            this.fileExporter.Output(userItem);
        }
        public virtual void Output(UserAccountItem userItem)
        {
            lock (output)
            {
                if ((null != userItem))
                {
                    BattleDBHelper.InsertHistory(userItem);
                    BattleDBHelper.InsertQueriedItems(userItem);

                    StreamWriter sw      = GetStreamWriter(userItem);
                    string       content = userItem.ToString();
                    this.Output(content, sw);

                    this.WriteRawData(userItem);
                    this.OutputByRegion(userItem);
                }
            }
        }
        public static bool InsertQueriedItems(UserAccountItem account)
        {
            lock (lockInsertObj)
            {
                if (IsSqlConOpened)
                {
                    string sql = string.Format(" insert into QueriedAccount (QueriedId,QueriedEmail) values ({0},\'{1}\')",
                                               account.Index, account.EMail);

                    if (!string.IsNullOrEmpty(sql))
                    {
                        sqlList.Add(sql);
                        if (sqlList.Count % INSERTMAX == 0)
                        {
                            return(InsertData(sqlList));
                        }
                    }
                }
                return(false);
            }
        }
        public static bool InsertHistory(UserAccountItem account)
        {
            if (IsSqlConOpened)
            {
                string sql = string.Format(" insert into HistoryLists (AccountId,AccountState,Email,Password,AccountDetail,SubAccountDetail)" +
                                           " values ({0},\'{1}\',\'{2}\',\'{3}\',\'{4}\',\'{5}\') ",
                                           account.Index, account.State, account.EMail, account.Password,
                                           account.AccountStateString, account.SubAccountDetailString);

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

            return(false);
        }
        protected virtual void HttpProcess_ReconnectChanged(object sender, ProcessEventArgs <T> e)
        {
            lock (this)
            {
                T userItem = e.Item;
                if (null == userItem)
                {
                    return;
                }

                if (this.IsReconnecting)
                {
                    if (userItem.IsNeedRedial)
                    {
                        LogManager.InfoWithCallback(string.Format(" -->已经在网络重拨,当前用户:" + userItem.ToString()));
                    }
                    return;
                }

                if (userItem.IsNeedRedial)
                {
                    UserAccountItem wowItem = userItem as UserAccountItem;
                    if ((null != wowItem) && wowItem.IsCaptchaError)
                    {
                        BattleOutptMgt.Instance.Output(wowItem, this.HttperParamsItem);
                    }

                    if (userItem.State == WowLoginStates.TooMuchFailedChapcha)
                    {
                        LogManager.InfoWithCallback(string.Format(" -->验证码识别出错:{0} 次,网络重启。", this.HttperParamsItem.ErrorRepeatCount));
                    }

                    LogManager.InfoWithCallback(string.Format("-> 游戏网站:{0} 开始拒绝查询,准备重拨网络 ,帐户:{1}",
                                                              this.HttperParamsItem.CurrentGameServer.Header, userItem.ToString()));
                    this.Reconnect();
                }
            }
        }
        protected void WriteRawData(UserAccountItem userItem)
        {
            StreamWriter sw = null;

            switch (userItem.State)
            {
            case WowLoginStates.HttpError:
            case WowLoginStates.WebSiteError:
            case WowLoginStates.TimeOut:
            case WowLoginStates.IncorrectCaptcha:
            case WowLoginStates.TooManyAttempt:
                sw = this.GetStream(REUSEABLE);
                break;

            case WowLoginStates.LoginWithNoGameAccount:
                sw = this.GetStream(LoginWithNoAccount);
                break;

            case WowLoginStates.IsNotCurretServerAccount:
                sw = this.GetStream(IsNotCurrentServerAccount);
                break;

            case WowLoginStates.Unbattle_OK:
                //case LoginState.Unbattle_WLK:
                sw = this.GetStream(QueryChar);
                break;

            default:
                break;
            }

            if ((null != sw) && !string.IsNullOrEmpty(userItem.RawData))
            {
                this.Output(userItem.RawData, sw);
            }
        }