private void DisposeLastFileExporter() { if (null != this.fileExporter) { this.fileExporter.Dispose(); this.fileExporter = null; } RiftDBHelper.SaveCacheData(); }
public virtual void Output(RiftAccountItem userItem) { lock (output) { if ((null != userItem)) { RiftDBHelper.InsertHistory(userItem); RiftDBHelper.InsertQueriedItems(userItem); StreamWriter sw = GetStreamWriter(userItem); string content = userItem.ToString(); this.Output(content, sw); } } }
protected override void ContinueFromLastStopped() { if (null == this.HttperParamsItem) { return; } this.CurrentIndex = 0; if (!this.HttperParamsItem.IsAppended || (this.HttperParamsItem.DataFilePath != RiftSetConfig.Instance.LastFile) ) { RiftDBHelper.ClearTable(RiftTableName.QueriedRift, RiftTableName.RiftResult); } RiftSetConfig.Instance.LastFile = this.HttperParamsItem.DataFilePath; RiftSetConfig.Instance.Save(); RiftOutputMgt.Instance.LoadLastStopCount(); }
private DetectionParamsItem GetDetectionParamsItem() { DetectionParamsItem detectionItem = new DetectionParamsItem(); StringBuilder sb = new StringBuilder(); int i = 1; //If file / server changed bool isSettingChaned = false; #region GameServer GameServer gameServer = comboServer.SelectedItem as GameServer; if (null != gameServer) { detectionItem.CurrentGameServer = gameServer; if (RiftSetConfig.Instance.GameServerNo != comboServer.SelectedIndex) { isSettingChaned = true; } RiftSetConfig.Instance.GameServerNo = comboServer.SelectedIndex; } else { sb.AppendLine(string.Format("{0}、请选择正确的游戏服务器网站!", i++)); } #endregion GameServer detectionItem.HttpTimeout = RiftSetConfig.Instance.HttpTimeout; detectionItem.IsGetDetail = chkGetDetail.Checked; #region Threads if (TextHelper.IsNumber(txtThreads.Text.Trim())) { int threads = TextHelper.StringToInt(txtThreads.Text.Trim()); if (threads < 0 || threads > 50) { sb.AppendLine(string.Format("{0}、请录入正确的线程整数值范围(1-50)!", i++)); } detectionItem.Threads = threads; RiftSetConfig.Instance.Threads = threads; } else { sb.AppendLine(string.Format("{0}、请录入正确的线程整数值(如:5)!", i++)); } if (TextHelper.IsNumber(this.txtRepeatCount.Text.Trim())) { int count = TextHelper.StringToInt(this.txtRepeatCount.Text.Trim()); if (count >= 0) { detectionItem.ErrorRepeatCount = count; RiftSetConfig.Instance.ErrorRepeatCount = count; } else { sb.AppendLine(string.Format("{0}、请录入有效的出错重试次数!", i++)); } } else { sb.AppendLine(string.Format("0}、请录入有效的出错重试次数!", i++)); } if (TextHelper.IsNumber(this.txtCaptchCount.Text.Trim())) { int count = TextHelper.StringToInt(this.txtCaptchCount.Text.Trim()); if (count > 0) { detectionItem.CaptchaErrorCount = count; RiftSetConfig.Instance.CaptchCount = count; } else { sb.AppendLine(string.Format("{0}、请录入有效的验证码出错重启数,默认是5!", i++)); } } else { sb.AppendLine(string.Format("0}、请录入有效的验证码出错重启数,默认是5!", i++)); } #endregion Threads #region FilePath if (!string.IsNullOrEmpty(txtFilePath.Text.Trim()) && File.Exists(txtFilePath.Text)) { detectionItem.DataFilePath = txtFilePath.Text.Trim(); } else { sb.AppendLine(string.Format("{0}、请录入正确的数据文件路径,或者文件是否存在!", i++)); } detectionItem.DataFormat = (DataFormat)comboDataType.SelectedValue; RiftSetConfig.Instance.DataFormat = detectionItem.DataFormat; #endregion FilePath #region reconnect mode detectionItem.IsSupportedReconnect = chkReconnect.Checked; RiftSetConfig.Instance.IsSupportedReconnect = chkReconnect.Checked; if (chkReconnect.Checked) { if (radioADSL.Checked) { detectionItem.ReconnectType = ReconnectType.ADSL; } if (radioRouter.Checked) { detectionItem.ReconnectType = ReconnectType.Router; } if (radioVpn.Checked) { detectionItem.ReconnectType = ReconnectType.VPN; } RiftSetConfig.Instance.ReconnectType = detectionItem.ReconnectType; if (radioADSL.Checked) { ADSLItem adsl = this.ucAdsl.GetADSLItem(); if (null == adsl) { return(null); } else { detectionItem.ADSL = adsl; RiftSetConfig.Instance.ADSLName = adsl.EntryName; RiftSetConfig.Instance.ADSLPwd = adsl.Password; RiftSetConfig.Instance.ADSLUser = adsl.User; } } if (radioVpn.Checked) { IList <VPNItem> vpnList = this.ucVpnList.GetVpnList(); if (null != vpnList && vpnList.Count > 0) { detectionItem.VpnList = vpnList; RiftSetConfig.Instance.VpnEntryName = vpnList[0].EntryName; RiftSetConfig.Instance.VpnIP = vpnList[0].IP; RiftSetConfig.Instance.VpnUser = vpnList[0].User; RiftSetConfig.Instance.VpnPwd = vpnList[0].Password; } else { return(null); } } if (radioRouter.Checked) { RouterItem router = this.ucRouter.GetRouterItem(); if (null == router) { return(null); } else { detectionItem.Router = router; RiftSetConfig.Instance.RouterType = router.RouterType; RiftSetConfig.Instance.RouterIP = router.IP; RiftSetConfig.Instance.RouterPwd = router.Password; RiftSetConfig.Instance.RouterUser = router.User; } } if (!radioRouter.Checked && !radioVpn.Checked && !radioADSL.Checked) { sb.AppendLine(string.Format("{0}、当前选择了网络重连功能,但没有选择具体的重连方式!!", i++)); } } #endregion reconnect mode #region Data query type if (radioCustomRange.Checked && !this.GetCustomRange(detectionItem)) { return(null); } if (sb.Length > 0) { MessageBox.Show(sb.ToString(), "(裂隙)提醒"); return(null); } if (radioFromFirst.Checked) { detectionItem.QueryType = QueryType.FromFrist; } else if (radioCustomRange.Checked) { detectionItem.QueryType = QueryType.FromCustomRange; } else if (radioFromStopped.Checked) { detectionItem.QueryType = QueryType.FromStopped; } RiftSetConfig.Instance.QuertyType = detectionItem.QueryType; #endregion Data query type #region warning Dialog i = 1; sb = new StringBuilder(); sb.AppendLine(string.Format("{0}、请确认选择的游戏网站,数据格式是否录入正确!", i++)); sb.AppendLine(string.Format("{0}、请确认选择扫瞄方式是不是正确,否则容易造成重复劳动!", i++)); sb.AppendLine(string.Format("{0}、请确认录入线程数,网络连接超时,验证码出错重试数是否录入正确!", i++)); if (this.radioCustomRange.Checked) { sb.AppendLine(string.Format("{0}、请确认是否真的要按自定义的数据范围来进行处理,并且上下行值是否正确!", i++)); } if (chkReconnect.Checked) { sb.AppendLine(string.Format("{0}、请确认是否真的要支持网络重连,并且网络重连的方式是否正确!", i++)); } if (this.radioADSL.Checked) { sb.AppendLine(string.Format("{0}、请确认ADSL名称是否是当前使用的PPPOE名称,用户名及密码是否正确!", i++)); } if (this.radioVpn.Checked) { sb.AppendLine(string.Format("{0}、请确认VPN名称,IP址址,用户名及密码是否正确!", i++)); } if (this.radioRouter.Checked) { sb.AppendLine(string.Format("{0}、请确认选择的路由器类型,IP址址,用户名及密码是否正确!", i++)); } DialogResult dlgResult = MessageBox.Show(sb.ToString(), "(裂隙)提醒 ----> 真的要按当前的配置执行吗?", MessageBoxButtons.OKCancel); if (dlgResult != DialogResult.OK) { return(null); } #endregion warning Dialog if (RiftSetConfig.Instance.LastFile.Trim() != detectionItem.DataFilePath.Trim()) { isSettingChaned = true; } if (radioFromFirst.Checked || isSettingChaned) { RiftDBHelper.ClearTable(RiftTableName.QueriedRift, RiftTableName.RiftResult); } return(detectionItem); }
protected override void SetDB() { this.queriedIndexList = RiftDBHelper.GetQueriedIndex(); RiftDBHelper.SaveCacheData(); }
public void LoadLastStopCount() { this.FailedCount = RiftDBHelper.GetHistoryCount(LoginState.LoginFalied, LoginState.NetworkFailure); this.UnknownCount = RiftDBHelper.GetHistoryCount(LoginState.Unknown); this.SucceedCount = RiftDBHelper.GetHistoryCount(LoginState.LoginSucceed, LoginState.RegistrationInvalid); }