Skip to content

Commit 2b6e4cd

Browse files
committed
add tun mode prompt
1 parent d766deb commit 2b6e4cd

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

clashN/clashN/Forms/AddProfileForm.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,7 @@ private void btnOK_Click(object sender, EventArgs e)
8080
profileItem.enableTun = chkEnableTun.Checked;
8181
profileItem.enableConvert = chkEnableConvert.Checked;
8282

83-
if (profileItem.enableTun)
84-
{
85-
profileItem.coreType = ECoreType.clash_meta;
86-
if (!Utils.IsAdministrator())
87-
{
88-
UI.Show(ResUI.RunAsAdmin);
89-
}
90-
}
91-
else if (Utils.IsNullOrEmpty(cmbCoreType.Text))
83+
if (Utils.IsNullOrEmpty(cmbCoreType.Text))
9284
{
9385
profileItem.coreType = null;
9486
}
@@ -97,6 +89,18 @@ private void btnOK_Click(object sender, EventArgs e)
9789
profileItem.coreType = (ECoreType)Enum.Parse(typeof(ECoreType), cmbCoreType.Text);
9890
}
9991

92+
if (profileItem.enableTun)
93+
{
94+
if (!Utils.IsAdministrator())
95+
{
96+
UI.Show(ResUI.RunAsAdmin);
97+
}
98+
if (profileItem.coreType != ECoreType.clash_meta)
99+
{
100+
UI.ShowWarning(ResUI.TunModeCoreTip);
101+
}
102+
}
103+
100104
if (ConfigHandler.EditProfile(ref config, profileItem) == 0)
101105
{
102106
this.DialogResult = DialogResult.OK;

clashN/clashN/Resx/ResUI.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clashN/clashN/Resx/ResUI.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,4 +382,7 @@
382382
<data name="LvUpdateTime" xml:space="preserve">
383383
<value>UpdateTime</value>
384384
</data>
385+
<data name="TunModeCoreTip" xml:space="preserve">
386+
<value>To enable tun mode, please use Clash.Meta Core first; if you must use Clash Core, you need to download Clash Premium Core overlay</value>
387+
</data>
385388
</root>

clashN/clashN/Resx/ResUI.zh-Hans.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,4 +382,7 @@
382382
<data name="LvUpdateTime" xml:space="preserve">
383383
<value>更新时间</value>
384384
</data>
385+
<data name="TunModeCoreTip" xml:space="preserve">
386+
<value>开启tun模式请优先使用Clash.Meta Core; 如一定要使用Clash Core, 需要下载Clash Premium Core覆盖</value>
387+
</data>
385388
</root>

0 commit comments

Comments
 (0)