Exemplo n.º 1
0
 private void vcs()
 {
     while (true)
     {
         try {
             string     json = MethodUtils.HttpGet(host + heartbeat + this.uid + "/" + this.token);
             ActiveUser ac   = JsonConvert.DeserializeObject <ActiveUser>(json);
             if (!ac.status)
             {
                 this.Invoke(new ServerMessageDelegate(listboxAddMsg), this.listBoxControl1, "=========================");
                 this.Invoke(new ServerMessageDelegate(listboxAddMsg), this.listBoxControl1, "可用时间消耗完毕, 请充值后使用...");
                 this.Invoke(new ServerMessageDelegate(listboxAddMsg), this.listBoxControl1, "=========================");
                 gridControl1.DataSource = null;
                 this.kill();
             }
             barStaticItemExpire.Caption = "可用时间: " + ac.countdown;
             //Debug.WriteLine("HB发送完毕 : ac.status=" + ac.status + "  休眠60秒...");
             disconnect = 0;// 成功一次置零
         } catch (Exception) {
             if (disconnect > 5)
             {
                 MessageBox.Show("权限校验失败, 如果持续出现此错误, 则表示此版本已停止服务...", "即将退出");
                 Application.Exit();
             }
             else
             {
                 disconnect++;
             }
         }
         Thread.Sleep(60 * 1000);
     }
 }
Exemplo n.º 2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Debug.WriteLine("[*]CDM初始化中...");
            CaptureDeviceManager.getInstance();
            Debug.WriteLine("[+]CDM初始化完毕...");

            // 初始化游戏进程
            Process[] processes = Process.GetProcessesByName(gameName);
            foreach (Process p in processes)
            {
                gameList.Add(MethodUtils.GetCharacter(p));
            }
            Debug.WriteLine("[+]已启动的游戏搜寻完毕. found: " + gameList.Count);

            // 启动更新线程 读取内存
            UpdateThread = new Thread(UpdateInfo);
            UpdateThread.IsBackground = true;
            UpdateThread.Start();
            Debug.WriteLine("[+]读取内存进程启动完毕...");

            // 启动寻找游戏线程 每5秒寻找一次游戏
            UpdateGameThread = new Thread(GetGameWindow);
            UpdateGameThread.IsBackground = true;
            UpdateGameThread.Start();
            Debug.WriteLine("[+]游戏寻找进程启动完毕...");

            this.gridControl1.DataSource = gameList; // 设置数据源
            this.columnSDPercent.Visible = false;    // 隐藏SD条

            // 游戏抓包启动

            /*
             * int count = 0;
             * foreach (Game g in gameList) {
             *  if (g.Port != -1 && !g.IsStartAnalyzer) {
             *      g.startCapture();
             *      g.MessageDone += handleMessage;
             *      count++;
             *  }
             * }
             * Debug.WriteLine("[+]" + count + "个游戏的抓包已启动(" + (gameList.Count - count) + "个未启动)...");
             * // 这里不用手动启动了 搜寻线程中会自动启动所有不是 -1端口 且 没启动抓包的进程
             */

            // listBoxControl1.Items.Add("若此处消息无法正常显示, 请在\"网络\"选项中调整网卡设置...");
            listBoxControl1.Items.Add("所有的新用户可以免费试用7天...");
            listBoxControl1.Items.Add("挂机助手与硬件绑定, 请在需要使用的电脑上进行充值操作...");
            listBoxControl1.Items.Add("新版挂机助手核心代码全部重写. 稳定性更好, 兼容性更强. 但首次截获数据耗时变长...");
            listBoxControl1.Items.Add("如果需要死亡/掉线通知, 请务必记得填写邮箱地址, 且要将发件人设置为收件白名单, 否则只能收到一封邮件...");
            listBoxControl1.Items.Add("发件人地址: [email protected]");
            listBoxControl2.Items.Add("此处记录Boss死亡/刷新时间, 请在上方勾选记录Boss信息...");
            ActiveUser ac = null;

            try {
                string json = MethodUtils.HttpGet(host + auth + uid);
                ac = JsonConvert.DeserializeObject <ActiveUser>(json);
                barStaticItemExpire.Caption = "可用时间: " + ac.countdown;
                this.token = ac.token;
            } catch (Exception) {
                this.kill();
                MessageBox.Show("网络验证失败, 此版本已经停止服务... 请更新至最新版", "错误");
                Application.Exit();
            }
            Debug.WriteLine("[+]VCS账号校验完毕...");
            if (ac.status)
            {
                // 启动VCS线程
                VCSThread = new Thread(vcs);
                VCSThread.IsBackground = true;
                VCSThread.Start();
                allowClose = true;
                Debug.WriteLine("[+]VCS账号可用, VCS线程启动...");
            }
            else
            {
                // 开启时已经过期
                this.kill();
                MessageBox.Show("您的账号已到期, 所有功能暂停使用, 请充值后继续...", "提示");
                Debug.WriteLine("[-]VCS账号已过期, 所有线程已摧毁...");
            }
        }