Esempio n. 1
0
        protected virtual void LoadFile()
        {
            try
            {
                if ((null == this.HttperParamsItem) || (string.IsNullOrEmpty(this.HttperParamsItem.DataFilePath)))
                {
                    return;
                }

                this.accountList.Clear();
                this.TotalCount = 0;
                using (StreamReader sr = new StreamReader(this.HttperParamsItem.DataFilePath))
                {
                    string user  = string.Empty;
                    string pwd   = string.Empty;
                    string email = string.Empty;

                    while (!sr.EndOfStream && !isDisposed)
                    {
                        string line = sr.ReadLine();
                        if (TextToItemHelper.GetLoginAccountItem(line, ref user, ref pwd, ref email,
                                                                 this.HttperParamsItem.DataFormat, this.LogManager))
                        {
                            T item = new T()
                            {
                                RawData  = line,
                                User     = user,
                                Password = pwd,
                                EMail    = email,
                                Index    = ++this.TotalCount
                            };
                            this.accountList.Add(item);
                        }

                        if (this.TotalCount % 10 == 0)
                        {
                            this.SetAutoResetEvent(false);
                            Application.DoEvents();
                        }
                    }
                }
            }
            finally
            {
                if (accountList.Count == 0)
                {
                    LogManager.InfoWithCallback("-> 请检查数据文件的格式是否正确,当前格式无法解析帐号、EMAIL、密码!!!!");
                    this.IsFinished = true;
                }
                LogManager.InfoWithCallback("-> 完成数据从文件提取,正在开始网络查询!");
                this.SetAutoResetEvent(true);
            }
        }
Esempio n. 2
0
        protected override void LoadFile()
        {
            try
            {
                if ((null == this.HttperParamsItem) || (string.IsNullOrEmpty(this.HttperParamsItem.DataFilePath)))
                {
                    return;
                }

                this.accountList.Clear();
                this.TotalCount = 0;
                using (StreamReader sr = new StreamReader(this.HttperParamsItem.DataFilePath))
                {
                    while (!sr.EndOfStream && !isDisposed)
                    {
                        PwdResetItem item = TextToItemHelper.GetPwdResetItem(sr.ReadLine(),
                                                                             this.HttperParamsItem.DataFormat, WowLogManager.Instance);
                        if (null != item)
                        {
                            item.Index = ++this.TotalCount;
                            this.accountList.Add(item);
                        }

                        if (this.TotalCount % 10 == 0)
                        {
                            this.SetAutoResetEvent(false);
                            Application.DoEvents();
                        }
                    }
                }
            }
            finally
            {
                if (accountList.Count == 0)
                {
                    LogManager.InfoWithCallback("-> 请检查数据文件的格式是否正确,当前格式无法解析EMAIL、姓名!!!!");
                    this.IsFinished = true;
                }
                BattleDBHelper.SaveCacheData();
                LogManager.InfoWithCallback("-> 完成数据从文件提取,正在开始网络查询!");
                this.SetAutoResetEvent(true);
            }
        }