Files
kami_itunes_june/AppleBatch_June.Forms/FromLeaveFamily.cs
2024-07-22 00:43:14 +08:00

495 lines
19 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using AppleBatch_June.ExecuteTasks;
using AppleBatch_June.Model;
using AppleBatch_June.Views;
namespace AppleBatch_June.Forms
{
public class FromLeaveFamily : BaseForm
{
private IContainer components;
private GroupBox groupBox9;
private TextBox textBox2;
private CheckBox ckLeaveFamilyVpn;
private Label labLeaveFamilyInter;
private Label label10;
private Label label13;
private GroupBox groupBox10;
private Label labLeaveFamilyCount;
private Label label16;
private Button btnLiteClre;
private Button btnLeaveFamilyQuery;
private Button btnLeaveFamilyInput;
private Button btnLeaveFamilyExper;
private Button btnLeaveFamilyStart;
private GroupBox groupBox12;
private DoubleBufferListView listLeaveFamily;
private ColumnHeader columnHeader8;
private ColumnHeader columnHeader9;
private ColumnHeader columnHeader10;
private ColumnHeader columnHeader1;
private ColumnHeader columnHeader14;
private ColumnHeader columnHeader3;
public FromLeaveFamily()
: base("关闭家庭共享", LeaveFamilyTask.Instance)
{
InitializeComponent();
}
private void FromLeaveFamily_Load(object sender, EventArgs e)
{
base.listData = listLeaveFamily;
base.labCout = labLeaveFamilyCount;
base.startBtn = btnLeaveFamilyStart;
labLeaveFamilyInter.Text = AppSysConfig.getTypeById(30).consNum.ToString();
ckLeaveFamilyVpn.Checked = ((ConfigUtlis.getConfigValue("ckLeaveFamilyVpn") == "True") ? true : false);
InitLv(base.listData);
BindMenuStrip(addTwoFactor: true);
}
private void btnLeaveFamilyStart_Click(object sender, EventArgs e)
{
if (!LeaveFamilyTask.Instance.isRun && !LeaveFamilyTask.Instance.TaskIsRun)
{
List<AppleAcount> 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;
}
LeaveFamilyTask.Instance.Stop();
if (!base.IsDisposed)
{
Invoke((Action)delegate
{
base.startBtn.Text = "正在停止";
base.startBtn.ForeColor = Color.Red;
});
}
}
private void RearTaskRun(List<AppleAcount> lvItems)
{
int id = 30;
int count = lvItems.Count;
if (AppSysConfig.integral < count * AppSysConfig.getTypeById(30).consNum)
{
MessageBox.Show("账号点数不足 , 执行账号数量:" + count + " ,至少需要 " + count * AppSysConfig.getTypeById(id).consNum + " 点数。");
}
else
{
ConfigUtlis.saveConfigKey("ckLeaveFamilyVpn", ckLeaveFamilyVpn.Checked.ToString());
LeaveFamilyTask.Instance.ExecuteLeaveFamily(2, ckLeaveFamilyVpn.Checked, lvItems, base.startAct, base.endTakAct, sucessAct, _action);
}
}
public void sucessAct(string AppleId)
{
UpdataUi(delegate
{
ListViewItem listViewItem = (from ListViewItem c in base.listData.Items
where c.SubItems[1].Text == AppleId
select c).FirstOrDefault();
if (listViewItem != null)
{
SqliteHelper.ExecuteInsert("itunes_db", new Dictionary<string, string>
{
{ "type", "leaveFamily" },
{
"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
{
IEnumerable<ListViewItem> enumerable = from ListViewItem c in base.listData.Items
where c.SubItems[1].Text == key
select c;
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[5].Text = reust;
item.SubItems[5].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 = ckLeaveFamilyVpn.Checked;
if (fromInputAcount.ShowDialog() == DialogResult.OK)
{
List<AppleAcount> 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;
}
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("-");
base.listData.Items.Add(listViewItem);
}
}
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<AppleAcount> list = new List<AppleAcount>();
foreach (ListViewItem selectedItem in base.listData.SelectedItems)
{
list.Add(new AppleAcount
{
appleId = selectedItem.SubItems[1].Text,
applePwd = selectedItem.SubItems[2].Text + reust
});
}
RearTaskRun(list);
}
public override void ReExecute_Click(object sender, EventArgs e)
{
if (LeaveFamilyTask.Instance.TaskIsRun)
{
MessageBox.Show("请先停止");
return;
}
List<AppleAcount> list = new List<AppleAcount>();
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<string, string>
{
{ "value1", "账号|180" },
{ "value2", "密码|100" },
{ "value3", "国家|80" },
{ "value4", "状态|100" },
{ "value5", "信息|150" }
};
fromDBDataQuery.type = "leaveFamily";
fromDBDataQuery.typeName = "关闭家庭共享记录";
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.textBox2 = new System.Windows.Forms.TextBox();
this.ckLeaveFamilyVpn = new System.Windows.Forms.CheckBox();
this.labLeaveFamilyInter = 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.labLeaveFamilyCount = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.btnLiteClre = new System.Windows.Forms.Button();
this.btnLeaveFamilyQuery = new System.Windows.Forms.Button();
this.btnLeaveFamilyInput = new System.Windows.Forms.Button();
this.btnLeaveFamilyExper = new System.Windows.Forms.Button();
this.btnLeaveFamilyStart = new System.Windows.Forms.Button();
this.groupBox12 = new System.Windows.Forms.GroupBox();
this.listLeaveFamily = 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.textBox2);
this.groupBox9.Controls.Add(this.ckLeaveFamilyVpn);
this.groupBox9.Controls.Add(this.labLeaveFamilyInter);
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 = "关闭家庭共享 功能说明";
this.textBox2.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.textBox2.Location = new System.Drawing.Point(151, 81);
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(324, 23);
this.textBox2.TabIndex = 11;
this.textBox2.Text = "导入格式xxx@xx.com----密码";
this.ckLeaveFamilyVpn.AutoSize = true;
this.ckLeaveFamilyVpn.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.ckLeaveFamilyVpn.ForeColor = System.Drawing.Color.Red;
this.ckLeaveFamilyVpn.Location = new System.Drawing.Point(18, 87);
this.ckLeaveFamilyVpn.Name = "ckLeaveFamilyVpn";
this.ckLeaveFamilyVpn.Size = new System.Drawing.Size(111, 21);
this.ckLeaveFamilyVpn.TabIndex = 10;
this.ckLeaveFamilyVpn.Text = "使用随机IP代理";
this.ckLeaveFamilyVpn.UseVisualStyleBackColor = true;
this.labLeaveFamilyInter.AutoSize = true;
this.labLeaveFamilyInter.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.labLeaveFamilyInter.ForeColor = System.Drawing.Color.Crimson;
this.labLeaveFamilyInter.Location = new System.Drawing.Point(103, 60);
this.labLeaveFamilyInter.Name = "labLeaveFamilyInter";
this.labLeaveFamilyInter.Size = new System.Drawing.Size(18, 19);
this.labLeaveFamilyInter.TabIndex = 2;
this.labLeaveFamilyInter.Text = "0";
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(15, 62);
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(15, 28);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(416, 17);
this.label13.TabIndex = 0;
this.label13.Text = "如果是组织者关闭家庭共享,则解散整个家庭共享,如果是成员,则退出家庭";
this.groupBox10.Controls.Add(this.labLeaveFamilyCount);
this.groupBox10.Controls.Add(this.label16);
this.groupBox10.Controls.Add(this.btnLiteClre);
this.groupBox10.Controls.Add(this.btnLeaveFamilyQuery);
this.groupBox10.Controls.Add(this.btnLeaveFamilyInput);
this.groupBox10.Controls.Add(this.btnLeaveFamilyExper);
this.groupBox10.Controls.Add(this.btnLeaveFamilyStart);
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.labLeaveFamilyCount.AutoSize = true;
this.labLeaveFamilyCount.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.labLeaveFamilyCount.ForeColor = System.Drawing.Color.OrangeRed;
this.labLeaveFamilyCount.Location = new System.Drawing.Point(282, 15);
this.labLeaveFamilyCount.Name = "labLeaveFamilyCount";
this.labLeaveFamilyCount.Size = new System.Drawing.Size(15, 17);
this.labLeaveFamilyCount.TabIndex = 7;
this.labLeaveFamilyCount.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.btnLiteClre.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnLiteClre.Location = new System.Drawing.Point(325, 75);
this.btnLiteClre.Name = "btnLiteClre";
this.btnLiteClre.Size = new System.Drawing.Size(96, 23);
this.btnLiteClre.TabIndex = 5;
this.btnLiteClre.Text = "清空账号列表";
this.btnLiteClre.UseVisualStyleBackColor = true;
this.btnLiteClre.Click += new System.EventHandler(btnLiteClre_Click);
this.btnLeaveFamilyQuery.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnLeaveFamilyQuery.Location = new System.Drawing.Point(179, 42);
this.btnLeaveFamilyQuery.Name = "btnLeaveFamilyQuery";
this.btnLeaveFamilyQuery.Size = new System.Drawing.Size(140, 23);
this.btnLeaveFamilyQuery.TabIndex = 4;
this.btnLeaveFamilyQuery.Text = "关闭家庭共享记录";
this.btnLeaveFamilyQuery.UseVisualStyleBackColor = true;
this.btnLeaveFamilyQuery.Click += new System.EventHandler(btnLeaveFamilyQuery_Click);
this.btnLeaveFamilyInput.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnLeaveFamilyInput.Location = new System.Drawing.Point(179, 76);
this.btnLeaveFamilyInput.Name = "btnLeaveFamilyInput";
this.btnLeaveFamilyInput.Size = new System.Drawing.Size(140, 23);
this.btnLeaveFamilyInput.TabIndex = 3;
this.btnLeaveFamilyInput.Text = "账号输入";
this.btnLeaveFamilyInput.UseVisualStyleBackColor = true;
this.btnLeaveFamilyInput.Click += new System.EventHandler(btnLeaveFamilyInput_Click);
this.btnLeaveFamilyExper.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.btnLeaveFamilyExper.Location = new System.Drawing.Point(325, 42);
this.btnLeaveFamilyExper.Name = "btnLeaveFamilyExper";
this.btnLeaveFamilyExper.Size = new System.Drawing.Size(96, 23);
this.btnLeaveFamilyExper.TabIndex = 2;
this.btnLeaveFamilyExper.Text = "导出账号";
this.btnLeaveFamilyExper.UseVisualStyleBackColor = true;
this.btnLeaveFamilyExper.Click += new System.EventHandler(btnLeaveFamilyExper_Click);
this.btnLeaveFamilyStart.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.btnLeaveFamilyStart.ForeColor = System.Drawing.Color.Green;
this.btnLeaveFamilyStart.Location = new System.Drawing.Point(18, 33);
this.btnLeaveFamilyStart.Name = "btnLeaveFamilyStart";
this.btnLeaveFamilyStart.Size = new System.Drawing.Size(110, 65);
this.btnLeaveFamilyStart.TabIndex = 1;
this.btnLeaveFamilyStart.Text = "开始执行";
this.btnLeaveFamilyStart.UseVisualStyleBackColor = true;
this.btnLeaveFamilyStart.Click += new System.EventHandler(btnLeaveFamilyStart_Click);
this.groupBox12.Controls.Add(this.listLeaveFamily);
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 = "iCloud账号列表";
this.listLeaveFamily.Columns.AddRange(new System.Windows.Forms.ColumnHeader[6] { this.columnHeader8, this.columnHeader9, this.columnHeader10, this.columnHeader3, this.columnHeader1, this.columnHeader14 });
this.listLeaveFamily.Dock = System.Windows.Forms.DockStyle.Fill;
this.listLeaveFamily.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.listLeaveFamily.FullRowSelect = true;
this.listLeaveFamily.HideSelection = false;
this.listLeaveFamily.Location = new System.Drawing.Point(3, 17);
this.listLeaveFamily.Name = "listLeaveFamily";
this.listLeaveFamily.Size = new System.Drawing.Size(950, 388);
this.listLeaveFamily.TabIndex = 0;
this.listLeaveFamily.UseCompatibleStateImageBehavior = false;
this.listLeaveFamily.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 = "FromLeaveFamily";
base.ShowIcon = false;
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "关闭家庭共享";
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);
}
}
}