diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fbb74b5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates +.vs/ + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Mine +Tmp/ +/packages/ diff --git a/MiHoYoStarter.sln b/MiHoYoStarter.sln new file mode 100644 index 0000000..00eb183 --- /dev/null +++ b/MiHoYoStarter.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33530.505 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiHoYoStarter", "MiHoYoStarter\MiHoYoStarter.csproj", "{B133648A-C581-43C6-8802-65B482B642DA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B133648A-C581-43C6-8802-65B482B642DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B133648A-C581-43C6-8802-65B482B642DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B133648A-C581-43C6-8802-65B482B642DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B133648A-C581-43C6-8802-65B482B642DA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8A1438A2-3811-4D30-8A28-FC39AF1E6271} + EndGlobalSection +EndGlobal diff --git a/MiHoYoStarter/App.config b/MiHoYoStarter/App.config new file mode 100644 index 0000000..dd38712 --- /dev/null +++ b/MiHoYoStarter/App.config @@ -0,0 +1,24 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MiHoYoStarter/FormInput.cs b/MiHoYoStarter/FormInput.cs new file mode 100644 index 0000000..ad875fb --- /dev/null +++ b/MiHoYoStarter/FormInput.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace MiHoYoStarter +{ + public partial class FormInput : Form + { + private string gameNameEN; + public FormInput(string gameNameEN) + { + InitializeComponent(); + this.gameNameEN = gameNameEN; + } + + private void btnSave_Click(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(txtAcctName.Text)) + { + MessageBox.Show("请输入账号备注", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + MiHoYoAccount acct = null; + if (gameNameEN == "Genshin") + { + acct = new GenshinAccount(); + + } + else if (gameNameEN == "GenshinCloud") + { + acct = new GenshinCloudAccount(); + } + else if (gameNameEN == "StarRail") + { + acct = new StarRailAccount(); + } + else + { + MessageBox.Show("未知的游戏账户类型", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + acct.ReadFromRegistry(); + acct.Name = txtAcctName.Text; + acct.WriteToDisk(); + this.Close(); + } + } +} diff --git a/MiHoYoStarter/FormInput.designer.cs b/MiHoYoStarter/FormInput.designer.cs new file mode 100644 index 0000000..4b9c509 --- /dev/null +++ b/MiHoYoStarter/FormInput.designer.cs @@ -0,0 +1,90 @@ + +namespace MiHoYoStarter +{ + partial class FormInput + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.txtAcctName = new System.Windows.Forms.TextBox(); + this.btnSave = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(35, 16); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(161, 12); + this.label1.TabIndex = 0; + this.label1.Text = "请输入当前登录账号的备注:"; + // + // txtAcctName + // + this.txtAcctName.Location = new System.Drawing.Point(8, 37); + this.txtAcctName.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtAcctName.Name = "txtAcctName"; + this.txtAcctName.Size = new System.Drawing.Size(227, 21); + this.txtAcctName.TabIndex = 1; + // + // btnSave + // + this.btnSave.Location = new System.Drawing.Point(50, 62); + this.btnSave.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(131, 21); + this.btnSave.TabIndex = 2; + this.btnSave.Text = "保存"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // FormInput + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(247, 92); + this.Controls.Add(this.btnSave); + this.Controls.Add(this.txtAcctName); + this.Controls.Add(this.label1); + this.Icon = global::MiHoYoStarter.Properties.Resources.hutao; + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Name = "FormInput"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "新增账号"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtAcctName; + private System.Windows.Forms.Button btnSave; + } +} \ No newline at end of file diff --git a/MiHoYoStarter/FormInput.resx b/MiHoYoStarter/FormInput.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/MiHoYoStarter/FormInput.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MiHoYoStarter/FormMain.Designer.cs b/MiHoYoStarter/FormMain.Designer.cs new file mode 100644 index 0000000..3e49436 --- /dev/null +++ b/MiHoYoStarter/FormMain.Designer.cs @@ -0,0 +1,842 @@ +namespace MiHoYoStarter +{ + partial class FormMain + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.tab1 = new System.Windows.Forms.TabControl(); + this.tabPageGenshin = new System.Windows.Forms.TabPage(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.picHelpSatrtParam = new System.Windows.Forms.PictureBox(); + this.label2 = new System.Windows.Forms.Label(); + this.txtGenshinStartParam = new System.Windows.Forms.TextBox(); + this.txtGenshinPath = new System.Windows.Forms.TextBox(); + this.lblPathTag = new System.Windows.Forms.Label(); + this.btnGenshinChoosePath = new System.Windows.Forms.Button(); + this.btnGenshinDelete = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.btnGenshinSwitch = new System.Windows.Forms.Button(); + this.btnGenshinAdd = new System.Windows.Forms.Button(); + this.lvwGenshinAcct = new System.Windows.Forms.ListView(); + this.name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.tabPageGenshinCloud = new System.Windows.Forms.TabPage(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.txtGenshinCloudPath = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.btnGenshinCloudChoosePath = new System.Windows.Forms.Button(); + this.btnGenshinCloudDelete = new System.Windows.Forms.Button(); + this.label11 = new System.Windows.Forms.Label(); + this.btnGenshinCloudSwitch = new System.Windows.Forms.Button(); + this.btnGenshinCloudAdd = new System.Windows.Forms.Button(); + this.lvwGenshinCloudAcct = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.tabPageSatrRail = new System.Windows.Forms.TabPage(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); + this.btnStarRailFPSEdit = new System.Windows.Forms.Button(); + this.numericUpDownFPS = new System.Windows.Forms.NumericUpDown(); + this.label6 = new System.Windows.Forms.Label(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label7 = new System.Windows.Forms.Label(); + this.txtStarRailStartParam = new System.Windows.Forms.TextBox(); + this.txtStarRailPath = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); + this.btnStarRailChoosePath = new System.Windows.Forms.Button(); + this.btnStarRailDelete = new System.Windows.Forms.Button(); + this.label10 = new System.Windows.Forms.Label(); + this.btnStarRailSwitch = new System.Windows.Forms.Button(); + this.btnStarRailAdd = new System.Windows.Forms.Button(); + this.lvwStarRailAcct = new System.Windows.Forms.ListView(); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.DisplayGenshinTabToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.DisplayGenshinCloudTabToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.DisplayStarRailTabToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.帮助ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.主页ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.请作者喝咖啡ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.显示主界面ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.tipHelp = new System.Windows.Forms.ToolTip(this.components); + this.tab1.SuspendLayout(); + this.tabPageGenshin.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picHelpSatrtParam)).BeginInit(); + this.tabPageGenshinCloud.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.tabPageSatrRail.SuspendLayout(); + this.groupBox3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFPS)).BeginInit(); + this.groupBox4.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.menuStrip1.SuspendLayout(); + this.contextMenuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // tab1 + // + this.tab1.Controls.Add(this.tabPageGenshin); + this.tab1.Controls.Add(this.tabPageGenshinCloud); + this.tab1.Controls.Add(this.tabPageSatrRail); + this.tab1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tab1.Location = new System.Drawing.Point(0, 25); + this.tab1.Name = "tab1"; + this.tab1.SelectedIndex = 0; + this.tab1.Size = new System.Drawing.Size(383, 459); + this.tab1.TabIndex = 0; + // + // tabPageGenshin + // + this.tabPageGenshin.BackColor = System.Drawing.Color.White; + this.tabPageGenshin.Controls.Add(this.groupBox1); + this.tabPageGenshin.Location = new System.Drawing.Point(4, 22); + this.tabPageGenshin.Name = "tabPageGenshin"; + this.tabPageGenshin.Padding = new System.Windows.Forms.Padding(3); + this.tabPageGenshin.Size = new System.Drawing.Size(375, 433); + this.tabPageGenshin.TabIndex = 0; + this.tabPageGenshin.Text = "原神"; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.picHelpSatrtParam); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.txtGenshinStartParam); + this.groupBox1.Controls.Add(this.txtGenshinPath); + this.groupBox1.Controls.Add(this.lblPathTag); + this.groupBox1.Controls.Add(this.btnGenshinChoosePath); + this.groupBox1.Controls.Add(this.btnGenshinDelete); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.btnGenshinSwitch); + this.groupBox1.Controls.Add(this.btnGenshinAdd); + this.groupBox1.Controls.Add(this.lvwGenshinAcct); + this.groupBox1.Location = new System.Drawing.Point(8, 6); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(357, 419); + this.groupBox1.TabIndex = 39; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "账号切换"; + // + // picHelpSatrtParam + // + this.picHelpSatrtParam.Image = global::MiHoYoStarter.Properties.Resources.attention; + this.picHelpSatrtParam.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.picHelpSatrtParam.Location = new System.Drawing.Point(76, 67); + this.picHelpSatrtParam.Name = "picHelpSatrtParam"; + this.picHelpSatrtParam.Size = new System.Drawing.Size(16, 16); + this.picHelpSatrtParam.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.picHelpSatrtParam.TabIndex = 38; + this.picHelpSatrtParam.TabStop = false; + this.tipHelp.SetToolTip(this.picHelpSatrtParam, "如果你不知道什么是启动参数请不要填写。\r\n常见启动参数:\r\n无边框 -popupwindow\r\n指定分辨率 -screen-width 1600 -screen-" + + "height 900\r\n"); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label2.Location = new System.Drawing.Point(15, 69); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(65, 12); + this.label2.TabIndex = 37; + this.label2.Text = "启动参数:"; + // + // txtGenshinStartParam + // + this.txtGenshinStartParam.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtGenshinStartParam.Location = new System.Drawing.Point(14, 84); + this.txtGenshinStartParam.Name = "txtGenshinStartParam"; + this.txtGenshinStartParam.Size = new System.Drawing.Size(337, 21); + this.txtGenshinStartParam.TabIndex = 36; + // + // txtGenshinPath + // + this.txtGenshinPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtGenshinPath.Location = new System.Drawing.Point(14, 42); + this.txtGenshinPath.Name = "txtGenshinPath"; + this.txtGenshinPath.Size = new System.Drawing.Size(297, 21); + this.txtGenshinPath.TabIndex = 33; + // + // lblPathTag + // + this.lblPathTag.AutoSize = true; + this.lblPathTag.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.lblPathTag.Location = new System.Drawing.Point(15, 27); + this.lblPathTag.Name = "lblPathTag"; + this.lblPathTag.Size = new System.Drawing.Size(113, 12); + this.lblPathTag.TabIndex = 32; + this.lblPathTag.Text = "【原神】启动路径:"; + // + // btnGenshinChoosePath + // + this.btnGenshinChoosePath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnGenshinChoosePath.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnGenshinChoosePath.Location = new System.Drawing.Point(317, 40); + this.btnGenshinChoosePath.Name = "btnGenshinChoosePath"; + this.btnGenshinChoosePath.Size = new System.Drawing.Size(34, 23); + this.btnGenshinChoosePath.TabIndex = 34; + this.btnGenshinChoosePath.Text = "..."; + this.btnGenshinChoosePath.UseVisualStyleBackColor = true; + // + // btnGenshinDelete + // + this.btnGenshinDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnGenshinDelete.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnGenshinDelete.Location = new System.Drawing.Point(261, 193); + this.btnGenshinDelete.Name = "btnGenshinDelete"; + this.btnGenshinDelete.Size = new System.Drawing.Size(90, 24); + this.btnGenshinDelete.TabIndex = 28; + this.btnGenshinDelete.Text = "删除选中账号"; + this.btnGenshinDelete.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label1.Location = new System.Drawing.Point(15, 121); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(89, 12); + this.label1.TabIndex = 27; + this.label1.Text = "保存账号列表:"; + // + // btnGenshinSwitch + // + this.btnGenshinSwitch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnGenshinSwitch.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnGenshinSwitch.Location = new System.Drawing.Point(261, 163); + this.btnGenshinSwitch.Name = "btnGenshinSwitch"; + this.btnGenshinSwitch.Size = new System.Drawing.Size(90, 24); + this.btnGenshinSwitch.TabIndex = 26; + this.btnGenshinSwitch.Text = "切换选中账号"; + this.btnGenshinSwitch.UseVisualStyleBackColor = true; + // + // btnGenshinAdd + // + this.btnGenshinAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnGenshinAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnGenshinAdd.Location = new System.Drawing.Point(261, 135); + this.btnGenshinAdd.Name = "btnGenshinAdd"; + this.btnGenshinAdd.Size = new System.Drawing.Size(90, 22); + this.btnGenshinAdd.TabIndex = 25; + this.btnGenshinAdd.Text = "保存当前账号"; + this.btnGenshinAdd.UseVisualStyleBackColor = true; + // + // lvwGenshinAcct + // + this.lvwGenshinAcct.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lvwGenshinAcct.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.name}); + this.lvwGenshinAcct.GridLines = true; + this.lvwGenshinAcct.HideSelection = false; + this.lvwGenshinAcct.Location = new System.Drawing.Point(14, 135); + this.lvwGenshinAcct.Margin = new System.Windows.Forms.Padding(2); + this.lvwGenshinAcct.MultiSelect = false; + this.lvwGenshinAcct.Name = "lvwGenshinAcct"; + this.lvwGenshinAcct.Size = new System.Drawing.Size(242, 271); + this.lvwGenshinAcct.TabIndex = 24; + this.lvwGenshinAcct.UseCompatibleStateImageBehavior = false; + this.lvwGenshinAcct.View = System.Windows.Forms.View.List; + // + // name + // + this.name.Text = "名称"; + this.name.Width = 273; + // + // tabPageGenshinCloud + // + this.tabPageGenshinCloud.BackColor = System.Drawing.Color.White; + this.tabPageGenshinCloud.Controls.Add(this.groupBox6); + this.tabPageGenshinCloud.Location = new System.Drawing.Point(4, 22); + this.tabPageGenshinCloud.Name = "tabPageGenshinCloud"; + this.tabPageGenshinCloud.Padding = new System.Windows.Forms.Padding(3); + this.tabPageGenshinCloud.Size = new System.Drawing.Size(375, 433); + this.tabPageGenshinCloud.TabIndex = 1; + this.tabPageGenshinCloud.Text = "云·原神"; + // + // groupBox6 + // + this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox6.Controls.Add(this.txtGenshinCloudPath); + this.groupBox6.Controls.Add(this.label5); + this.groupBox6.Controls.Add(this.btnGenshinCloudChoosePath); + this.groupBox6.Controls.Add(this.btnGenshinCloudDelete); + this.groupBox6.Controls.Add(this.label11); + this.groupBox6.Controls.Add(this.btnGenshinCloudSwitch); + this.groupBox6.Controls.Add(this.btnGenshinCloudAdd); + this.groupBox6.Controls.Add(this.lvwGenshinCloudAcct); + this.groupBox6.Location = new System.Drawing.Point(8, 6); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(357, 419); + this.groupBox6.TabIndex = 43; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "账号切换"; + // + // txtGenshinCloudPath + // + this.txtGenshinCloudPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtGenshinCloudPath.Location = new System.Drawing.Point(14, 42); + this.txtGenshinCloudPath.Name = "txtGenshinCloudPath"; + this.txtGenshinCloudPath.Size = new System.Drawing.Size(297, 21); + this.txtGenshinCloudPath.TabIndex = 33; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label5.Location = new System.Drawing.Point(15, 27); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(137, 12); + this.label5.TabIndex = 32; + this.label5.Text = "【云·原神】启动路径:"; + // + // btnGenshinCloudChoosePath + // + this.btnGenshinCloudChoosePath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnGenshinCloudChoosePath.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnGenshinCloudChoosePath.Location = new System.Drawing.Point(317, 40); + this.btnGenshinCloudChoosePath.Name = "btnGenshinCloudChoosePath"; + this.btnGenshinCloudChoosePath.Size = new System.Drawing.Size(34, 23); + this.btnGenshinCloudChoosePath.TabIndex = 34; + this.btnGenshinCloudChoosePath.Text = "..."; + this.btnGenshinCloudChoosePath.UseVisualStyleBackColor = true; + // + // btnGenshinCloudDelete + // + this.btnGenshinCloudDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnGenshinCloudDelete.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnGenshinCloudDelete.Location = new System.Drawing.Point(261, 193); + this.btnGenshinCloudDelete.Name = "btnGenshinCloudDelete"; + this.btnGenshinCloudDelete.Size = new System.Drawing.Size(90, 24); + this.btnGenshinCloudDelete.TabIndex = 28; + this.btnGenshinCloudDelete.Text = "删除选中账号"; + this.btnGenshinCloudDelete.UseVisualStyleBackColor = true; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label11.Location = new System.Drawing.Point(15, 66); + this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(89, 12); + this.label11.TabIndex = 27; + this.label11.Text = "保存账号列表:"; + // + // btnGenshinCloudSwitch + // + this.btnGenshinCloudSwitch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnGenshinCloudSwitch.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnGenshinCloudSwitch.Location = new System.Drawing.Point(261, 163); + this.btnGenshinCloudSwitch.Name = "btnGenshinCloudSwitch"; + this.btnGenshinCloudSwitch.Size = new System.Drawing.Size(90, 24); + this.btnGenshinCloudSwitch.TabIndex = 26; + this.btnGenshinCloudSwitch.Text = "切换选中账号"; + this.btnGenshinCloudSwitch.UseVisualStyleBackColor = true; + // + // btnGenshinCloudAdd + // + this.btnGenshinCloudAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnGenshinCloudAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnGenshinCloudAdd.Location = new System.Drawing.Point(261, 135); + this.btnGenshinCloudAdd.Name = "btnGenshinCloudAdd"; + this.btnGenshinCloudAdd.Size = new System.Drawing.Size(90, 22); + this.btnGenshinCloudAdd.TabIndex = 25; + this.btnGenshinCloudAdd.Text = "保存当前账号"; + this.btnGenshinCloudAdd.UseVisualStyleBackColor = true; + // + // lvwGenshinCloudAcct + // + this.lvwGenshinCloudAcct.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lvwGenshinCloudAcct.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1}); + this.lvwGenshinCloudAcct.GridLines = true; + this.lvwGenshinCloudAcct.HideSelection = false; + this.lvwGenshinCloudAcct.Location = new System.Drawing.Point(14, 80); + this.lvwGenshinCloudAcct.Margin = new System.Windows.Forms.Padding(2); + this.lvwGenshinCloudAcct.MultiSelect = false; + this.lvwGenshinCloudAcct.Name = "lvwGenshinCloudAcct"; + this.lvwGenshinCloudAcct.Size = new System.Drawing.Size(242, 319); + this.lvwGenshinCloudAcct.TabIndex = 24; + this.lvwGenshinCloudAcct.UseCompatibleStateImageBehavior = false; + this.lvwGenshinCloudAcct.View = System.Windows.Forms.View.List; + // + // columnHeader1 + // + this.columnHeader1.Text = "名称"; + this.columnHeader1.Width = 273; + // + // tabPageSatrRail + // + this.tabPageSatrRail.BackColor = System.Drawing.Color.White; + this.tabPageSatrRail.Controls.Add(this.groupBox3); + this.tabPageSatrRail.Controls.Add(this.groupBox4); + this.tabPageSatrRail.Location = new System.Drawing.Point(4, 22); + this.tabPageSatrRail.Name = "tabPageSatrRail"; + this.tabPageSatrRail.Padding = new System.Windows.Forms.Padding(3); + this.tabPageSatrRail.Size = new System.Drawing.Size(375, 433); + this.tabPageSatrRail.TabIndex = 2; + this.tabPageSatrRail.Text = "崩坏:星穹铁道"; + // + // groupBox3 + // + this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox3.Controls.Add(this.pictureBox2); + this.groupBox3.Controls.Add(this.btnStarRailFPSEdit); + this.groupBox3.Controls.Add(this.numericUpDownFPS); + this.groupBox3.Controls.Add(this.label6); + this.groupBox3.Location = new System.Drawing.Point(8, 334); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(356, 84); + this.groupBox3.TabIndex = 42; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "游戏设置"; + // + // pictureBox2 + // + this.pictureBox2.Image = global::MiHoYoStarter.Properties.Resources.attention; + this.pictureBox2.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.pictureBox2.Location = new System.Drawing.Point(194, 31); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.Size = new System.Drawing.Size(16, 16); + this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pictureBox2.TabIndex = 39; + this.pictureBox2.TabStop = false; + this.tipHelp.SetToolTip(this.pictureBox2, "此帧数修改是通过修改注册表实现的,可以放心使用。\r\n可以突破60帧设置,但是具体能跑到多少要看你电脑性能了。\r\nWin+G可以查看游戏当前帧数\r\n注意:打开游戏设" + + "置并修改后会还原帧数设置,需要重新应用下。"); + // + // btnStarRailFPSEdit + // + this.btnStarRailFPSEdit.Location = new System.Drawing.Point(261, 26); + this.btnStarRailFPSEdit.Name = "btnStarRailFPSEdit"; + this.btnStarRailFPSEdit.Size = new System.Drawing.Size(75, 23); + this.btnStarRailFPSEdit.TabIndex = 3; + this.btnStarRailFPSEdit.Text = "应用"; + this.btnStarRailFPSEdit.UseVisualStyleBackColor = true; + this.btnStarRailFPSEdit.Click += new System.EventHandler(this.btnStarRailFPSEdit_Click); + // + // numericUpDownFPS + // + this.numericUpDownFPS.Location = new System.Drawing.Point(128, 29); + this.numericUpDownFPS.Maximum = new decimal(new int[] { + 200, + 0, + 0, + 0}); + this.numericUpDownFPS.Minimum = new decimal(new int[] { + 24, + 0, + 0, + 0}); + this.numericUpDownFPS.Name = "numericUpDownFPS"; + this.numericUpDownFPS.Size = new System.Drawing.Size(60, 21); + this.numericUpDownFPS.TabIndex = 2; + this.numericUpDownFPS.Value = new decimal(new int[] { + 120, + 0, + 0, + 0}); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(15, 31); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(107, 12); + this.label6.TabIndex = 1; + this.label6.Text = "游戏帧数(FPS):"; + // + // groupBox4 + // + this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox4.Controls.Add(this.pictureBox1); + this.groupBox4.Controls.Add(this.label7); + this.groupBox4.Controls.Add(this.txtStarRailStartParam); + this.groupBox4.Controls.Add(this.txtStarRailPath); + this.groupBox4.Controls.Add(this.label8); + this.groupBox4.Controls.Add(this.btnStarRailChoosePath); + this.groupBox4.Controls.Add(this.btnStarRailDelete); + this.groupBox4.Controls.Add(this.label10); + this.groupBox4.Controls.Add(this.btnStarRailSwitch); + this.groupBox4.Controls.Add(this.btnStarRailAdd); + this.groupBox4.Controls.Add(this.lvwStarRailAcct); + this.groupBox4.Location = new System.Drawing.Point(8, 6); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(357, 322); + this.groupBox4.TabIndex = 41; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "账号切换"; + // + // pictureBox1 + // + this.pictureBox1.Image = global::MiHoYoStarter.Properties.Resources.attention; + this.pictureBox1.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.pictureBox1.Location = new System.Drawing.Point(76, 67); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(16, 16); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pictureBox1.TabIndex = 38; + this.pictureBox1.TabStop = false; + this.tipHelp.SetToolTip(this.pictureBox1, "如果你不知道什么是启动参数请不要填写。\r\n常见启动参数:\r\n无边框 -popupwindow\r\n指定分辨率 -screen-width 1600 -screen-" + + "height 900\r\n"); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label7.Location = new System.Drawing.Point(15, 69); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(65, 12); + this.label7.TabIndex = 37; + this.label7.Text = "启动参数:"; + // + // txtStarRailStartParam + // + this.txtStarRailStartParam.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtStarRailStartParam.Location = new System.Drawing.Point(14, 84); + this.txtStarRailStartParam.Name = "txtStarRailStartParam"; + this.txtStarRailStartParam.Size = new System.Drawing.Size(337, 21); + this.txtStarRailStartParam.TabIndex = 36; + // + // txtStarRailPath + // + this.txtStarRailPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtStarRailPath.Location = new System.Drawing.Point(14, 42); + this.txtStarRailPath.Name = "txtStarRailPath"; + this.txtStarRailPath.Size = new System.Drawing.Size(297, 21); + this.txtStarRailPath.TabIndex = 33; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label8.Location = new System.Drawing.Point(15, 27); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(173, 12); + this.label8.TabIndex = 32; + this.label8.Text = "【崩坏:星穹铁道】启动路径:"; + // + // btnStarRailChoosePath + // + this.btnStarRailChoosePath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStarRailChoosePath.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnStarRailChoosePath.Location = new System.Drawing.Point(317, 40); + this.btnStarRailChoosePath.Name = "btnStarRailChoosePath"; + this.btnStarRailChoosePath.Size = new System.Drawing.Size(34, 23); + this.btnStarRailChoosePath.TabIndex = 34; + this.btnStarRailChoosePath.Text = "..."; + this.btnStarRailChoosePath.UseVisualStyleBackColor = true; + // + // btnStarRailDelete + // + this.btnStarRailDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStarRailDelete.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnStarRailDelete.Location = new System.Drawing.Point(261, 193); + this.btnStarRailDelete.Name = "btnStarRailDelete"; + this.btnStarRailDelete.Size = new System.Drawing.Size(90, 24); + this.btnStarRailDelete.TabIndex = 28; + this.btnStarRailDelete.Text = "删除选中账号"; + this.btnStarRailDelete.UseVisualStyleBackColor = true; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label10.Location = new System.Drawing.Point(15, 121); + this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(89, 12); + this.label10.TabIndex = 27; + this.label10.Text = "保存账号列表:"; + // + // btnStarRailSwitch + // + this.btnStarRailSwitch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStarRailSwitch.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnStarRailSwitch.Location = new System.Drawing.Point(261, 163); + this.btnStarRailSwitch.Name = "btnStarRailSwitch"; + this.btnStarRailSwitch.Size = new System.Drawing.Size(90, 24); + this.btnStarRailSwitch.TabIndex = 26; + this.btnStarRailSwitch.Text = "切换选中账号"; + this.btnStarRailSwitch.UseVisualStyleBackColor = true; + // + // btnStarRailAdd + // + this.btnStarRailAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStarRailAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.btnStarRailAdd.Location = new System.Drawing.Point(261, 135); + this.btnStarRailAdd.Name = "btnStarRailAdd"; + this.btnStarRailAdd.Size = new System.Drawing.Size(90, 22); + this.btnStarRailAdd.TabIndex = 25; + this.btnStarRailAdd.Text = "保存当前账号"; + this.btnStarRailAdd.UseVisualStyleBackColor = true; + // + // lvwStarRailAcct + // + this.lvwStarRailAcct.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lvwStarRailAcct.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader2}); + this.lvwStarRailAcct.GridLines = true; + this.lvwStarRailAcct.HideSelection = false; + this.lvwStarRailAcct.Location = new System.Drawing.Point(14, 135); + this.lvwStarRailAcct.Margin = new System.Windows.Forms.Padding(2); + this.lvwStarRailAcct.MultiSelect = false; + this.lvwStarRailAcct.Name = "lvwStarRailAcct"; + this.lvwStarRailAcct.Size = new System.Drawing.Size(242, 174); + this.lvwStarRailAcct.TabIndex = 24; + this.lvwStarRailAcct.UseCompatibleStateImageBehavior = false; + this.lvwStarRailAcct.View = System.Windows.Forms.View.List; + // + // columnHeader2 + // + this.columnHeader2.Text = "名称"; + this.columnHeader2.Width = 273; + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.设置ToolStripMenuItem, + this.帮助ToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(383, 25); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // 设置ToolStripMenuItem + // + this.设置ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.DisplayGenshinTabToolStripMenuItem, + this.DisplayGenshinCloudTabToolStripMenuItem, + this.DisplayStarRailTabToolStripMenuItem}); + this.设置ToolStripMenuItem.Name = "设置ToolStripMenuItem"; + this.设置ToolStripMenuItem.Size = new System.Drawing.Size(68, 21); + this.设置ToolStripMenuItem.Text = "界面显示"; + // + // DisplayGenshinTabToolStripMenuItem + // + this.DisplayGenshinTabToolStripMenuItem.Checked = true; + this.DisplayGenshinTabToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.DisplayGenshinTabToolStripMenuItem.Name = "DisplayGenshinTabToolStripMenuItem"; + this.DisplayGenshinTabToolStripMenuItem.Size = new System.Drawing.Size(160, 22); + this.DisplayGenshinTabToolStripMenuItem.Text = "原神"; + this.DisplayGenshinTabToolStripMenuItem.Click += new System.EventHandler(this.DisplayGenshinTabToolStripMenuItem_Click); + // + // DisplayGenshinCloudTabToolStripMenuItem + // + this.DisplayGenshinCloudTabToolStripMenuItem.Checked = true; + this.DisplayGenshinCloudTabToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.DisplayGenshinCloudTabToolStripMenuItem.Name = "DisplayGenshinCloudTabToolStripMenuItem"; + this.DisplayGenshinCloudTabToolStripMenuItem.Size = new System.Drawing.Size(160, 22); + this.DisplayGenshinCloudTabToolStripMenuItem.Text = "云·原神"; + this.DisplayGenshinCloudTabToolStripMenuItem.Click += new System.EventHandler(this.DisplayGenshinCloudTabToolStripMenuItem_Click); + // + // DisplayStarRailTabToolStripMenuItem + // + this.DisplayStarRailTabToolStripMenuItem.Checked = true; + this.DisplayStarRailTabToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.DisplayStarRailTabToolStripMenuItem.Name = "DisplayStarRailTabToolStripMenuItem"; + this.DisplayStarRailTabToolStripMenuItem.Size = new System.Drawing.Size(160, 22); + this.DisplayStarRailTabToolStripMenuItem.Text = "崩坏:星穹铁道"; + this.DisplayStarRailTabToolStripMenuItem.Click += new System.EventHandler(this.DisplayStarRailTabToolStripMenuItem_Click); + // + // 帮助ToolStripMenuItem + // + this.帮助ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.主页ToolStripMenuItem, + this.请作者喝咖啡ToolStripMenuItem}); + this.帮助ToolStripMenuItem.Name = "帮助ToolStripMenuItem"; + this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(44, 21); + this.帮助ToolStripMenuItem.Text = "帮助"; + // + // 主页ToolStripMenuItem + // + this.主页ToolStripMenuItem.Name = "主页ToolStripMenuItem"; + this.主页ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.主页ToolStripMenuItem.Text = "主页"; + this.主页ToolStripMenuItem.Click += new System.EventHandler(this.主页ToolStripMenuItem_Click); + // + // 请作者喝咖啡ToolStripMenuItem + // + this.请作者喝咖啡ToolStripMenuItem.Name = "请作者喝咖啡ToolStripMenuItem"; + this.请作者喝咖啡ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.请作者喝咖啡ToolStripMenuItem.Text = "请作者喝咖啡"; + this.请作者喝咖啡ToolStripMenuItem.Click += new System.EventHandler(this.请作者喝咖啡ToolStripMenuItem_Click); + // + // notifyIcon + // + this.notifyIcon.ContextMenuStrip = this.contextMenuStrip1; + this.notifyIcon.Icon = global::MiHoYoStarter.Properties.Resources.hutao; + this.notifyIcon.Text = "米哈游账户切换启动工具"; + this.notifyIcon.Visible = true; + this.notifyIcon.DoubleClick += new System.EventHandler(this.notifyIcon_DoubleClick); + // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.显示主界面ToolStripMenuItem, + this.退出ToolStripMenuItem}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(137, 48); + // + // 显示主界面ToolStripMenuItem + // + this.显示主界面ToolStripMenuItem.Name = "显示主界面ToolStripMenuItem"; + this.显示主界面ToolStripMenuItem.Size = new System.Drawing.Size(136, 22); + this.显示主界面ToolStripMenuItem.Text = "显示主界面"; + this.显示主界面ToolStripMenuItem.Click += new System.EventHandler(this.显示主界面ToolStripMenuItem_Click); + // + // 退出ToolStripMenuItem + // + this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; + this.退出ToolStripMenuItem.Size = new System.Drawing.Size(136, 22); + this.退出ToolStripMenuItem.Text = "退出"; + this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click); + // + // FormMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(383, 484); + this.Controls.Add(this.tab1); + this.Controls.Add(this.menuStrip1); + this.Icon = global::MiHoYoStarter.Properties.Resources.hutao; + this.MainMenuStrip = this.menuStrip1; + this.Name = "FormMain"; + this.Text = "MHY启动器"; + this.Load += new System.EventHandler(this.FormMain_Load); + this.SizeChanged += new System.EventHandler(this.FormMain_SizeChanged); + this.tab1.ResumeLayout(false); + this.tabPageGenshin.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picHelpSatrtParam)).EndInit(); + this.tabPageGenshinCloud.ResumeLayout(false); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + this.tabPageSatrRail.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFPS)).EndInit(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.contextMenuStrip1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TabControl tab1; + private System.Windows.Forms.TabPage tabPageGenshin; + private System.Windows.Forms.PictureBox picHelpSatrtParam; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtGenshinStartParam; + private System.Windows.Forms.TextBox txtGenshinPath; + private System.Windows.Forms.Label lblPathTag; + private System.Windows.Forms.Button btnGenshinChoosePath; + private System.Windows.Forms.Button btnGenshinDelete; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnGenshinSwitch; + private System.Windows.Forms.Button btnGenshinAdd; + private System.Windows.Forms.ListView lvwGenshinAcct; + private System.Windows.Forms.ColumnHeader name; + private System.Windows.Forms.TabPage tabPageGenshinCloud; + private System.Windows.Forms.TabPage tabPageSatrRail; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem 设置ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem DisplayGenshinTabToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem DisplayGenshinCloudTabToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem DisplayStarRailTabToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 帮助ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 主页ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 请作者喝咖啡ToolStripMenuItem; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox txtStarRailStartParam; + private System.Windows.Forms.TextBox txtStarRailPath; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Button btnStarRailChoosePath; + private System.Windows.Forms.Button btnStarRailDelete; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Button btnStarRailSwitch; + private System.Windows.Forms.Button btnStarRailAdd; + private System.Windows.Forms.ListView lvwStarRailAcct; + private System.Windows.Forms.ColumnHeader columnHeader2; + private System.Windows.Forms.NotifyIcon notifyIcon; + private System.Windows.Forms.ToolTip tipHelp; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.TextBox txtGenshinCloudPath; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Button btnGenshinCloudChoosePath; + private System.Windows.Forms.Button btnGenshinCloudDelete; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Button btnGenshinCloudSwitch; + private System.Windows.Forms.Button btnGenshinCloudAdd; + private System.Windows.Forms.ListView lvwGenshinCloudAcct; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.Button btnStarRailFPSEdit; + private System.Windows.Forms.NumericUpDown numericUpDownFPS; + private System.Windows.Forms.PictureBox pictureBox2; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.ToolStripMenuItem 显示主界面ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem; + } +} + diff --git a/MiHoYoStarter/FormMain.cs b/MiHoYoStarter/FormMain.cs new file mode 100644 index 0000000..a81f2de --- /dev/null +++ b/MiHoYoStarter/FormMain.cs @@ -0,0 +1,190 @@ +using Microsoft.Win32; +using MiHoYoStarter.Utils; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Web.Script.Serialization; +using System.Windows.Forms; + +namespace MiHoYoStarter +{ + public partial class FormMain : Form + { + + private GameFormControl genshinFormControl = new GameFormControl("原神", "原神", "Genshin", "YuanShen"); + private GameFormControl genshinCloudFormControl = new GameFormControl("云·原神", "云原神", "GenshinCloud", "Genshin Impact Cloud Game"); + private GameFormControl starRailFormControl = new GameFormControl("崩坏:星穹铁道", "崩铁", "StarRail", "StarRail"); + + public FormMain() + { + InitializeComponent(); + } + + private void FormMain_Load(object sender, EventArgs e) + { + // 标题加上版本号 + var version = HuiUtils.GetMyVersion(); + this.Text += version; + // GAHelper.Instance.RequestPageView($"/acct2/main/{version}", $"进入{version}版本MHY账户切换工具主界面"); + + // 初始化界面控制 + genshinFormControl.InitControl(this, tabPageGenshin, Properties.Settings.Default.GenshinPath); + genshinCloudFormControl.InitControl(this, tabPageGenshinCloud, Properties.Settings.Default.GenshinCloudPath); + starRailFormControl.InitControl(this, tabPageSatrRail, Properties.Settings.Default.StarRailPath); + } + + public void RefreshNotifyIconContextMenu() + { + this.contextMenuStrip1.Items.Clear(); + if (DisplayGenshinTabToolStripMenuItem.Checked) + { + this.contextMenuStrip1.Items.AddRange(genshinFormControl.AcctMenuItemList.ToArray()); + this.contextMenuStrip1.Items.Add(new ToolStripSeparator()); + } + + if (DisplayGenshinCloudTabToolStripMenuItem.Checked) + { + this.contextMenuStrip1.Items.AddRange(genshinCloudFormControl.AcctMenuItemList.ToArray()); + this.contextMenuStrip1.Items.Add(new ToolStripSeparator()); + } + if (DisplayStarRailTabToolStripMenuItem.Checked) + { + this.contextMenuStrip1.Items.AddRange(starRailFormControl.AcctMenuItemList.ToArray()); + this.contextMenuStrip1.Items.Add(new ToolStripSeparator()); ; + } + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.显示主界面ToolStripMenuItem, + this.退出ToolStripMenuItem}); + } + + private void FormMain_SizeChanged(object sender, EventArgs e) + { + if (WindowState == FormWindowState.Minimized && notifyIcon.Visible) + { + this.ShowInTaskbar = false; + } + } + + private void notifyIcon_DoubleClick(object sender, EventArgs e) + { + if (WindowState == FormWindowState.Minimized) + { + WindowState = FormWindowState.Normal; + this.ShowInTaskbar = true; + } + this.Activate(); + } + + private void btnStarRailFPSEdit_Click(object sender, EventArgs e) + { + var value = Registry.GetValue(@"HKEY_CURRENT_USER\Software\miHoYo\崩坏:星穹铁道", "GraphicsSettings_Model_h2986158309", null); + if (value != null) + { + var json = Encoding.UTF8.GetString((byte[])value); + // 一般长这样:{"FPS":60,"EnableVSync":true,"RenderScale":1.4,"ResolutionQuality":5,"ShadowQuality":5,"LightQuality":5,"CharacterQuality":5,"EnvDetailQuality":5,"ReflectionQuality":5,"BloomQuality":5,"AAMode":1} + // JavaScriptSerializer 没法反序列化成通用对象,我也很绝望呀 + Regex r = new Regex("\"FPS\":\\d*,"); + if (r.IsMatch(json)) + { + string newJson = r.Replace(json, $"\"FPS\":{numericUpDownFPS.Value},"); + Registry.SetValue(@"HKEY_CURRENT_USER\Software\miHoYo\崩坏:星穹铁道", "GraphicsSettings_Model_h2986158309", Encoding.UTF8.GetBytes(newJson)); + MessageBox.Show("应用成功!", "提示"); + } + else + { + MessageBox.Show("没有找到FPS相关配置,大概率是程序有问题啦,联系作者解决~", "提示"); + } + + } + } + + private void DisplayGenshinTabToolStripMenuItem_Click(object sender, EventArgs e) + { + DisplayGenshinTabToolStripMenuItem.Checked = !DisplayGenshinTabToolStripMenuItem.Checked; + if (DisplayGenshinTabToolStripMenuItem.Checked) + { + if (!tab1.TabPages.Contains(tabPageGenshin)) + { + tab1.TabPages.Add(tabPageGenshin); + } + } + else + { + if (tab1.TabPages.Contains(tabPageGenshin)) + { + tab1.TabPages.Remove(tabPageGenshin); + } + } + RefreshNotifyIconContextMenu(); + } + + private void DisplayGenshinCloudTabToolStripMenuItem_Click(object sender, EventArgs e) + { + DisplayGenshinCloudTabToolStripMenuItem.Checked = !DisplayGenshinCloudTabToolStripMenuItem.Checked; + if (DisplayGenshinCloudTabToolStripMenuItem.Checked) + { + if (!tab1.TabPages.Contains(tabPageGenshinCloud)) + { + tab1.TabPages.Add(tabPageGenshinCloud); + } + } + else + { + if (tab1.TabPages.Contains(tabPageGenshinCloud)) + { + tab1.TabPages.Remove(tabPageGenshinCloud); + } + } + RefreshNotifyIconContextMenu(); + } + + private void DisplayStarRailTabToolStripMenuItem_Click(object sender, EventArgs e) + { + DisplayStarRailTabToolStripMenuItem.Checked = !DisplayStarRailTabToolStripMenuItem.Checked; + if (DisplayStarRailTabToolStripMenuItem.Checked) + { + if (!tab1.TabPages.Contains(tabPageSatrRail)) + { + tab1.TabPages.Add(tabPageSatrRail); + } + } + else + { + if (tab1.TabPages.Contains(tabPageSatrRail)) + { + tab1.TabPages.Remove(tabPageSatrRail); + } + } + RefreshNotifyIconContextMenu(); + } + + private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.Dispose(); + this.Close(); + } + + private void 显示主界面ToolStripMenuItem_Click(object sender, EventArgs e) + { + notifyIcon_DoubleClick(sender, e); + } + + private void 主页ToolStripMenuItem_Click(object sender, EventArgs e) + { + Process.Start("https://github.com/babalae/genshin-account"); + } + + private void 请作者喝咖啡ToolStripMenuItem_Click(object sender, EventArgs e) + { + Process.Start("https://github.com/huiyadanli/huiyadanli/blob/master/DONATE.md"); + } + } +} diff --git a/MiHoYoStarter/FormMain.resx b/MiHoYoStarter/FormMain.resx new file mode 100644 index 0000000..e1d9e17 --- /dev/null +++ b/MiHoYoStarter/FormMain.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 271, 22 + + + 271, 22 + + + 17, 17 + + + 137, 17 + + + 366, 22 + + \ No newline at end of file diff --git a/MiHoYoStarter/GameFormControl.cs b/MiHoYoStarter/GameFormControl.cs new file mode 100644 index 0000000..b324dde --- /dev/null +++ b/MiHoYoStarter/GameFormControl.cs @@ -0,0 +1,283 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Security.Principal; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace MiHoYoStarter +{ + public class GameFormControl + { + private string userDataPath; + public string GameNameCN { get; set; } + /// + /// 游戏简称 + /// + public string GameNameShortCN { get; set; } + public string GameNameEN { get; set; } + + public string ProcessName { get; set; } + + private FormMain formMain; + + private TextBox txtPath; + private TextBox txtStartParam; + private ListView lvwAcct; + private Button btnChoosePath; + private Button btnAdd; + private Button btnSwitch; + private Button btnDelete; + + public List AcctMenuItemList { get; set; } + + public GameFormControl(string nameCN, string nameShortCN, string nameEN, string processName) + { + GameNameCN = nameCN; + GameNameShortCN = nameShortCN; + GameNameEN = nameEN; + ProcessName = processName; + AcctMenuItemList = new List(); + } + + public void InitControl(FormMain formMain, TabPage tabPage, string pathSetting) + { + this.formMain = formMain; + // 用户数据路径 + userDataPath = Path.Combine(Application.StartupPath, "UserData", GameNameEN); + if (!Directory.Exists(userDataPath)) + { + Directory.CreateDirectory(userDataPath); + } + + // 初始化控件 + FindControl(tabPage, $"txt{GameNameEN}Path", ref txtPath); + FindControl(tabPage, $"txt{GameNameEN}StartParam", ref txtStartParam); + FindControl(tabPage, $"lvw{GameNameEN}Acct", ref lvwAcct); + FindControl(tabPage, $"btn{GameNameEN}ChoosePath", ref btnChoosePath); + FindControl(tabPage, $"btn{GameNameEN}Add", ref btnAdd); + FindControl(tabPage, $"btn{GameNameEN}Switch", ref btnSwitch); + FindControl(tabPage, $"btn{GameNameEN}Delete", ref btnDelete); + + // 默认路径 + if (string.IsNullOrEmpty(pathSetting)) + { + string installPath = FindInstallPathFromRegistry(GameNameCN); + string path = null; + if (GameNameEN == "Genshin") + { + path = Path.Combine(installPath, "Genshin Impact Game", "YuanShen.exe"); // 只支持国服 + } + else if (GameNameEN == "GenshinCloud") + { + path = Path.Combine(installPath, "Genshin Impact Cloud Game.exe"); + } + else if (GameNameEN == "StarRail") + { + path = Path.Combine(installPath, "Game", "StarRail.exe"); + } + + if (path != null && File.Exists(path)) + { + txtPath.Text = path; + } + } + + // 绑定事件 + btnChoosePath.Click += btnChoosePathClick; + btnAdd.Click += btnAddClick; + btnSwitch.Click += btnSwitchClick; + btnDelete.Click += btnDeleteClick; + + RefreshList(); + } + + private void FindControl(TabPage tabPage, string name, ref T result) where T : Control + { + var controls = tabPage.Controls.Find(name, true); + if (controls.Length > 0) + { + result = (T)controls[0]; + } + } + + private void btnChoosePathClick(object sender, EventArgs e) + { + FolderBrowserDialog dialog = new FolderBrowserDialog(); + dialog.Description = $@"请选择【{GameNameCN}】的游戏本体启动路径(注意不是启动器路径!!!) +以下是游戏本体目录: +原神(国服):\Genshin Impact\Genshin Impact Game\YuanShen.exe +云·原神:\Genshin Impact Cloud Game\Genshin Impact Cloud Game.exe +崩坏:星穹铁道:\Star Rail\Game\StarRail.exe"; + if (dialog.ShowDialog() == DialogResult.OK) + { + txtPath.Text = dialog.SelectedPath; + } + } + + private void btnAddClick(object sender, EventArgs e) + { + FormInput form = new FormInput(GameNameEN); + form.ShowDialog(); + RefreshList(); + } + + private void btnSwitchClick(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(txtPath.Text)) + { + MessageBox.Show($"请先选择【{GameNameCN}】安装路径,才能进行账户切换", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + if (lvwAcct.SelectedItems.Count == 0) + { + MessageBox.Show("请选择要切换的账号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + string name = lvwAcct.SelectedItems[0]?.Text; + Switch(name); + } + + private void btnDeleteClick(object sender, EventArgs e) + { + if (lvwAcct.SelectedItems.Count == 0) + { + MessageBox.Show("请选择要切换的账号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + string name = lvwAcct.SelectedItems[0]?.Text; + if (string.IsNullOrEmpty(name)) + { + MessageBox.Show("请选择要切换的账号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + MiHoYoAccount.DeleteFromDisk(userDataPath, name); + RefreshList(); + } + + private void RefreshList() + { + lvwAcct.Items.Clear(); + AcctMenuItemList.Clear(); + DirectoryInfo root = new DirectoryInfo(userDataPath); + FileInfo[] files = root.GetFiles(); + foreach (FileInfo file in files) + { + lvwAcct.Items.Add(new ListViewItem() + { + Text = file.Name + }); + var m = new ToolStripMenuItem() + { + Name = file.Name, + Text = $"【{GameNameShortCN}】-【{file.Name}】", + Tag = GameNameEN, // 用tag来标识 + }; + m.Click += ToolStripMenuClick; + AcctMenuItemList.Add(m); + } + + if (lvwAcct.Items.Count > 0) + { + btnDelete.Enabled = true; + btnSwitch.Enabled = true; + } + else + { + btnDelete.Enabled = false; + btnSwitch.Enabled = false; + } + formMain.RefreshNotifyIconContextMenu(); // 调用主界面刷新菜单 + } + + private void ToolStripMenuClick(object sender, EventArgs e) + { + if (sender is ToolStripMenuItem toolStripMenuItem) + { + Switch(toolStripMenuItem.Name); + foreach (var menuItem in AcctMenuItemList) + { + menuItem.Checked = false; + } + toolStripMenuItem.Checked = true; + } + } + + private void Switch(string name) + { + if (string.IsNullOrEmpty(name)) + { + MessageBox.Show("请选择要切换的账号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + + var pros = Process.GetProcessesByName(ProcessName); + if (pros.Any()) + { + pros[0].Kill(); + Thread.Sleep(200); + } + MiHoYoAccount acct = MiHoYoAccount.CreateFromDisk(userDataPath, name); + if (string.IsNullOrWhiteSpace(acct.AccountRegDataValue)) + { + MessageBox.Show("账户内容为空", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + acct.WriteToRegistry(); + try + { + ProcessStartInfo startInfo = new ProcessStartInfo(); + startInfo.UseShellExecute = true; + startInfo.WorkingDirectory = Environment.CurrentDirectory; + startInfo.FileName = txtPath.Text; + startInfo.Verb = "runas"; + if (txtStartParam != null && !string.IsNullOrEmpty(txtStartParam.Text)) + { + startInfo.Arguments = txtStartParam.Text; + } + Process.Start(startInfo); + } + catch (Exception ex) + { + MessageBox.Show("游戏启动失败!\n" + ex.Message + "\n" + ex.StackTrace, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + /// + /// 从注册表中寻找安装路径 + /// + /// + /// 安装信息的注册表键名 "原神", "云·原神", "崩坏:星穹铁道" + /// + /// 安装路径 + public static string FindInstallPathFromRegistry(string uninstallKeyName) + { + try + { + using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) + using (var key = hklm.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + uninstallKeyName)) + { + if (key == null) + { + return null; + } + var installLocation = key.GetValue("InstallPath"); + if (installLocation != null && !string.IsNullOrEmpty(installLocation.ToString())) + { + return installLocation.ToString(); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + return null; + } + } +} diff --git a/MiHoYoStarter/GenshinAccount.cs b/MiHoYoStarter/GenshinAccount.cs new file mode 100644 index 0000000..c5d60dd --- /dev/null +++ b/MiHoYoStarter/GenshinAccount.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MiHoYoStarter +{ + [Serializable] + public class GenshinAccount : MiHoYoAccount + { + public GenshinAccount() : base("Genshin", @"HKEY_CURRENT_USER\Software\miHoYo\原神", "MIHOYOSDK_ADL_PROD_CN_h3123967166") + { + } + } +} diff --git a/MiHoYoStarter/GenshinCloudAccount.cs b/MiHoYoStarter/GenshinCloudAccount.cs new file mode 100644 index 0000000..6f0c68e --- /dev/null +++ b/MiHoYoStarter/GenshinCloudAccount.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MiHoYoStarter +{ + [Serializable] + public class GenshinCloudAccount : MiHoYoAccount + { + public GenshinCloudAccount() : base("GenshinCloud", @"HKEY_CURRENT_USER\Software\miHoYo\云·原神", "MIHOYOSDK_ADL_0") + { + } + } +} diff --git a/MiHoYoStarter/MiHoYoAccount.cs b/MiHoYoStarter/MiHoYoAccount.cs new file mode 100644 index 0000000..5b68cb7 --- /dev/null +++ b/MiHoYoStarter/MiHoYoAccount.cs @@ -0,0 +1,88 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Principal; +using System.Text; +using System.Threading.Tasks; +using System.Web.Script.Serialization; +using System.Windows.Forms; + +namespace MiHoYoStarter +{ + [Serializable] + public class MiHoYoAccount + { + public string Name { get; set; } + /// + /// 每个游戏保存的数据存在不同的目录 + /// + public string SaveFolderName { get; set; } + + /// + /// 注册表记住账户信息的键值位置 + /// + public string AccountRegKeyName { get; set; } + /// + /// 注册表记住账户信息的键值名 + /// + public string AccountRegValueName { get; set; } + /// + /// 注册表记住账户信息的键值数据 + /// + public string AccountRegDataValue { get; set; } + + public MiHoYoAccount() + { + } + + + public MiHoYoAccount(string saveFolderName, string accountRegKeyName, string accountRegValueName) + { + SaveFolderName = saveFolderName; + AccountRegKeyName = accountRegKeyName; + AccountRegValueName = accountRegValueName; + } + + public void WriteToDisk() + { + File.WriteAllText(Path.Combine(Application.StartupPath, "UserData", SaveFolderName, Name), new JavaScriptSerializer().Serialize(this)); + } + + public static void DeleteFromDisk(string userDataPath, string name) + { + File.Delete(Path.Combine(userDataPath, name)); + } + + public static MiHoYoAccount CreateFromDisk(string userDataPath, string name) + { + string p = Path.Combine(userDataPath, name); + string json = File.ReadAllText(p); + return new JavaScriptSerializer().Deserialize(json); + } + + + public void ReadFromRegistry() + { + AccountRegDataValue = GetStringFromRegistry(AccountRegValueName); + } + + public void WriteToRegistry() + { + SetStringToRegistry(AccountRegValueName, AccountRegDataValue); + } + + protected string GetStringFromRegistry(string key) + { + object value = Registry.GetValue(AccountRegKeyName, key, ""); + return Encoding.UTF8.GetString((byte[])value); + } + + protected void SetStringToRegistry(string key, string value) + { + Registry.SetValue(AccountRegKeyName, key, Encoding.UTF8.GetBytes(value)); + } + + } +} diff --git a/MiHoYoStarter/MiHoYoStarter.csproj b/MiHoYoStarter/MiHoYoStarter.csproj new file mode 100644 index 0000000..7c8b8d5 --- /dev/null +++ b/MiHoYoStarter/MiHoYoStarter.csproj @@ -0,0 +1,107 @@ + + + + + Debug + AnyCPU + {B133648A-C581-43C6-8802-65B482B642DA} + WinExe + MiHoYoStarter + MiHoYoStarter + v4.5.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + Form + + + FormInput.cs + + + Form + + + FormMain.cs + + + + + + + + + + + + + FormInput.cs + + + FormMain.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + \ No newline at end of file diff --git a/MiHoYoStarter/Program.cs b/MiHoYoStarter/Program.cs new file mode 100644 index 0000000..0bb8e04 --- /dev/null +++ b/MiHoYoStarter/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace MiHoYoStarter +{ + internal static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new FormMain()); + } + } +} diff --git a/MiHoYoStarter/Properties/AssemblyInfo.cs b/MiHoYoStarter/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a90a92d --- /dev/null +++ b/MiHoYoStarter/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("MiHoYoStarter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MiHoYoStarter")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("b133648a-c581-43c6-8802-65b482b642da")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/MiHoYoStarter/Properties/Resources.Designer.cs b/MiHoYoStarter/Properties/Resources.Designer.cs new file mode 100644 index 0000000..75b64e7 --- /dev/null +++ b/MiHoYoStarter/Properties/Resources.Designer.cs @@ -0,0 +1,83 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace MiHoYoStarter.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MiHoYoStarter.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap attention { + get { + object obj = ResourceManager.GetObject("attention", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。 + /// + internal static System.Drawing.Icon hutao { + get { + object obj = ResourceManager.GetObject("hutao", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + } +} diff --git a/MiHoYoStarter/Properties/Resources.resx b/MiHoYoStarter/Properties/Resources.resx new file mode 100644 index 0000000..031353e --- /dev/null +++ b/MiHoYoStarter/Properties/Resources.resx @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\attention.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\hutao.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/MiHoYoStarter/Properties/Settings.Designer.cs b/MiHoYoStarter/Properties/Settings.Designer.cs new file mode 100644 index 0000000..211595a --- /dev/null +++ b/MiHoYoStarter/Properties/Settings.Designer.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace MiHoYoStarter.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string GenshinPath { + get { + return ((string)(this["GenshinPath"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string GenshinCloudPath { + get { + return ((string)(this["GenshinCloudPath"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string StarRailPath { + get { + return ((string)(this["StarRailPath"])); + } + } + } +} diff --git a/MiHoYoStarter/Properties/Settings.settings b/MiHoYoStarter/Properties/Settings.settings new file mode 100644 index 0000000..3185f0e --- /dev/null +++ b/MiHoYoStarter/Properties/Settings.settings @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MiHoYoStarter/Resources/attention.png b/MiHoYoStarter/Resources/attention.png new file mode 100644 index 0000000..42a92f3 Binary files /dev/null and b/MiHoYoStarter/Resources/attention.png differ diff --git a/MiHoYoStarter/Resources/hutao.ico b/MiHoYoStarter/Resources/hutao.ico new file mode 100644 index 0000000..ff5f330 Binary files /dev/null and b/MiHoYoStarter/Resources/hutao.ico differ diff --git a/MiHoYoStarter/StarRailAccount.cs b/MiHoYoStarter/StarRailAccount.cs new file mode 100644 index 0000000..f6a3de4 --- /dev/null +++ b/MiHoYoStarter/StarRailAccount.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MiHoYoStarter +{ + [Serializable] + public class StarRailAccount : MiHoYoAccount + { + public StarRailAccount() : base("StarRail", @"HKEY_CURRENT_USER\Software\miHoYo\崩坏:星穹铁道", "MIHOYOSDK_ADL_PROD_CN_h3123967166") + { + } + } +} diff --git a/MiHoYoStarter/Utils/Device.cs b/MiHoYoStarter/Utils/Device.cs new file mode 100644 index 0000000..6744396 --- /dev/null +++ b/MiHoYoStarter/Utils/Device.cs @@ -0,0 +1,159 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management; +using System.Net; +using System.Security.Cryptography; +using System.Text; + +namespace MiHoYoStarter.Utils +{ + public class Device + { + private static string macID = null; + private static string osVersion = null; + + private static string fingerPrint = null; + + #region PROP, get it only once + + public static string MacID + { + get + { + if (macID == null) + { + macID = ObtainMacID(); + } + return macID; + } + } + + public static string OSVersion + { + get + { + if (osVersion == null) + { + var name = (from x in new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem").Get().Cast() + select x.GetPropertyValue("Caption")).FirstOrDefault(); + osVersion = name != null ? name.ToString() : "Unknown"; + } + return osVersion; + } + } + #endregion + + /// + /// Calculate GUID + /// + /// GUID + public static string Value() + { + try + { + if (fingerPrint == null) + { + fingerPrint = GetHash( + "MAC >> " + MacID + ); + } + return fingerPrint; + } + catch + { + return Guid.NewGuid().ToString(); + } + + } + + private static string GetHash(string s) + { + MD5 sec = new MD5CryptoServiceProvider(); + ASCIIEncoding enc = new ASCIIEncoding(); + byte[] bt = enc.GetBytes(s); + return GetHexString(sec.ComputeHash(bt)); + } + + private static string GetHexString(byte[] bt) + { + string s = string.Empty; + for (int i = 0; i < bt.Length; i++) + { + byte b = bt[i]; + int n, n1, n2; + n = (int)b; + n1 = n & 15; + n2 = (n >> 4) & 15; + if (n2 > 9) + s += ((char)(n2 - 10 + (int)'A')).ToString(); + else + s += n2.ToString(); + if (n1 > 9) + s += ((char)(n1 - 10 + (int)'A')).ToString(); + else + s += n1.ToString(); + if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-"; + } + return s; + } + + + #region Original Device ID Getting Code + + public static string ObtainMacID() + { + return Identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled"); + } + + private static string Identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue) + { + string result = ""; + try + { + ManagementClass mc = new ManagementClass(wmiClass); + ManagementObjectCollection moc = mc.GetInstances(); + foreach (ManagementObject mo in moc) + { + if (mo[wmiMustBeTrue].ToString() == "True") + { + //Only get the first one + if (result == "") + { + result = mo[wmiProperty].ToString(); + break; + } + } + } + } + catch + { + } + return result; + } + + private static string Identifier(string wmiClass, string wmiProperty) + { + string result = ""; + try + { + ManagementClass mc = new ManagementClass(wmiClass); + ManagementObjectCollection moc = mc.GetInstances(); + foreach (ManagementObject mo in moc) + { + //Only get the first one + if (result == "") + { + result = mo[wmiProperty].ToString(); + break; + } + } + } + catch + { + } + return result; + } + #endregion + } +} diff --git a/MiHoYoStarter/Utils/GAHelper.cs b/MiHoYoStarter/Utils/GAHelper.cs new file mode 100644 index 0000000..0a11bf7 --- /dev/null +++ b/MiHoYoStarter/Utils/GAHelper.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using System.Web.Script.Serialization; +using System.Windows.Forms; + +namespace MiHoYoStarter.Utils +{ + /// + /// 用于软件的 Google Analytics 实现 By huiyadanli + /// 20230409 更新 GA4 的实现 + /// 相关文档: + /// #GA指南(过时) https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide + /// #GA参数(过时) https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters + /// GA4教程 https://firebase.google.com/codelabs/firebase_mp + /// 测试 https://ga-dev-tools.google/ga4/event-builder/ + /// + public class GAHelper + { + private static GAHelper instance = null; + private static readonly object obj = new object(); + + public static GAHelper Instance + { + get + { + //lock (obj) + //{ + if (instance == null) + { + instance = new GAHelper(); + } + return instance; + //} + } + } + + // 根据实际情况修改 + private static readonly HttpClient client = new HttpClient(); + + private const string GAUrl = "https://www.google-analytics.com/mp/collect?api_secret=urKlcc29TSy3OIkHr8yFSQ&measurement_id=G-BE6FRPZS1W"; + + private static readonly string cid = Device.Value(); // Anonymous Client ID. // Guid.NewGuid().ToString() + + + public string UserAgent { get; set; } + + public GAHelper() + { + UserAgent = $"Hui Google Analytics Tracker/1.0 ({Environment.OSVersion.Platform.ToString()}; {Environment.OSVersion.Version.ToString()}; {Environment.OSVersion.VersionString})"; + } + + public async Task RequestPageViewAsync(string page, string title = null) + { + try + { + if (page.StartsWith("/")) + { + page = page.Remove(0, 1); + } + page = page.Replace("/", "_").Replace(".", "_"); + // 请求参数 + var values = new Dictionary + { + { "client_id",UserAgent}, + { "user_id", cid }, + { "non_personalized_ads", "false" }, + { "events", new List>() + { + new Dictionary() + { + { "name",page }, + { + "params", + new Dictionary() + { + { "engagement_time_msec", "1"}, + } + }, + } + } + }, + }; + var serializer = new JavaScriptSerializer(); + var json = serializer.Serialize(values); + var content = new StringContent(json, Encoding.UTF8, "application/json"); + var response = await client.PostAsync(GAUrl, content); + // Console.WriteLine(response.ToString()); + } + catch (Exception ex) + { + + Console.WriteLine("GAHelper:" + ex.Message); + Console.WriteLine(ex.StackTrace); + } + } + + public void RequestPageView(string page, string title = null) + { + Task.Run(() => RequestPageViewAsync(page, title)); + } + } +} diff --git a/MiHoYoStarter/Utils/HuiUtils.cs b/MiHoYoStarter/Utils/HuiUtils.cs new file mode 100644 index 0000000..e139ce8 --- /dev/null +++ b/MiHoYoStarter/Utils/HuiUtils.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MiHoYoStarter.Utils +{ + internal class HuiUtils + { + public static string GetMyVersion() + { + string currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + if (currentVersion.Length > 3) + { + return "v" + currentVersion.Substring(0, 3); + } + return ""; + } + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..19cf8a1 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# 🛠原神账号切换工具 + +一个用于在一台电脑上快速切换原神账号的小工具。(暂时只支持国服) + +原神周年可以领20连,为了方便切换各个小号领取,所以有了这个工具 + +[📥Github下载(1.5)](https://github.com/babalae/genshin-account/releases/download/v1.5/GenshinAccount_v1.5.zip) + +## 截图 +![Screenshot](https://raw.githubusercontent.com/babalae/genshin-account/main/Document/Screenshot.png) + +## 使用方法 + +环境要求: + +* Windows 7 或更高版本。 +* [.NET Framework 4.5](https://www.microsoft.com/zh-cn/download/details.aspx?id=30653) 或更高版本。 + +就三个按钮,先登录后保存,后续就可以随便切换了。注意切换账户要关闭原神进程。 + +具体点: + +先登录账号1,在已经登录的情况下点击[保存当前账号],填写对应的名字保存即可。 + +再注销账号1,登录账号2,同上操作保存账号。 + +然后在游戏退出后就可以随意选中已保存的账号,点击[切换选中账号],再运行游戏默认登录的就是选中的账号。 + +注意要使用 切换时自动重启原神 的功能时,必须选择原神安装路径才能使用。正常情况下程序会自动从注册表中读取到安装信息,无需手动填写。 \ No newline at end of file