using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Windows.Forms; using AppleBatch_June.Domain; using AppleBatch_June.ExecuteTasks; using AppleBatch_June.Model; using AppleBatch_June.Views; namespace AppleBatch_June.Forms { public class FromOvercheck : BaseForm { private IContainer components; private GroupBox groupBox9; private TextBox textBox2; private CheckBox ckOvercheckVpn; private Label labOvercheckInter; private Label label10; private Label label13; private GroupBox groupBox10; private Label labOvercheckCount; private Label label16; private Button btnOvercheckLiteClre; private Button btnOvercheckQuery; private Button btnOvercheckInput; private Button btnOvercheckExper; private Button btnOvercheckStart; private GroupBox groupBox12; private DoubleBufferListView listOvercheck; private ColumnHeader columnHeader8; private ColumnHeader columnHeader9; private ColumnHeader columnHeader10; private ColumnHeader columnHeader1; private ColumnHeader columnHeader14; private ColumnHeader columnHeader3; private Label label1; private ComboBox ComCountrySelectList; private Label label63; public FromOvercheck() : base("AppStore检查", OvercheckTask.Instance) { InitializeComponent(); } private void FromLeaveFamily_Load(object sender, EventArgs e) { base.listData = listOvercheck; base.labCout = labOvercheckCount; base.startBtn = btnOvercheckStart; labOvercheckInter.Text = AppSysConfig.getTypeById(41).consNum.ToString(); label13.Text = label13.Text.Replace("{0}", AppSysConfig.getTypeById(42).consNum.ToString()); ckOvercheckVpn.Checked = ((ConfigUtlis.getConfigValue("ckOvercheckVpn") == "True") ? true : false); InitLv(base.listData); ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem { Text = "设置显示列", Size = new Size(124, 22) }; toolStripMenuItem.Click += base.ShouItemsIndex_Click; BindMenuStrip(addTwoFactor: true, new ToolStripMenuItem[1] { toolStripMenuItem }); ComCountrySelectList.DisplayMember = "name"; ComCountrySelectList.ValueMember = "Id"; List mation = new NationalData().getMation(); mation.Insert(0, new NationalList { Id = "-", name = "请选择", payment = null }); ComCountrySelectList.DataSource = mation; } private void btnLeaveFamilyStart_Click(object sender, EventArgs e) { if (!OvercheckTask.Instance.isRun && !OvercheckTask.Instance.TaskIsRun) { List lvItems = (from ListViewItem c in base.listData.Items where c.SubItems[3].Text == "-" select new AppleAcount { appleId = c.SubItems[1].Text, applePwd = c.SubItems[2].Text }).ToList(); RearTaskRun(lvItems); return; } OvercheckTask.Instance.Stop(); if (!base.IsDisposed) { Invoke((Action)delegate { base.startBtn.Text = "正在停止"; base.startBtn.ForeColor = Color.Red; }); } } private void RearTaskRun(List lvItems) { int id = 41; int count = lvItems.Count; if (AppSysConfig.integral < count * AppSysConfig.getTypeById(41).consNum) { MessageBox.Show("账号点数不足 , 执行账号数量:" + count + " ,至少需要 " + count * AppSysConfig.getTypeById(id).consNum + " 点数。"); return; } ConfigUtlis.saveConfigKey("ckOvercheckVpn", ckOvercheckVpn.Checked.ToString()); NationalList nationalList = ComCountrySelectList.SelectedItem as NationalList; PaymentInfo payment = null; if (nationalList != null) { payment = nationalList.payment; } btnOvercheckStart.Tag = base.listData.Items.Cast().ToList(); OvercheckTask.Instance.ExecuteLeaveFamily(2, ckOvercheckVpn.Checked, lvItems, payment, base.startAct, base.endTakAct, sucessAct, _action); } public void sucessAct(string AppleId) { UpdataUi(delegate { if (btnOvercheckStart.Tag == null) { btnOvercheckStart.Tag = base.listData.Items.Cast().ToList(); } ListViewItem listViewItem = (btnOvercheckStart.Tag as List).Where((ListViewItem c) => c.SubItems[1].Text == AppleId).FirstOrDefault(); if (listViewItem != null) { SqliteHelper.ExecuteInsert("itunes_db", new Dictionary { { "type", "overcheck" }, { "addTime", Tools.GenerateTimeStamp().ToString() }, { "value1", listViewItem.SubItems[1].Text }, { "value2", listViewItem.SubItems[2].Text }, { "value3", listViewItem.SubItems[3].Text }, { "value4", listViewItem.SubItems[4].Text }, { "value5", listViewItem.SubItems[5].Text } }); } }); } public void _action(string key, DisplyType type, string reust) { UpdataUi(delegate { if (btnOvercheckStart.Tag == null) { btnOvercheckStart.Tag = base.listData.Items.Cast().ToList(); } IEnumerable enumerable = (btnOvercheckStart.Tag as List).Where((ListViewItem c) => c.SubItems[1].Text == key); Font font = new Font(Font, FontStyle.Bold); foreach (ListViewItem item in enumerable) { switch (type) { case DisplyType.forbidden: item.SubItems[4].Text = reust; item.SubItems[4].Font = font; item.SubItems[4].ForeColor = Color.Green; break; case DisplyType.xinxi: item.SubItems[5].Text = reust; break; case DisplyType.error: item.SubItems[4].Text = reust; item.SubItems[4].Font = font; item.SubItems[4].ForeColor = Color.Red; break; case DisplyType.chongzhi: item.SubItems[3].Text = reust; item.SubItems[4].Text = reust; item.SubItems[4].Text = reust; item.SubItems[4].ForeColor = Color.Black; break; case DisplyType.area: item.SubItems[3].Text = reust; break; } } }); } private void btnLeaveFamilyInput_Click(object sender, EventArgs e) { FromInputAcount fromInputAcount = new FromInputAcount(); fromInputAcount.tipMssage = textBox2.Text; fromInputAcount.isOpenSysVpn = ckOvercheckVpn.Checked; if (fromInputAcount.ShowDialog() == DialogResult.OK) { List list = AppleUtlis.accountInput(fromInputAcount.StrInput); int num = 0; base.listData.ListViewItemSorter = new ListViewItemComparer(0, 1); base.listData.Sort(); if (base.listData.Items.Count > 0 && int.TryParse(base.listData.Items[base.listData.Items.Count - 1].SubItems[0].Text, out var result)) { num = result; } List list2 = new List(); foreach (AppleAcount item in list) { num++; ListViewItem listViewItem = new ListViewItem(num.ToString()); listViewItem.UseItemStyleForSubItems = false; listViewItem.SubItems.Add(item.appleId); listViewItem.SubItems.Add(item.applePwd); listViewItem.SubItems.Add("-"); listViewItem.SubItems.Add("-"); listViewItem.SubItems.Add("-"); list2.Add(listViewItem); } base.listData.Items.AddRange(list2.ToArray()); } base.labCout.Text = string.Concat(base.listData.Items.Count); } private void btnLiteClre_Click(object sender, EventArgs e) { if (MessageBox.Show("确认删除列表数据吗", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { base.listData.Items.Clear(); } base.labCout.Text = string.Concat(base.listData.Items.Count); } private void btnLeaveFamilyExper_Click(object sender, EventArgs e) { ExperList(base.listData); } public override void TwoFactorItem_over_Click(string reust) { List list = new List(); foreach (ListViewItem selectedItem in base.listData.SelectedItems) { list.Add(new AppleAcount { appleId = selectedItem.SubItems[1].Text, applePwd = selectedItem.SubItems[2].Text, isDoubleModl = true, DoublePwd = reust }); } RearTaskRun(list); } public override void ReExecute_Click(object sender, EventArgs e) { if (OvercheckTask.Instance.TaskIsRun) { MessageBox.Show("请先停止"); return; } List list = new List(); foreach (ListViewItem selectedItem in base.listData.SelectedItems) { list.Add(new AppleAcount { appleId = selectedItem.SubItems[1].Text, applePwd = selectedItem.SubItems[2].Text }); } RearTaskRun(list); } private void btnLeaveFamilyQuery_Click(object sender, EventArgs e) { FromDBDataQuery fromDBDataQuery = new FromDBDataQuery(); fromDBDataQuery.sqlTitle = new Dictionary { { "value1", "账号|180" }, { "value2", "密码|100" }, { "value3", "国家|80" }, { "value4", "状态|100" }, { "value5", "信息|150" } }; fromDBDataQuery.type = "overcheck"; fromDBDataQuery.typeName = "AppStore过检记录"; fromDBDataQuery.Show(); } protected override void Dispose(bool disposing) { if (disposing && components != null) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.groupBox9 = new System.Windows.Forms.GroupBox(); this.ComCountrySelectList = new System.Windows.Forms.ComboBox(); this.label63 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.textBox2 = new System.Windows.Forms.TextBox(); this.ckOvercheckVpn = new System.Windows.Forms.CheckBox(); this.labOvercheckInter = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox10 = new System.Windows.Forms.GroupBox(); this.labOvercheckCount = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.btnOvercheckLiteClre = new System.Windows.Forms.Button(); this.btnOvercheckQuery = new System.Windows.Forms.Button(); this.btnOvercheckInput = new System.Windows.Forms.Button(); this.btnOvercheckExper = new System.Windows.Forms.Button(); this.btnOvercheckStart = new System.Windows.Forms.Button(); this.groupBox12 = new System.Windows.Forms.GroupBox(); this.listOvercheck = new AppleBatch_June.Views.DoubleBufferListView(); this.columnHeader8 = new System.Windows.Forms.ColumnHeader(); this.columnHeader9 = new System.Windows.Forms.ColumnHeader(); this.columnHeader10 = new System.Windows.Forms.ColumnHeader(); this.columnHeader3 = new System.Windows.Forms.ColumnHeader(); this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); this.columnHeader14 = new System.Windows.Forms.ColumnHeader(); this.groupBox9.SuspendLayout(); this.groupBox10.SuspendLayout(); this.groupBox12.SuspendLayout(); base.SuspendLayout(); this.groupBox9.Controls.Add(this.ComCountrySelectList); this.groupBox9.Controls.Add(this.label63); this.groupBox9.Controls.Add(this.label1); this.groupBox9.Controls.Add(this.textBox2); this.groupBox9.Controls.Add(this.ckOvercheckVpn); this.groupBox9.Controls.Add(this.labOvercheckInter); this.groupBox9.Controls.Add(this.label10); this.groupBox9.Controls.Add(this.label13); this.groupBox9.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.groupBox9.Location = new System.Drawing.Point(455, 12); this.groupBox9.Name = "groupBox9"; this.groupBox9.Size = new System.Drawing.Size(510, 126); this.groupBox9.TabIndex = 20; this.groupBox9.TabStop = false; this.groupBox9.Text = "AppStore检查 功能说明"; this.ComCountrySelectList.FormattingEnabled = true; this.ComCountrySelectList.Location = new System.Drawing.Point(99, 55); this.ComCountrySelectList.Name = "ComCountrySelectList"; this.ComCountrySelectList.Size = new System.Drawing.Size(158, 25); this.ComCountrySelectList.TabIndex = 14; this.label63.AutoSize = true; this.label63.Location = new System.Drawing.Point(13, 59); this.label63.Name = "label63"; this.label63.Size = new System.Drawing.Size(80, 17); this.label63.TabIndex = 13; this.label63.Text = "指定过检国家"; this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(271, 59); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(188, 17); this.label1.TabIndex = 12; this.label1.Text = "不指定国家则使用账号默认的国家"; this.textBox2.BackColor = System.Drawing.SystemColors.ControlLightLight; this.textBox2.Location = new System.Drawing.Point(265, 91); this.textBox2.Name = "textBox2"; this.textBox2.ReadOnly = true; this.textBox2.Size = new System.Drawing.Size(238, 23); this.textBox2.TabIndex = 11; this.textBox2.Text = "导入格式:xxx@xx.com----密码"; this.ckOvercheckVpn.AutoSize = true; this.ckOvercheckVpn.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134); this.ckOvercheckVpn.ForeColor = System.Drawing.Color.Red; this.ckOvercheckVpn.Location = new System.Drawing.Point(18, 95); this.ckOvercheckVpn.Name = "ckOvercheckVpn"; this.ckOvercheckVpn.Size = new System.Drawing.Size(111, 21); this.ckOvercheckVpn.TabIndex = 10; this.ckOvercheckVpn.Text = "使用随机IP代理"; this.ckOvercheckVpn.UseVisualStyleBackColor = true; this.labOvercheckInter.AutoSize = true; this.labOvercheckInter.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134); this.labOvercheckInter.ForeColor = System.Drawing.Color.Crimson; this.labOvercheckInter.Location = new System.Drawing.Point(223, 96); this.labOvercheckInter.Name = "labOvercheckInter"; this.labOvercheckInter.Size = new System.Drawing.Size(18, 19); this.labOvercheckInter.TabIndex = 2; this.labOvercheckInter.Text = "0"; this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(135, 97); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(92, 17); this.label10.TabIndex = 1; this.label10.Text = "查询消耗点数:"; this.label13.AutoSize = true; this.label13.Location = new System.Drawing.Point(10, 27); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(475, 17); this.label13.TabIndex = 0; this.label13.Text = "启用之后可以正常使用 AppStore 和 iTunes 功能,无需过检账号和需要补资料扣 {0} 点\r\n"; this.groupBox10.Controls.Add(this.labOvercheckCount); this.groupBox10.Controls.Add(this.label16); this.groupBox10.Controls.Add(this.btnOvercheckLiteClre); this.groupBox10.Controls.Add(this.btnOvercheckQuery); this.groupBox10.Controls.Add(this.btnOvercheckInput); this.groupBox10.Controls.Add(this.btnOvercheckExper); this.groupBox10.Controls.Add(this.btnOvercheckStart); this.groupBox10.Location = new System.Drawing.Point(12, 12); this.groupBox10.Name = "groupBox10"; this.groupBox10.Size = new System.Drawing.Size(437, 126); this.groupBox10.TabIndex = 19; this.groupBox10.TabStop = false; this.groupBox10.Text = "操作"; this.labOvercheckCount.AutoSize = true; this.labOvercheckCount.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.labOvercheckCount.ForeColor = System.Drawing.Color.OrangeRed; this.labOvercheckCount.Location = new System.Drawing.Point(282, 15); this.labOvercheckCount.Name = "labOvercheckCount"; this.labOvercheckCount.Size = new System.Drawing.Size(15, 17); this.labOvercheckCount.TabIndex = 7; this.labOvercheckCount.Text = "0"; this.label16.AutoSize = true; this.label16.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.label16.Location = new System.Drawing.Point(179, 16); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(95, 17); this.label16.TabIndex = 6; this.label16.Text = "列表中账号数量:"; this.btnOvercheckLiteClre.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.btnOvercheckLiteClre.Location = new System.Drawing.Point(325, 75); this.btnOvercheckLiteClre.Name = "btnOvercheckLiteClre"; this.btnOvercheckLiteClre.Size = new System.Drawing.Size(96, 23); this.btnOvercheckLiteClre.TabIndex = 5; this.btnOvercheckLiteClre.Text = "清空账号列表"; this.btnOvercheckLiteClre.UseVisualStyleBackColor = true; this.btnOvercheckLiteClre.Click += new System.EventHandler(btnLiteClre_Click); this.btnOvercheckQuery.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.btnOvercheckQuery.Location = new System.Drawing.Point(179, 42); this.btnOvercheckQuery.Name = "btnOvercheckQuery"; this.btnOvercheckQuery.Size = new System.Drawing.Size(140, 23); this.btnOvercheckQuery.TabIndex = 4; this.btnOvercheckQuery.Text = "账号过检记录"; this.btnOvercheckQuery.UseVisualStyleBackColor = true; this.btnOvercheckQuery.Click += new System.EventHandler(btnLeaveFamilyQuery_Click); this.btnOvercheckInput.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.btnOvercheckInput.Location = new System.Drawing.Point(179, 76); this.btnOvercheckInput.Name = "btnOvercheckInput"; this.btnOvercheckInput.Size = new System.Drawing.Size(140, 23); this.btnOvercheckInput.TabIndex = 3; this.btnOvercheckInput.Text = "账号输入"; this.btnOvercheckInput.UseVisualStyleBackColor = true; this.btnOvercheckInput.Click += new System.EventHandler(btnLeaveFamilyInput_Click); this.btnOvercheckExper.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.btnOvercheckExper.Location = new System.Drawing.Point(325, 42); this.btnOvercheckExper.Name = "btnOvercheckExper"; this.btnOvercheckExper.Size = new System.Drawing.Size(96, 23); this.btnOvercheckExper.TabIndex = 2; this.btnOvercheckExper.Text = "导出账号"; this.btnOvercheckExper.UseVisualStyleBackColor = true; this.btnOvercheckExper.Click += new System.EventHandler(btnLeaveFamilyExper_Click); this.btnOvercheckStart.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134); this.btnOvercheckStart.ForeColor = System.Drawing.Color.Green; this.btnOvercheckStart.Location = new System.Drawing.Point(18, 33); this.btnOvercheckStart.Name = "btnOvercheckStart"; this.btnOvercheckStart.Size = new System.Drawing.Size(110, 65); this.btnOvercheckStart.TabIndex = 1; this.btnOvercheckStart.Text = "开始执行"; this.btnOvercheckStart.UseVisualStyleBackColor = true; this.btnOvercheckStart.Click += new System.EventHandler(btnLeaveFamilyStart_Click); this.groupBox12.Controls.Add(this.listOvercheck); this.groupBox12.Location = new System.Drawing.Point(9, 144); this.groupBox12.Name = "groupBox12"; this.groupBox12.Size = new System.Drawing.Size(956, 408); this.groupBox12.TabIndex = 18; this.groupBox12.TabStop = false; this.groupBox12.Text = "Apple账号列表"; this.listOvercheck.Columns.AddRange(new System.Windows.Forms.ColumnHeader[6] { this.columnHeader8, this.columnHeader9, this.columnHeader10, this.columnHeader3, this.columnHeader1, this.columnHeader14 }); this.listOvercheck.Dock = System.Windows.Forms.DockStyle.Fill; this.listOvercheck.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.listOvercheck.FullRowSelect = true; this.listOvercheck.HideSelection = false; this.listOvercheck.Location = new System.Drawing.Point(3, 17); this.listOvercheck.Name = "listOvercheck"; this.listOvercheck.Size = new System.Drawing.Size(950, 388); this.listOvercheck.TabIndex = 0; this.listOvercheck.UseCompatibleStateImageBehavior = false; this.listOvercheck.View = System.Windows.Forms.View.Details; this.columnHeader8.Text = "序号"; this.columnHeader9.Text = "账号"; this.columnHeader9.Width = 150; this.columnHeader10.Text = "密码"; this.columnHeader10.Width = 100; this.columnHeader3.Text = "国家"; this.columnHeader3.Width = 100; this.columnHeader1.Text = "状态"; this.columnHeader1.Width = 100; this.columnHeader14.Text = "信息"; this.columnHeader14.Width = 350; base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f); base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; base.ClientSize = new System.Drawing.Size(977, 561); base.Controls.Add(this.groupBox9); base.Controls.Add(this.groupBox10); base.Controls.Add(this.groupBox12); base.MaximizeBox = false; base.Name = "FromOvercheck"; base.ShowIcon = false; base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "AppStore 检查-过检"; base.Load += new System.EventHandler(FromLeaveFamily_Load); this.groupBox9.ResumeLayout(false); this.groupBox9.PerformLayout(); this.groupBox10.ResumeLayout(false); this.groupBox10.PerformLayout(); this.groupBox12.ResumeLayout(false); base.ResumeLayout(false); } } }