示例#1
0
        private void loginMa_Click(object sender, RoutedEventArgs e)
        {
            var flag = GetMa.Login(Config.UserApi, Config.PassWord);

            if (flag)
            {
                MessageBox.Show("登陆成功!");
                return;
            }
            MessageBox.Show("登陆失败!");
        }
示例#2
0
        /// <summary>
        /// 等待验证码
        /// </summary>
        /// <param name="get">等待对象</param>
        /// <param name="time">最长等待时间(秒)</param>
        /// <returns></returns>
        private bool WaitCode(GetMa get, int time)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            while (true)
            {
#if DEBUG
                Console.WriteLine("等待验证码中...");
#endif
                if (get.GetMessAge())
                {
                    return(true);
                }
                if (sw.ElapsedMilliseconds / 1000 > time)
                {
                    break;
                }
                Thread.Sleep(2000);
            }
            return(false);
        }
示例#3
0
        /// <summary>
        /// 控制器
        /// </summary>
        private void Controller()
        {
            for (int i = 0; i < Grid1.Items.Count; i++)
            {
                if (!_ISRUN)
                {
                    break;
                }
                var _RandIp = RandIp();
#if DEBUG
                Console.WriteLine($"随机IP为 :{_RandIp}");
#endif
                var item = Grid1.Items[i] as RegisInfo;
                Dispatcher.Invoke(() => { Grid1.ScrollIntoView(item); });
                GetMa get = new GetMa();
                item.Status = "获取手机号";
                while (true)
                {
                    if (get.GetPhone())
                    {
                        break;
                    }
                    Thread.Sleep(2000);
                }
                Register register = new Register(Config.RegisCode, _RandIp);
                register.RegisPhone = get.CurPhone;
                item.Status         = "发送验证码";
                if (register.SendMsg())
                {
                    item.Status = "等待验证码";
                    if (WaitCode(get, Config.WaitTime))
                    {
                        var code = get.CurMsg;
                        item.Status = "注册中";
                        // var flag = rigister.Regis(code);
                        if (register.Regis(code))
                        {
                            item.Status       = "上传中";
                            var(phone, token) = register.GetParamter;
                            UpLoadIMG upload = new UpLoadIMG(Path.Combine(item.CertifiCatePath, "正面.jpg"), Path.Combine(item.CertifiCatePath, "手持.jpg"), token, _RandIp);
                            var       flag   = upload.Submit();
                            if (flag)
                            {
                                item.Status = "上传成功";
                                File.AppendAllText("SUCC.txt", phone + "----" + token + "\r\n");
                            }
                            else
                            {
                                item.Status = "上传失败";
                            }
                            DirMove(item.CertifiCatePath, flag ? Config.SUCC : Config.FAIL);
                        }
                        else
                        {
                            DirMove(item.CertifiCatePath, Config.FAIL);
                            item.Status = "注册失败";
                        }
                    }
                    else
                    {
                        DirMove(item.CertifiCatePath, Config.FAIL);
                        item.Status = "等待验证码超时";
                    }
                }
                else
                {
                    DirMove(item.CertifiCatePath, Config.FAIL);
                    item.Status = "验证码发送失败";
                }
                get.AddBlack();
#if DEBUG
                Console.WriteLine("切换IP...");
                Thread.Sleep(5000);
#else
                ChangeIp();
#endif
            }
            MessageBox.Show("完成!");
        }