private void ReadCardThread() { List <CCard> lst = new List <CCard>(); if (!ConsoleFile.GetCard_By_File(ref lst)) { Invoke(new MethodInvoker(delegate() { this.Text = "本地保存的卡号数量=0"; })); } else { Invoke(new MethodInvoker(delegate() { this.dataGridView1.Rows.Clear(); // ShowData for (int i = 0; i < lst.Count; i++) { this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[i].Cells[0].Value = lst[i]._strCard; this.dataGridView1.Rows[i].Cells[1].Value = "…………"; } })); CCardFunction.GetCardInfo_By_Server(lst); for (int i = 0; i < lst.Count; i++) { var obj = Code.CGlobalVariable.g_WorkCardList.Where((CCard Card) => Card._strCard == lst[i]._strCard).ToList(); if (obj.Count > 0) { this.dataGridView1.Rows[i].Cells[1].Value = obj[0]._nCardAllHour; this.dataGridView1.Rows[i].Cells[2].Value = obj[0]._strActiveDate; this.dataGridView1.Rows[i].Cells[3].Value = obj[0]._nCardSurplusHour; } } Invoke(new MethodInvoker(delegate() { if (CGlobalVariable.g_WorkCardList != null && CGlobalVariable.g_WorkCardList.Count > 0) { this.Text = "有效卡号数量 = " + CGlobalVariable.g_WorkCardList.Where((CCard Card) => Card._nCardSurplusHour > 0).ToList().Count.ToString(); } else { this.Text = "有效卡号数量 = 0"; } })); } Invoke(new MethodInvoker(delegate() { btnAddCard.Enabled = true; btnRefush.Enabled = true; })); }
private void _PromptThread() { try { CheckGameClient(); Invoke(new MethodInvoker(delegate() { lbPrompt.Text = "优化游戏中……"; })); Code.API.Init(Code.ConsoleFile.GetGamePath(), int.Parse(Form1.GetValue_By_Key_For_Config("Optimize"))); Invoke(new MethodInvoker(delegate() { lbPrompt.Text = "获取公告中……"; })); if (!IsTestMode() && !CheckLeastVersion()) { API.SetGameRun(0x2); } Code.ConsoleFile.SetMaxFps(); StringBuilder sbPrompt = new StringBuilder(1024); if (Code.API.GetServerTitle(sbPrompt) == 0) { Code.API.SetGameRun(0x2); } Invoke(new MethodInvoker(delegate() { lbPrompt.Text = sbPrompt.ToString(); lbGetCardMsg.Visible = true; })); if (!File.Exists(System.Environment.CurrentDirectory + @"\\Setting\\Account.txt")) { new StreamWriter(System.Environment.CurrentDirectory + @"\\Setting\\Account.txt", false, Encoding.Unicode).Close(); } if (!File.Exists(System.Environment.CurrentDirectory + @"\\Setting\\Card.txt")) { new StreamWriter(System.Environment.CurrentDirectory + @"\\Setting\\Card.txt", false, Encoding.Unicode).Close(); } if (!File.Exists(System.Environment.CurrentDirectory + @"\\Setting\\TaskUpgradeSchedule.txt")) { new StreamWriter(System.Environment.CurrentDirectory + @"\\Setting\\TaskUpgradeSchedule.txt", false, Encoding.Unicode).Close(); } if (!File.Exists(System.Environment.CurrentDirectory + @"\\Setting\\AccountLog.txt")) { new StreamWriter(System.Environment.CurrentDirectory + @"\\Setting\\AccountLog.txt", false, Encoding.Unicode).Close(); } if (!File.Exists(System.Environment.CurrentDirectory + @"\\Setting\\PlayerDaily.txt")) { new StreamWriter(System.Environment.CurrentDirectory + @"\\Setting\\PlayerDaily.txt", false, Encoding.Unicode).Close(); } if (!Directory.Exists(System.Environment.CurrentDirectory + @"\\SaveLog")) { Directory.CreateDirectory(System.Environment.CurrentDirectory + @"\\SaveLog"); } if (!Directory.Exists(System.Environment.CurrentDirectory + @"\\Setting\\Screenshot\\")) { Directory.CreateDirectory(System.Environment.CurrentDirectory + @"\\Setting\\Screenshot\\"); } List <Code.CAccount> lst = new List <Code.CAccount>(); if (!Code.ConsoleFile.GetAccount_By_File(ref lst)) { MessageBox.Show("木有帐号存在,先添加帐号!"); Process.Start(System.Environment.CurrentDirectory + @"\\Setting\\Account.txt"); System.Threading.Thread.Sleep(5000); Code.API.SetGameRun(0x2); } List <CCard> CardList = new List <CCard>(); if (!ConsoleFile.GetCard_By_File(ref CardList)) { MessageBox.Show("木有卡号存在,先添加卡号!"); Process.Start(System.Environment.CurrentDirectory + @"\\Setting\\Card.txt"); System.Threading.Thread.Sleep(5000); Code.API.SetGameRun(0x2); } CCardFunction.GetCardInfo_By_Server(CardList); // 清理一下 new SettingConfig().ClearConfig(); } catch (Exception ex) { MessageBox.Show("_PromptThread:" + ex.Message); } Invoke(new MethodInvoker(delegate() { this.Close(); })); }