Exemplo n.º 1
0
        private void LoadUcNet()
        {
            ADSLItem adsl = new ADSLItem();

            adsl.EntryName      = PwdSetConfig.Instance.ADSLName;
            adsl.Password       = PwdSetConfig.Instance.ADSLPwd;
            adsl.User           = PwdSetConfig.Instance.ADSLUser;
            ucAdsl              = new UcAdsl(adsl, WowLogManager.Instance);
            ucAdsl.TestChanged += ucNetwork_TestChanged;

            RouterItem router = new RouterItem();

            router.RouterType     = PwdSetConfig.Instance.RouterType;
            router.IP             = PwdSetConfig.Instance.RouterIP;
            router.Password       = PwdSetConfig.Instance.RouterPwd;
            router.User           = PwdSetConfig.Instance.RouterUser;
            ucRouter              = new UcRouter(router, WowLogManager.Instance);
            ucRouter.TestChanged += ucNetwork_TestChanged;

            VPNFile vpn = new VPNFile();

            vpn.EntryName          = PwdSetConfig.Instance.VpnEntryName;
            vpn.File               = PwdSetConfig.Instance.VpnFile;
            ucVpnList              = new UcVpnList(vpn, WowLogManager.Instance);
            ucVpnList.TestChanged += ucNetwork_TestChanged;

            VPNItem vpnItem = new VPNItem();

            vpnItem.EntryName  = WowSetConfig.Instance.VpnEntryName;
            vpnItem.IP         = WowSetConfig.Instance.VpnIP;
            vpnItem.User       = WowSetConfig.Instance.VpnUser;
            vpnItem.Password   = WowSetConfig.Instance.VpnPwd;
            ucVpn              = new UcVpnItem(vpnItem, WowLogManager.Instance);
            ucVpn.TestChanged += ucNetwork_TestChanged;
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Thread t = new Thread(new ThreadStart(delegate
            {
                ADSLItem adsl = new ADSLItem()
                {
                    EntryName = "宽带连接", User = "******", Password = "******"
                };
                int i = 0;
                while (i++ < 20)
                {
                    Console.WriteLine(string.Format("----》第{0}次重启网络开始", i));
                    using (AdslDialer dialer = new AdslDialer(adsl, WowLogManager.Instance))
                    {
                        bool b = dialer.Dial();
                        if (!b)
                        {
                            Console.WriteLine(string.Format("*****》第{0}次重启网络出错", i));
                        }
                    }
                    Thread.Sleep(2000);
                    Console.WriteLine(string.Format("######》第{0}次重启网络结束", i));
                }
            }));

            t.Start();
        }
Exemplo n.º 3
0
        void Form1_Load(object sender, EventArgs e)
        {
            ADSLItem adsl = new ADSLItem();

            adsl.EntryName      = WowSetConfig.Instance.ADSLName;
            adsl.Password       = WowSetConfig.Instance.ADSLPwd;
            adsl.User           = WowSetConfig.Instance.ADSLUser;
            ucAdsl              = new UcAdsl(adsl, WowLogManager.Instance);
            ucAdsl.TestChanged += ucNetwork_TestChanged;
            panel1.Controls.Add(ucAdsl);

            WowLogManager.Instance.LogEvent += LogManager_LogEvent;
        }
Exemplo n.º 4
0
        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);
        }