Files
kami_itunes_june/AppleBatch_June/ReddemHelp.cs
danial cb905409f8 Refactor AppleBatch_June project:
- Removed DotRas library dependency in RasTools.cs, providing empty implementations for Connect and Disconnect methods.
- Updated context menu implementation in ReddemHelp.cs to use ToolStripMenuItem and ContextMenuStrip.
- Replaced caching mechanism in SiteHelper.cs with a custom dictionary-based implementation, removing reliance on HttpRuntime.Cache.
- Switched from JavaScriptSerializer to Newtonsoft.Json for JSON serialization/deserialization in multiple files (Tools.cs, addMaterial.cs).
- Added WebHeaderCollection property to HttpItem.cs for better header management.
- Deleted obsolete AssemblyInfo.cs file.
- Introduced apple_balance_query.py for querying Apple ID balance via Privacy Center, implementing authentication and balance retrieval logic.
2025-11-10 17:38:18 +08:00

458 lines
17 KiB
C#
Raw 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;
namespace AppleBatch_June
{
public class ReddemHelp : Form
{
private IContainer components;
private Label label1;
private TextBox textBox1;
private TextBox textBox2;
private Label label2;
private Label label3;
private GroupBox groupBox1;
private Label label4;
private RichTextBox txtReust;
private GroupBox groupBox3;
private RichTextBox txtInputBox2;
private GroupBox groupBox2;
private RichTextBox txtInputBox1;
private TextBox txtNumber;
private Button btnSettle;
private Label label5;
private Label label6;
private TextBox txtSeparator;
private Label label7;
private CheckBox ckIsAppleid;
private CheckBox ckClearData;
private Label label8;
private Label label9;
private CheckBox checkBox1;
public ReddemHelp()
{
InitializeComponent();
}
private void ReddemHelp_Load(object sender, EventArgs e)
{
InitRichTextBoxContextMenu(txtInputBox1);
InitRichTextBoxContextMenu(txtInputBox2);
InitRichTextBoxContextMenu(txtReust);
}
private void InitRichTextBoxContextMenu(RichTextBox textBox)
{
ToolStripMenuItem menuItem = new ToolStripMenuItem("剪切");
menuItem.Click += delegate
{
textBox.Cut();
};
ToolStripMenuItem menuItem2 = new ToolStripMenuItem("复制");
menuItem2.Click += delegate
{
textBox.Copy();
};
ToolStripMenuItem menuItem3 = new ToolStripMenuItem("粘贴");
menuItem3.Click += delegate
{
textBox.Paste();
};
ContextMenuStrip contextMenu = new ContextMenuStrip();
contextMenu.Items.Add(menuItem);
contextMenu.Items.Add(menuItem2);
contextMenu.Items.Add(menuItem3);
textBox.ContextMenuStrip = contextMenu;
}
private void btnSettle_Click(object sender, EventArgs e)
{
if (int.TryParse(txtNumber.Text, out var result))
{
if (result >= 1)
{
List<string> list = new List<string>();
List<string> list2 = new List<string>();
if (ckIsAppleid.Checked)
{
foreach (AppleAcount item in AppleUtlis.accountInput(txtInputBox1.Text, null, removePwd: false, isdeWeight: false, forceAotuIdent: true))
{
list.Add(item.appleId + "----" + item.applePwd);
}
}
else
{
string[] array = txtInputBox1.Text.Split('\n');
foreach (string text in array)
{
if (!string.IsNullOrEmpty(text))
{
list.Add(text.Trim());
}
}
}
if (checkBox1.Checked)
{
string text2 = txtInputBox2.Text.Split('\n')[0];
if (string.IsNullOrEmpty(text2))
{
MessageBox.Show("请输入一行文本2的数据");
return;
}
for (int j = 0; j < list.Count; j++)
{
list2.Add(text2.Trim());
}
}
else
{
string[] array = txtInputBox2.Text.Split('\n');
foreach (string text3 in array)
{
if (!string.IsNullOrEmpty(text3))
{
list2.Add(text3.Trim());
}
}
}
List<string> list3 = MergeSort(list, list2, result, txtSeparator.Text, ckClearData.Checked);
txtReust.Text = "";
{
foreach (string item2 in list3)
{
txtReust.AppendText(item2 + "\n");
}
return;
}
}
MessageBox.Show("数量输入错误不能少于1");
}
else
{
MessageBox.Show("数量输入错误");
}
}
private List<string> MergeSort(List<string> ListInputBox1, List<string> ListInputBox2, int number, string separator, bool isckClearData)
{
List<string> list = new List<string>();
foreach (string item in ListInputBox1)
{
if (ListInputBox2.Count >= number)
{
string text = item ?? "";
string[] array;
for (int i = 0; i < number; i++)
{
if (ListInputBox2.Count <= 0)
{
break;
}
string text2 = ListInputBox2.ElementAt(0);
ListInputBox2.RemoveAt(0);
text = text + separator + text2;
if (!isckClearData)
{
continue;
}
array = txtInputBox2.Text.Split('\n');
foreach (string text3 in array)
{
if (text3.StartsWith(text2))
{
txtInputBox2.Text = txtInputBox2.Text.Replace(text3, "");
break;
}
}
}
list.Add(text);
if (!isckClearData)
{
continue;
}
array = txtInputBox1.Text.Split('\n');
foreach (string text4 in array)
{
if (text4.StartsWith(item.Split('-')[0]))
{
txtInputBox1.Text = txtInputBox1.Text.Replace(text4, "");
break;
}
}
continue;
}
return list;
}
return list;
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.ckClearData = new System.Windows.Forms.CheckBox();
this.ckIsAppleid = new System.Windows.Forms.CheckBox();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.txtSeparator = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.txtNumber = new System.Windows.Forms.TextBox();
this.btnSettle = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.txtInputBox2 = new System.Windows.Forms.RichTextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.txtInputBox1 = new System.Windows.Forms.RichTextBox();
this.txtReust = new System.Windows.Forms.RichTextBox();
this.label4 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
base.SuspendLayout();
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 12f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.label1.Location = new System.Drawing.Point(12, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(272, 22);
this.label1.TabIndex = 0;
this.label1.Text = "批量ID加卡 格式 1多个id请换行";
this.textBox1.Font = new System.Drawing.Font("微软雅黑", 12f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.textBox1.ForeColor = System.Drawing.Color.Peru;
this.textBox1.Location = new System.Drawing.Point(16, 60);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(268, 29);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "账号----密码-卡密";
this.textBox2.Font = new System.Drawing.Font("微软雅黑", 12f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.textBox2.ForeColor = System.Drawing.Color.Peru;
this.textBox2.Location = new System.Drawing.Point(357, 59);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(329, 29);
this.textBox2.TabIndex = 3;
this.textBox2.Text = "账号----密码-卡密-卡密-卡密....卡密";
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 12f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.label2.Location = new System.Drawing.Point(354, 22);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(434, 22);
this.label2.TabIndex = 2;
this.label2.Text = "批量ID加卡 格式 2一个ID支持多个卡密多个id请换行";
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(356, 101);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(299, 12);
this.label3.TabIndex = 4;
this.label3.Text = "例如:aaabbb@xx.com---Pp112211---aaaa-bbb-ccc-dddd";
this.groupBox1.Controls.Add(this.checkBox1);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.ckClearData);
this.groupBox1.Controls.Add(this.ckIsAppleid);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.txtSeparator);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.txtNumber);
this.groupBox1.Controls.Add(this.btnSettle);
this.groupBox1.Controls.Add(this.groupBox3);
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.txtReust);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 12f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.groupBox1.Location = new System.Drawing.Point(6, 133);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(849, 386);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "卡密快速整理";
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.label9.ForeColor = System.Drawing.Color.Peru;
this.label9.Location = new System.Drawing.Point(113, 23);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(606, 17);
this.label9.TabIndex = 14;
this.label9.Text = "该功能应用场景假设有100个ID和300张卡密每个ID需要兑换三张卡密使用此功能就可以快速生成导入格式";
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.label8.Location = new System.Drawing.Point(571, 47);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(260, 17);
this.label8.TabIndex = 13;
this.label8.Text = "合并生成的结果,需要导入之后,才能执行兑换";
this.ckClearData.AutoSize = true;
this.ckClearData.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.ckClearData.Location = new System.Drawing.Point(157, 51);
this.ckClearData.Name = "ckClearData";
this.ckClearData.Size = new System.Drawing.Size(135, 21);
this.ckClearData.TabIndex = 12;
this.ckClearData.Text = "合并之后删除原数据";
this.ckClearData.UseVisualStyleBackColor = true;
this.ckIsAppleid.AutoSize = true;
this.ckIsAppleid.Checked = true;
this.ckIsAppleid.CheckState = System.Windows.Forms.CheckState.Checked;
this.ckIsAppleid.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.ckIsAppleid.Location = new System.Drawing.Point(18, 51);
this.ckIsAppleid.Name = "ckIsAppleid";
this.ckIsAppleid.Size = new System.Drawing.Size(120, 21);
this.ckIsAppleid.TabIndex = 11;
this.ckIsAppleid.Text = "文本1是ID请勾选";
this.ckIsAppleid.UseVisualStyleBackColor = true;
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.label7.Location = new System.Drawing.Point(527, 119);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(32, 17);
this.label7.TabIndex = 10;
this.label7.Text = "数量";
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.label6.Location = new System.Drawing.Point(492, 154);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(68, 17);
this.label6.TabIndex = 9;
this.label6.Text = "合并分割符";
this.txtSeparator.Location = new System.Drawing.Point(447, 147);
this.txtSeparator.Name = "txtSeparator";
this.txtSeparator.Size = new System.Drawing.Size(35, 29);
this.txtSeparator.TabIndex = 8;
this.txtSeparator.Text = "-";
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.label5.Location = new System.Drawing.Point(437, 71);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(128, 34);
this.label5.TabIndex = 7;
this.label5.Text = "左边文本一行数量\r\n合并右边多少文本数量";
this.txtNumber.Location = new System.Drawing.Point(447, 112);
this.txtNumber.Name = "txtNumber";
this.txtNumber.Size = new System.Drawing.Size(73, 29);
this.txtNumber.TabIndex = 6;
this.txtNumber.Text = "1";
this.btnSettle.Font = new System.Drawing.Font("微软雅黑", 12f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.btnSettle.ForeColor = System.Drawing.Color.Green;
this.btnSettle.Location = new System.Drawing.Point(440, 182);
this.btnSettle.Name = "btnSettle";
this.btnSettle.Size = new System.Drawing.Size(115, 30);
this.btnSettle.TabIndex = 5;
this.btnSettle.Text = "合并整理";
this.btnSettle.UseVisualStyleBackColor = true;
this.btnSettle.Click += new System.EventHandler(btnSettle_Click);
this.groupBox3.Controls.Add(this.txtInputBox2);
this.groupBox3.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.groupBox3.Location = new System.Drawing.Point(227, 78);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(204, 294);
this.groupBox3.TabIndex = 4;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "输入卡密或文本2";
this.txtInputBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtInputBox2.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.txtInputBox2.Location = new System.Drawing.Point(3, 19);
this.txtInputBox2.Name = "txtInputBox2";
this.txtInputBox2.Size = new System.Drawing.Size(198, 272);
this.txtInputBox2.TabIndex = 0;
this.txtInputBox2.Text = "";
this.groupBox2.Controls.Add(this.txtInputBox1);
this.groupBox2.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.groupBox2.Location = new System.Drawing.Point(6, 78);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(215, 297);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "账号密码或文本1";
this.txtInputBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtInputBox1.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.txtInputBox1.Location = new System.Drawing.Point(3, 19);
this.txtInputBox1.Name = "txtInputBox1";
this.txtInputBox1.Size = new System.Drawing.Size(209, 275);
this.txtInputBox1.TabIndex = 0;
this.txtInputBox1.Text = "";
this.txtReust.Font = new System.Drawing.Font("微软雅黑", 7.5f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
this.txtReust.Location = new System.Drawing.Point(565, 71);
this.txtReust.Name = "txtReust";
this.txtReust.Size = new System.Drawing.Size(274, 298);
this.txtReust.TabIndex = 2;
this.txtReust.Text = "";
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(29, 101);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(173, 12);
this.label4.TabIndex = 6;
this.label4.Text = "按以上两个格式导入账号和密码";
this.checkBox1.AutoSize = true;
this.checkBox1.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.checkBox1.Location = new System.Drawing.Point(298, 50);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(82, 21);
this.checkBox1.TabIndex = 15;
this.checkBox1.Text = "固定文本2";
this.checkBox1.UseVisualStyleBackColor = true;
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(860, 523);
base.Controls.Add(this.label4);
base.Controls.Add(this.groupBox1);
base.Controls.Add(this.label3);
base.Controls.Add(this.textBox2);
base.Controls.Add(this.label2);
base.Controls.Add(this.textBox1);
base.Controls.Add(this.label1);
base.MaximizeBox = false;
base.Name = "ReddemHelp";
base.ShowIcon = false;
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "批量ID加卡教程";
base.Load += new System.EventHandler(ReddemHelp_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
base.ResumeLayout(false);
base.PerformLayout();
}
}
}