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

425 lines
15 KiB
C#

using System;
using System.ComponentModel;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
using AppleBatch_June.ExecuteTasks;
namespace AppleBatch_June
{
public class FromInputAcount : Form
{
private IContainer components;
private Label label2;
private Label label1;
private TextBox txtTipMsg;
private Button btnInput;
private CheckBox ckAotuIdent;
private ContextMenuStrip contextMenuStrip1;
private ToolStripMenuItem ToolStripMenuItem;
private GroupBox groupBox1;
private Label label4;
private TextBox txtNewStr;
private Label label3;
private TextBox txtOldStr;
private Button button1;
private CheckBox ckInputReci;
private CheckBox ckReplace;
private Label label5;
private Label label6;
private TextBox txtSeparator;
private Label label7;
private Panel panel1;
public RichTextBox txtInputtext;
public string tipMssage { get; set; }
public bool isOpenSysVpn { get; set; }
public string StrInput { get; set; }
public FromInputAcount()
{
InitializeComponent();
}
private void FromInputAcount_Load(object sender, EventArgs e)
{
Console.WriteLine("isOpenSysVpn:" + isOpenSysVpn);
if (isOpenSysVpn)
{
string config = AppSysConfig.getConfig("InputPreloadingVpn");
if (DateTime.Now.AddMinutes(-5.0) > ProxyRunService.getApiUrlLostTime && config == "1")
{
Task.Run(delegate
{
string authenUserInfo = "";
ProxyRunService.GetApiUrl(ref authenUserInfo);
});
}
}
if (!string.IsNullOrEmpty(tipMssage))
{
txtTipMsg.Text = tipMssage;
}
txtSeparator.Text = ConfigUtlis.getConfigValue("txtSeparator");
ckAotuIdent.Checked = ((!(ConfigUtlis.getConfigValue("ckAotuIdent") == "False")) ? true : false);
ckInputReci.Checked = ((ConfigUtlis.getConfigValue("ckInputReci") == "True") ? true : false);
ckReplace.Checked = ((ConfigUtlis.getConfigValue("ckReplace") == "True") ? true : false);
if (ckReplace.Checked)
{
Panel panel = panel1;
GroupBox groupBox = groupBox1;
bool flag = true;
groupBox.Visible = true;
panel.Visible = true;
}
else
{
Panel panel2 = panel1;
GroupBox groupBox2 = groupBox1;
bool flag = false;
groupBox2.Visible = false;
panel2.Visible = false;
}
txtNewStr.Text = ConfigUtlis.getConfigValue("txtNewStr");
txtOldStr.Text = ConfigUtlis.getConfigValue("txtOldStr");
}
private void btnInput_Click(object sender, EventArgs e)
{
ConfigUtlis.saveConfigKey("ckInputReci", ckInputReci.Checked.ToString());
if (ckReplace.Checked && ckInputReci.Checked)
{
ConfigUtlis.saveConfigKey("txtNewStr", txtNewStr.Text.ToString());
ConfigUtlis.saveConfigKey("txtOldStr", txtOldStr.Text.ToString());
string text = txtNewStr.Text;
string text2 = txtOldStr.Text;
if (txtNewStr.Text == "\\n")
{
text = "\n";
}
if (txtOldStr.Text == "\\n")
{
text2 = "\n";
}
if (!string.IsNullOrEmpty(text2) && !string.IsNullOrEmpty(text))
{
txtInputtext.Text = txtInputtext.Text.Replace(text2, text);
}
}
StrInput = txtInputtext.Text;
base.DialogResult = DialogResult.OK;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
ConfigUtlis.saveConfigKey("ckAotuIdent", ckAotuIdent.Checked.ToString());
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
IDataObject dataObject = Clipboard.GetDataObject();
if (dataObject.GetDataPresent(DataFormats.Text))
{
txtInputtext.Text = (string)dataObject.GetData(DataFormats.Text);
}
}
catch (Exception)
{
MessageBox.Show("粘贴失败");
}
}
private void button1_Click(object sender, EventArgs e)
{
ConfigUtlis.saveConfigKey("txtNewStr", txtNewStr.Text.ToString());
ConfigUtlis.saveConfigKey("txtOldStr", txtOldStr.Text.ToString());
string text = txtNewStr.Text;
string text2 = txtOldStr.Text;
if (txtNewStr.Text == "\\n")
{
text = "\n";
}
if (txtOldStr.Text == "\\n")
{
text2 = "\n";
}
if (!string.IsNullOrEmpty(text2) && !string.IsNullOrEmpty(text))
{
txtInputtext.Text = txtInputtext.Text.Replace(text2, text);
}
}
private void ckInputReci_CheckedChanged(object sender, EventArgs e)
{
ConfigUtlis.saveConfigKey("ckInputReci", ckInputReci.Checked.ToString());
}
private void ckReplace_CheckedChanged(object sender, EventArgs e)
{
ConfigUtlis.saveConfigKey("ckReplace", ckReplace.Checked.ToString());
if (ckReplace.Checked)
{
Panel panel = panel1;
GroupBox groupBox = groupBox1;
bool flag = true;
groupBox.Visible = true;
panel.Visible = true;
}
else
{
Panel panel2 = panel1;
GroupBox groupBox2 = groupBox1;
bool flag = false;
groupBox2.Visible = false;
panel2.Visible = false;
}
}
private void txtseparator_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txtSeparator.Text))
{
ConfigUtlis.saveConfigKey("txtSeparator", "");
}
else
{
ConfigUtlis.saveConfigKey("txtSeparator", txtSeparator.Text[0].ToString());
}
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AppleBatch_June.FromInputAcount));
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.txtTipMsg = new System.Windows.Forms.TextBox();
this.btnInput = new System.Windows.Forms.Button();
this.txtInputtext = new System.Windows.Forms.RichTextBox();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ckAotuIdent = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.ckInputReci = new System.Windows.Forms.CheckBox();
this.label4 = new System.Windows.Forms.Label();
this.txtNewStr = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtOldStr = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.ckReplace = new System.Windows.Forms.CheckBox();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.txtSeparator = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.contextMenuStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.panel1.SuspendLayout();
base.SuspendLayout();
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(396, 22);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(84, 17);
this.label2.TabIndex = 9;
this.label2.Text = "多个ID,请换行";
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(15, 21);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 8;
this.label1.Text = "标准格式";
this.txtTipMsg.Location = new System.Drawing.Point(71, 18);
this.txtTipMsg.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtTipMsg.Name = "txtTipMsg";
this.txtTipMsg.ReadOnly = true;
this.txtTipMsg.Size = new System.Drawing.Size(320, 23);
this.txtTipMsg.TabIndex = 7;
this.txtTipMsg.Text = "xxx@xx.com----密码-答案1-答案2-答案3";
this.btnInput.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134);
this.btnInput.ForeColor = System.Drawing.Color.Green;
this.btnInput.Location = new System.Drawing.Point(266, 336);
this.btnInput.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnInput.Name = "btnInput";
this.btnInput.Size = new System.Drawing.Size(149, 56);
this.btnInput.TabIndex = 6;
this.btnInput.Text = "导入账号";
this.btnInput.UseVisualStyleBackColor = true;
this.btnInput.Click += new System.EventHandler(btnInput_Click);
this.txtInputtext.ContextMenuStrip = this.contextMenuStrip1;
this.txtInputtext.ForeColor = System.Drawing.SystemColors.MenuHighlight;
this.txtInputtext.Location = new System.Drawing.Point(21, 49);
this.txtInputtext.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtInputtext.Name = "txtInputtext";
this.txtInputtext.Size = new System.Drawing.Size(667, 279);
this.txtInputtext.TabIndex = 5;
this.txtInputtext.Text = "";
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[1] { this.ToolStripMenuItem });
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(101, 26);
this.ToolStripMenuItem.Name = "粘贴ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.ToolStripMenuItem.Text = "粘贴";
this.ToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_Click);
this.ckAotuIdent.AutoSize = true;
this.ckAotuIdent.Location = new System.Drawing.Point(482, 21);
this.ckAotuIdent.Name = "ckAotuIdent";
this.ckAotuIdent.Size = new System.Drawing.Size(112, 21);
this.ckAotuIdent.TabIndex = 10;
this.ckAotuIdent.Text = "智能识别ID格式";
this.ckAotuIdent.UseVisualStyleBackColor = true;
this.ckAotuIdent.CheckedChanged += new System.EventHandler(checkBox1_CheckedChanged);
this.groupBox1.Controls.Add(this.ckInputReci);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.txtNewStr);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.txtOldStr);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Location = new System.Drawing.Point(438, 331);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(254, 71);
this.groupBox1.TabIndex = 11;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "批量数据字符替换,换行用 \\n";
this.groupBox1.Visible = false;
this.ckInputReci.AutoSize = true;
this.ckInputReci.Location = new System.Drawing.Point(147, 15);
this.ckInputReci.Name = "ckInputReci";
this.ckInputReci.Size = new System.Drawing.Size(99, 21);
this.ckInputReci.TabIndex = 5;
this.ckInputReci.Text = "导入自动替换";
this.ckInputReci.UseVisualStyleBackColor = true;
this.ckInputReci.CheckedChanged += new System.EventHandler(ckInputReci_CheckedChanged);
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(7, 46);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 17);
this.label4.TabIndex = 4;
this.label4.Text = "替换字符";
this.txtNewStr.Location = new System.Drawing.Point(66, 43);
this.txtNewStr.Name = "txtNewStr";
this.txtNewStr.Size = new System.Drawing.Size(74, 23);
this.txtNewStr.TabIndex = 3;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 19);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 2;
this.label3.Text = "原字符";
this.txtOldStr.Location = new System.Drawing.Point(64, 16);
this.txtOldStr.Name = "txtOldStr";
this.txtOldStr.Size = new System.Drawing.Size(76, 23);
this.txtOldStr.TabIndex = 1;
this.button1.Location = new System.Drawing.Point(148, 38);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(86, 30);
this.button1.TabIndex = 0;
this.button1.Text = "替换";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(button1_Click);
this.ckReplace.AutoSize = true;
this.ckReplace.Location = new System.Drawing.Point(598, 21);
this.ckReplace.Name = "ckReplace";
this.ckReplace.Size = new System.Drawing.Size(99, 21);
this.ckReplace.TabIndex = 12;
this.ckReplace.Text = "分割符和替换";
this.ckReplace.UseVisualStyleBackColor = true;
this.ckReplace.CheckedChanged += new System.EventHandler(ckReplace_CheckedChanged);
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(5, 344);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(234, 17);
this.label5.TabIndex = 13;
this.label5.Text = "密码字段如果有 - (横杠) 的话,用 {-} 代替";
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(5, 8);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(44, 17);
this.label6.TabIndex = 15;
this.label6.Text = "分隔符";
this.txtSeparator.Location = new System.Drawing.Point(50, 5);
this.txtSeparator.Name = "txtSeparator";
this.txtSeparator.Size = new System.Drawing.Size(33, 23);
this.txtSeparator.TabIndex = 14;
this.txtSeparator.TextChanged += new System.EventHandler(txtseparator_TextChanged);
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(91, 8);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(80, 17);
this.label7.TabIndex = 16;
this.label7.Text = "默认: - (横杠)";
this.panel1.Controls.Add(this.label6);
this.panel1.Controls.Add(this.label7);
this.panel1.Controls.Add(this.txtSeparator);
this.panel1.Location = new System.Drawing.Point(12, 365);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(196, 33);
this.panel1.TabIndex = 17;
base.AutoScaleDimensions = new System.Drawing.SizeF(7f, 17f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(700, 407);
base.Controls.Add(this.panel1);
base.Controls.Add(this.label5);
base.Controls.Add(this.ckReplace);
base.Controls.Add(this.groupBox1);
base.Controls.Add(this.ckAotuIdent);
base.Controls.Add(this.label2);
base.Controls.Add(this.label1);
base.Controls.Add(this.txtTipMsg);
base.Controls.Add(this.btnInput);
base.Controls.Add(this.txtInputtext);
this.Font = new System.Drawing.Font("微软雅黑", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
base.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
base.MaximizeBox = false;
base.MinimizeBox = false;
base.Name = "FromInputAcount";
base.ShowIcon = false;
base.ShowInTaskbar = false;
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "账号导入";
base.Load += new System.EventHandler(FromInputAcount_Load);
this.contextMenuStrip1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
base.ResumeLayout(false);
base.PerformLayout();
}
}
}