Skip to content

Commit

Permalink
feat: 国际服面板独立
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyadanli committed Sep 10, 2023
1 parent d51ba04 commit 77bdeb8
Show file tree
Hide file tree
Showing 10 changed files with 898 additions and 201 deletions.
26 changes: 22 additions & 4 deletions MiHoYoStarter/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,29 @@
<setting name="GenshinCloudAutoStartEnabled" serializeAs="String">
<value>True</value>
</setting>
<setting name="GenshinServerIndex" serializeAs="String">
<value>0</value>
<setting name="GenshinOverseaAutoStartEnabled" serializeAs="String">
<value>True</value>
</setting>
<setting name="StarRailOverseaAutoStartEnabled" serializeAs="String">
<value>True</value>
</setting>
<setting name="GenshinOverseaStartParam" serializeAs="String">
<value />
</setting>
<setting name="StarRailOverseaStartParam" serializeAs="String">
<value />
</setting>
<setting name="StarRailServerIndex" serializeAs="String">
<value>0</value>
<setting name="DisplayGenshinOverseaEnabled" serializeAs="String">
<value>True</value>
</setting>
<setting name="DisplayStarRailOverseaEnabled" serializeAs="String">
<value>True</value>
</setting>
<setting name="GenshinOverseaPath" serializeAs="String">
<value />
</setting>
<setting name="StarRailOverseaPath" serializeAs="String">
<value />
</setting>
</MiHoYoStarter.Properties.Settings>
</userSettings>
Expand Down
4 changes: 2 additions & 2 deletions MiHoYoStarter/FormInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private void btnSave_Click(object sender, EventArgs e)
{
acct = new GenshinAccount();
}
else if (gameNameEN == "Genshin*")
else if (gameNameEN == "GenshinOversea")
{
acct = new GenshinOverseaAccount();
}
Expand All @@ -47,7 +47,7 @@ private void btnSave_Click(object sender, EventArgs e)
{
acct = new StarRailAccount();
}
else if (gameNameEN == "StarRail*")
else if (gameNameEN == "StarRailOversea")
{
acct = new StarRailOverseaAccount();
}
Expand Down
691 changes: 609 additions & 82 deletions MiHoYoStarter/FormMain.Designer.cs

Large diffs are not rendered by default.

169 changes: 143 additions & 26 deletions MiHoYoStarter/FormMain.cs

Large diffs are not rendered by default.

87 changes: 16 additions & 71 deletions MiHoYoStarter/GameFormControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public class GameFormControl

public string ProcessName { get; set; }

public bool IsOversea { get; set; }

private FormMain formMain;

private TextBox txtPath;
Expand All @@ -41,8 +39,6 @@ public class GameFormControl

private CheckBox chkAutoStart;

private ComboBox cboServer;

public List<ToolStripMenuItem> AcctMenuItemList { get; set; }

public GameFormControl(string nameCN, string nameShortCN, string nameEN, string processName)
Expand Down Expand Up @@ -74,7 +70,6 @@ public void InitControl(FormMain formMain, TabPage tabPage, string pathSetting)
FindControl(tabPage, $"btn{GameNameEN}Delete", ref btnDelete);
FindControl(tabPage, $"btn{GameNameEN}Start", ref btnStart);
FindControl(tabPage, $"chk{GameNameEN}AutoStart", ref chkAutoStart);
FindControl(tabPage, $"cbo{GameNameEN}Server", ref cboServer);



Expand All @@ -90,12 +85,18 @@ public void InitControl(FormMain formMain, TabPage tabPage, string pathSetting)
case "Genshin":
path = Path.Combine(installPath, "Genshin Impact Game", "YuanShen.exe"); // 只支持国服
break;
case "GenshinOversea":
path = Path.Combine(installPath, "Genshin Impact Game", "GenshinImpact.exe");
break;
case "GenshinCloud":
path = Path.Combine(installPath, "Genshin Impact Cloud Game.exe");
break;
case "StarRail":
path = Path.Combine(installPath, "Game", "StarRail.exe");
break;
case "StarRailOversea":
path = Path.Combine(installPath, "Game", "StarRail.exe");
break;
case "HonkaiImpact3":
path = Path.Combine(installPath, "Game", "BH3.exe");
break;
Expand All @@ -105,58 +106,6 @@ public void InitControl(FormMain formMain, TabPage tabPage, string pathSetting)
{
txtPath.Text = path;
}

if (cboServer != null)
{
cboServer.SelectedIndex = 0;
}
}
else
{
// 国际服
string registryPathNameEn = GameNameEN;
if ("Genshin" == GameNameEN)
{
registryPathNameEn = "Genshin Impact";
}

string installPathOversea = FindInstallPathFromRegistry(registryPathNameEn);

if (installPathOversea != null)
{
string path = null;
switch (GameNameEN)
{
case "Genshin":
path = Path.Combine(installPathOversea, "Genshin Impact Game", "GenshinImpact.exe");
break;
case "GenshinCloud":
path = Path.Combine(installPathOversea, "Genshin Impact Cloud Game.exe");
break;
case "StarRail":
path = Path.Combine(installPathOversea, "Game", "StarRail.exe");
break;
case "HonkaiImpact3":
path = Path.Combine(installPathOversea, "Game", "BH3.exe");
break;
}

if (path != null && File.Exists(path))
{
txtPath.Text = path;
}

if (cboServer != null)
{
cboServer.SelectedIndex = 1;
}
}
}

// 是否国际服
if (cboServer != null)
{
IsOversea = cboServer.SelectedIndex == 1;
}
}
else
Expand Down Expand Up @@ -197,14 +146,20 @@ private void btnChoosePathClick(object sender, EventArgs e)
switch (GameNameEN)
{
case "Genshin":
dialog.Filter = "原神国服|YuanShen.exe|可执行文件(*.exe)|*.exe";
dialog.Filter = "原神|YuanShen.exe|可执行文件(*.exe)|*.exe";
break;
case "GenshinOversea":
dialog.Filter = "原神(国际服)|GenshinImpact.exe|可执行文件(*.exe)|*.exe";
break;
case "GenshinCloud":
dialog.Filter = "云原神|Genshin Impact Cloud Game.exe|可执行文件(*.exe)|*.exe";
break;
case "StarRail":
dialog.Filter = "崩坏:星穹铁道|StarRail.exe|可执行文件(*.exe)|*.exe";
break;
case "StarRailOversea":
dialog.Filter = "崩坏:星穹铁道(国际服)|StarRail.exe|可执行文件(*.exe)|*.exe";
break;
case "HonkaiImpact3":
dialog.Filter = "崩坏3|BH3.exe|可执行文件(*.exe)|*.exe";
break;
Expand All @@ -216,7 +171,8 @@ private void btnChoosePathClick(object sender, EventArgs e)
{
string msg = $@"请选择【{GameNameCN}】的游戏本体执行文件(注意不是启动器!!!)
以下是游戏本体执行文件的路径:
原神(国服):\Genshin Impact\Genshin Impact Game\YuanShen.exe
原神:\Genshin Impact\Genshin Impact Game\YuanShen.exe
原神(国际服):\Genshin Impact\Genshin Impact Game\GenshinImpact.exe
云·原神:\Genshin Impact Cloud Game\Genshin Impact Cloud Game.exe
崩坏:星穹铁道:\Star Rail\Game\StarRail.exe
崩坏3:\Honkai Impact 3rd\Game\BH3.exe";
Expand All @@ -230,18 +186,7 @@ private void btnChoosePathClick(object sender, EventArgs e)

private void btnAddClick(object sender, EventArgs e)
{
// 是否国际服
if (cboServer != null)
{
IsOversea = cboServer.SelectedIndex == 1;
}
string GameNameENX = GameNameEN;
if (IsOversea)
{
GameNameENX += "*";
}

FormInput form = new FormInput(GameNameENX);
FormInput form = new FormInput(GameNameEN);
form.ShowDialog();
RefreshList();
}
Expand Down
2 changes: 1 addition & 1 deletion MiHoYoStarter/GenshinOverseaAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace MiHoYoStarter
[Serializable]
public class GenshinOverseaAccount : MiHoYoAccount
{
public GenshinOverseaAccount() : base("Genshin", @"HKEY_CURRENT_USER\Software\miHoYo\Genshin Impact", "MIHOYOSDK_ADL_PROD_OVERSEA_h1158948810")
public GenshinOverseaAccount() : base("GenshinOversea", @"HKEY_CURRENT_USER\Software\miHoYo\Genshin Impact", "MIHOYOSDK_ADL_PROD_OVERSEA_h1158948810")
{
}
}
Expand Down
4 changes: 2 additions & 2 deletions MiHoYoStarter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
88 changes: 80 additions & 8 deletions MiHoYoStarter/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 22 additions & 4 deletions MiHoYoStarter/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,29 @@
<Setting Name="GenshinCloudAutoStartEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="GenshinServerIndex" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
<Setting Name="GenshinOverseaAutoStartEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="StarRailOverseaAutoStartEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="GenshinOverseaStartParam" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="StarRailOverseaStartParam" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="StarRailServerIndex" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
<Setting Name="DisplayGenshinOverseaEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="DisplayStarRailOverseaEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="GenshinOverseaPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="StarRailOverseaPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
2 changes: 1 addition & 1 deletion MiHoYoStarter/StarRailOverseaAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace MiHoYoStarter
[Serializable]
public class StarRailOverseaAccount : MiHoYoAccount
{
public StarRailOverseaAccount() : base("StarRail", @"HKEY_CURRENT_USER\Software\Cognosphere\Star Rail", "MIHOYOSDK_ADL_PROD_OVERSEA_h1158948810")
public StarRailOverseaAccount() : base("StarRailOversea", @"HKEY_CURRENT_USER\Software\Cognosphere\Star Rail", "MIHOYOSDK_ADL_PROD_OVERSEA_h1158948810")
{
}
}
Expand Down

0 comments on commit 77bdeb8

Please sign in to comment.