mirror of
https://github.com/netchx/netch.git
synced 2026-05-11 23:45:06 +08:00
清理翻译,调整配置按钮点击逻辑,移除系统位元检查
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Netch.Controllers
|
|||||||
{
|
{
|
||||||
public VMessController()
|
public VMessController()
|
||||||
{
|
{
|
||||||
Name = "v2ray";
|
Name = "V2Ray";
|
||||||
MainFile = "v2ray.exe";
|
MainFile = "v2ray.exe";
|
||||||
StartedKeywords("started");
|
StartedKeywords("started");
|
||||||
StoppedKeywords("config file not readable", "failed to");
|
StoppedKeywords("config file not readable", "failed to");
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Netch.Forms
|
|||||||
|
|
||||||
if (ModeComboBox.SelectedIndex == -1)
|
if (ModeComboBox.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
MessageBoxX.Show(i18N.Translate("Please select an mode first"));
|
MessageBoxX.Show(i18N.Translate("Please select a mode first"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,11 +51,9 @@ namespace Netch.Forms
|
|||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
UpdateStatus(State.Started,
|
UpdateStatus(State.Started,
|
||||||
i18N.Translate(StateExtension.GetStatusString(State.Started)) + PortText(server.Type, mode.Type));
|
i18N.Translate(StateExtension.GetStatusString(State.Started)) + LocalPortText(server.Type, mode.Type));
|
||||||
|
|
||||||
Bandwidth.NetTraffic(server, mode, _mainController);
|
Bandwidth.NetTraffic(server, mode, _mainController);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 如果勾选启动后最小化
|
// 如果勾选启动后最小化
|
||||||
if (Global.Settings.MinimizeWhenStarted)
|
if (Global.Settings.MinimizeWhenStarted)
|
||||||
{
|
{
|
||||||
@@ -110,47 +108,39 @@ namespace Netch.Forms
|
|||||||
{
|
{
|
||||||
// 停止
|
// 停止
|
||||||
UpdateStatus(State.Stopping);
|
UpdateStatus(State.Stopping);
|
||||||
Task.Run(() =>
|
_mainController.Stop();
|
||||||
{
|
UpdateStatus(State.Stopped);
|
||||||
_mainController.Stop();
|
Task.Run(TestServer);
|
||||||
UpdateStatus(State.Stopped);
|
|
||||||
|
|
||||||
TestServer();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string PortText(string serverType, int modeType)
|
private static string LocalPortText(string serverType, int modeType)
|
||||||
{
|
{
|
||||||
var text = new StringBuilder(" (");
|
var text = new StringBuilder(" (");
|
||||||
text.Append(Global.Settings.LocalAddress == "0.0.0.0"
|
if (Global.Settings.LocalAddress == "0.0.0.0")
|
||||||
? i18N.Translate("Allow other Devices to connect") + " "
|
text.Append(i18N.Translate("Allow other Devices to connect") + " ");
|
||||||
: "");
|
|
||||||
if (serverType == "Socks5")
|
if (serverType == "Socks5")
|
||||||
{
|
{
|
||||||
// 不可控Socks5
|
// 不可控Socks5
|
||||||
if (modeType == 3 || modeType == 5)
|
if (modeType == 3 || modeType == 5)
|
||||||
{
|
{
|
||||||
// 可控HTTP
|
// 可控HTTP
|
||||||
text.Append(
|
text.Append($"HTTP {i18N.Translate("Local Port", ": ")}{Global.Settings.HTTPLocalPort}");
|
||||||
$"HTTP {i18N.Translate("Local Port", ": ")}{Global.Settings.HTTPLocalPort}");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 不可控HTTP
|
// 不可控HTTP
|
||||||
return "";
|
return string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 可控Socks5
|
// 可控Socks5
|
||||||
text.Append(
|
text.Append($"Socks5 {i18N.Translate("Local Port", ": ")}{Global.Settings.Socks5LocalPort}");
|
||||||
$"Socks5 {i18N.Translate("Local Port", ": ")}{Global.Settings.Socks5LocalPort}");
|
|
||||||
if (modeType == 3 || modeType == 5)
|
if (modeType == 3 || modeType == 5)
|
||||||
{
|
{
|
||||||
//有HTTP
|
// 有HTTP
|
||||||
text.Append(
|
text.Append($" | HTTP {i18N.Translate("Local Port", ": ")}{Global.Settings.HTTPLocalPort}");
|
||||||
$" | HTTP {i18N.Translate("Local Port", ": ")}{Global.Settings.HTTPLocalPort}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -230,39 +230,6 @@ namespace Netch.Forms
|
|||||||
|
|
||||||
#region 选项
|
#region 选项
|
||||||
|
|
||||||
private void RestartServiceToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Enabled = false;
|
|
||||||
StatusText(i18N.Translate("Restarting service"));
|
|
||||||
|
|
||||||
Task.Run(() =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var service = new ServiceController("netfilter2");
|
|
||||||
if (service.Status == ServiceControllerStatus.Stopped)
|
|
||||||
{
|
|
||||||
service.Start();
|
|
||||||
service.WaitForStatus(ServiceControllerStatus.Running);
|
|
||||||
}
|
|
||||||
else if (service.Status == ServiceControllerStatus.Running)
|
|
||||||
{
|
|
||||||
service.Stop();
|
|
||||||
service.WaitForStatus(ServiceControllerStatus.Stopped);
|
|
||||||
service.Start();
|
|
||||||
service.WaitForStatus(ServiceControllerStatus.Running);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
NFAPI.nf_registerDriver("netfilter2");
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageBoxX.Show(i18N.Translate("Service has been restarted"), owner: this);
|
|
||||||
Enabled = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UninstallServiceToolStripMenuItem_Click(object sender, EventArgs e)
|
private void UninstallServiceToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Enabled = false;
|
Enabled = false;
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ namespace Netch.Forms
|
|||||||
}
|
}
|
||||||
else if (ModeComboBox.SelectedIndex == -1)
|
else if (ModeComboBox.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
MessageBoxX.Show(i18N.Translate("Please select an mode first"));
|
MessageBoxX.Show(i18N.Translate("Please select a mode first"));
|
||||||
}
|
}
|
||||||
else if (ProfileNameText.Text == "")
|
else if (ProfileNameText.Text == "")
|
||||||
{
|
{
|
||||||
@@ -159,54 +159,53 @@ namespace Netch.Forms
|
|||||||
SaveProfile(index);
|
SaveProfile(index);
|
||||||
ProfileButtons[index].Text = ProfileNameText.Text;
|
ProfileButtons[index].Text = ProfileNameText.Text;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (ModifierKeys == Keys.Shift)
|
|
||||||
|
if (Global.Settings.Profiles[index].IsDummy)
|
||||||
{
|
{
|
||||||
if (MessageBoxX.Show(i18N.Translate("Remove this Profile?"), confirm: true) == DialogResult.OK)
|
MessageBoxX.Show(i18N.Translate("No saved profile here. Save a profile first by Ctrl+Click on the button"));
|
||||||
{
|
return;
|
||||||
RemoveProfile(index);
|
|
||||||
ProfileButtons[index].Text = i18N.Translate("None");
|
|
||||||
MessageBoxX.Show(i18N.Translate("Profile Removed!"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (ModifierKeys == Keys.Shift)
|
||||||
{
|
{
|
||||||
if (Global.Settings.Profiles[index].IsDummy)
|
if (MessageBoxX.Show(i18N.Translate("Remove this Profile?"), confirm: true) != DialogResult.OK) return;
|
||||||
{
|
RemoveProfile(index);
|
||||||
MessageBoxX.Show(i18N.Translate("No saved profile here. Save a profile first by Ctrl+Click on the button"));
|
ProfileButtons[index].Text = i18N.Translate("None");
|
||||||
return;
|
MessageBoxX.Show(i18N.Translate("Profile Removed!"));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProfileNameText.Text = LoadProfile(index);
|
ProfileNameText.Text = LoadProfile(index);
|
||||||
|
|
||||||
// start the profile
|
// start the profile
|
||||||
ControlFun();
|
ControlFun();
|
||||||
if (State == State.Stopping || State == State.Stopped)
|
if (State == State.Stopping || State == State.Stopped)
|
||||||
{
|
|
||||||
Task.Run(() =>
|
|
||||||
{
|
|
||||||
while (State != State.Stopped)
|
|
||||||
{
|
|
||||||
Thread.Sleep(250);
|
|
||||||
}
|
|
||||||
|
|
||||||
ControlButton.PerformClick();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ee)
|
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
Logging.Info(ee.ToString());
|
while (State != State.Stopped)
|
||||||
ProfileButtons[index].Text = i18N.Translate("Error");
|
{
|
||||||
Thread.Sleep(1200);
|
Thread.Sleep(250);
|
||||||
ProfileButtons[index].Text = i18N.Translate("None");
|
}
|
||||||
|
|
||||||
|
ControlFun();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ee)
|
||||||
|
{
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
Logging.Info(ee.ToString());
|
||||||
|
ProfileButtons[index].Text = i18N.Translate("Error");
|
||||||
|
Thread.Sleep(1200);
|
||||||
|
ProfileButtons[index].Text = i18N.Translate("None");
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ namespace Netch.Forms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBoxX.Show(i18N.Translate("Please select an mode first"));
|
MessageBoxX.Show(i18N.Translate("Please select a mode first"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ namespace Netch.Forms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBoxX.Show(i18N.Translate("Please select an mode first"));
|
MessageBoxX.Show(i18N.Translate("Please select a mode first"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace Netch.Forms
|
|||||||
|
|
||||||
Configuration.Save();
|
Configuration.Save();
|
||||||
Global.Settings.UseProxyToUpdateSubscription = UseSelectedServerCheckBox.Checked;
|
Global.Settings.UseProxyToUpdateSubscription = UseSelectedServerCheckBox.Checked;
|
||||||
MessageBoxX.Show(i18N.Translate("Successfully saved"));
|
MessageBoxX.Show(i18N.Translate("Saved"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (saveFlag)
|
if (saveFlag)
|
||||||
@@ -200,7 +200,7 @@ namespace Netch.Forms
|
|||||||
{
|
{
|
||||||
Configuration.Save();
|
Configuration.Save();
|
||||||
Global.Settings.UseProxyToUpdateSubscription = UseSelectedServerCheckBox.Checked;
|
Global.Settings.UseProxyToUpdateSubscription = UseSelectedServerCheckBox.Checked;
|
||||||
MessageBoxX.Show(i18N.Translate("Successfully saved"));
|
MessageBoxX.Show(i18N.Translate("Saved"));
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -71,20 +71,6 @@ namespace Netch
|
|||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var OS = Environment.Is64BitOperatingSystem ? "x64" : "x86";
|
|
||||||
var PROC = Environment.Is64BitProcess ? "x64" : "x86";
|
|
||||||
|
|
||||||
// 如果系统位数与程序位数不一致
|
|
||||||
if (OS != PROC)
|
|
||||||
{
|
|
||||||
|
|
||||||
// 弹出提示
|
|
||||||
MessageBoxX.Show($"{i18N.Translate("Netch is not compatible with your system.")}\n{i18N.Translate("Current arch of Netch:")} {PROC}\n{i18N.Translate("Current arch of system:")} {OS}");
|
|
||||||
|
|
||||||
// 退出进程
|
|
||||||
Environment.Exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 绑定错误捕获
|
// 绑定错误捕获
|
||||||
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
||||||
Application.ThreadException += Application_OnException;
|
Application.ThreadException += Application_OnException;
|
||||||
|
|||||||
@@ -5,9 +5,6 @@
|
|||||||
|
|
||||||
"If this is your first time using this software,\n please check http://netch.org to install supports first,\n or the program may report errors.": "如果你是第一次使用本软件,\n请务必前往http://netch.org安装程序所需依赖,\n否则程序将无法正常运行!",
|
"If this is your first time using this software,\n please check http://netch.org to install supports first,\n or the program may report errors.": "如果你是第一次使用本软件,\n请务必前往http://netch.org安装程序所需依赖,\n否则程序将无法正常运行!",
|
||||||
"Netch is already running": "Netch 已经在运行中",
|
"Netch is already running": "Netch 已经在运行中",
|
||||||
"Netch is not compatible with your system.": "Netch 和你的系统不兼容",
|
|
||||||
"Current arch of Netch:": "当前 Netch 架构:",
|
|
||||||
"Current arch of system:": "当前系统架构:",
|
|
||||||
|
|
||||||
"Start": "启动",
|
"Start": "启动",
|
||||||
"Stop": "停止",
|
"Stop": "停止",
|
||||||
@@ -18,7 +15,6 @@
|
|||||||
"Stopping": "正在停止中",
|
"Stopping": "正在停止中",
|
||||||
"Stopped": "已停止",
|
"Stopped": "已停止",
|
||||||
"Starting ": "正在启动 ",
|
"Starting ": "正在启动 ",
|
||||||
"v2ray": "V2Ray",
|
|
||||||
"Starting Tap": "正在启动 TUN/TAP",
|
"Starting Tap": "正在启动 TUN/TAP",
|
||||||
"Starting NatTester": "正在启动 NAT 测试",
|
"Starting NatTester": "正在启动 NAT 测试",
|
||||||
"Starting LocalDns service": "正在启动本地 DNS 服务",
|
"Starting LocalDns service": "正在启动本地 DNS 服务",
|
||||||
@@ -41,7 +37,6 @@
|
|||||||
"Add [ShadowsocksR] Server": "添加 [ShadowsocksR] 服务器",
|
"Add [ShadowsocksR] Server": "添加 [ShadowsocksR] 服务器",
|
||||||
"Add [VMess] Server": "添加 [VMess] 服务器",
|
"Add [VMess] Server": "添加 [VMess] 服务器",
|
||||||
"Add [Trojan] Server": "添加 [Trojan] 服务器",
|
"Add [Trojan] Server": "添加 [Trojan] 服务器",
|
||||||
"VMess is currently not supported. For more information, please see our Github releases\n\nPress OK will redirect": "当前不支持 VMess 服务器。需要更多信息请查看我们的 Github 发布页\n\n点击 OK 将会跳转",
|
|
||||||
"Netch is now minimized to the notification bar, double click this icon to restore.": "Netch 已最小化至通知栏,双击此图标恢复窗口。",
|
"Netch is now minimized to the notification bar, double click this icon to restore.": "Netch 已最小化至通知栏,双击此图标恢复窗口。",
|
||||||
"New version available": "发现新版本",
|
"New version available": "发现新版本",
|
||||||
"Mode": "模式",
|
"Mode": "模式",
|
||||||
@@ -79,9 +74,6 @@
|
|||||||
"Update servers error from {0}": "从 {0} 更新服务器失败",
|
"Update servers error from {0}": "从 {0} 更新服务器失败",
|
||||||
|
|
||||||
"Options": "选项",
|
"Options": "选项",
|
||||||
"Restart Service": "重启服务",
|
|
||||||
"Restarting service": "正在重启服务中",
|
|
||||||
"Service has been restarted": "服务已重启",
|
|
||||||
"Uninstall Service": "卸载服务",
|
"Uninstall Service": "卸载服务",
|
||||||
"Uninstalling Service": "正在卸载服务中",
|
"Uninstalling Service": "正在卸载服务中",
|
||||||
"Service has been uninstalled": "服务已卸载",
|
"Service has been uninstalled": "服务已卸载",
|
||||||
@@ -107,9 +99,11 @@
|
|||||||
|
|
||||||
"Please press Stop button first": "请先点击停止按钮",
|
"Please press Stop button first": "请先点击停止按钮",
|
||||||
"Please select a server first": "请先选择一个服务器",
|
"Please select a server first": "请先选择一个服务器",
|
||||||
"Please select an mode first": "请先选择一个模式",
|
"Please select a mode first": "请先选择一个模式",
|
||||||
"Please enter a profile name first": "请先为该配置设置一个名称",
|
"Please enter a profile name first": "请先为该配置设置一个名称",
|
||||||
"No saved profile here. Save a profile first by Ctrl+Click on the button": "当前按钮下没有保存配置,请先使用 CTRL + 左键 点击该按钮保存一个配置",
|
"No saved profile here. Save a profile first by Ctrl+Click on the button": "当前按钮下没有保存配置,请先使用 CTRL + 左键 点击该按钮保存一个配置",
|
||||||
|
"Remove this Profile?": "确认删除此配置?",
|
||||||
|
"Profile Removed!": "配置已删除!",
|
||||||
|
|
||||||
"Used": "已使用",
|
"Used": "已使用",
|
||||||
"Status": "状态",
|
"Status": "状态",
|
||||||
@@ -143,7 +137,6 @@
|
|||||||
"Remark can not be empty": "备注不可为空",
|
"Remark can not be empty": "备注不可为空",
|
||||||
"Link can not be empty": "链接不可为空",
|
"Link can not be empty": "链接不可为空",
|
||||||
"Link must start with http:// or https://": "链接必须以 http:// 或 https:// 开头",
|
"Link must start with http:// or https://": "链接必须以 http:// 或 https:// 开头",
|
||||||
"Successfully saved": "保存成功",
|
|
||||||
"Please fill in alterID": "请填写额外ID",
|
"Please fill in alterID": "请填写额外ID",
|
||||||
|
|
||||||
"Settings": "设置",
|
"Settings": "设置",
|
||||||
@@ -170,7 +163,6 @@
|
|||||||
"Detection interval value illegal. Try again.": "检测间隔值非法。请重试。",
|
"Detection interval value illegal. Try again.": "检测间隔值非法。请重试。",
|
||||||
"TUN/TAP driver is not detected. Is it installed now?": "未检测到 TUN/TAP 驱动,是否现在安装?",
|
"TUN/TAP driver is not detected. Is it installed now?": "未检测到 TUN/TAP 驱动,是否现在安装?",
|
||||||
"Failed to set the system proxy, it may be caused by the lack of dependent programs. Do you want to jump to Netch's official website to download dependent programs?": "设置系统代理失败,可能是缺少依赖导致,是否跳转 Netch 官网下载依赖程序?",
|
"Failed to set the system proxy, it may be caused by the lack of dependent programs. Do you want to jump to Netch's official website to download dependent programs?": "设置系统代理失败,可能是缺少依赖导致,是否跳转 Netch 官网下载依赖程序?",
|
||||||
"Experimental function": "实验性功能",
|
|
||||||
"Delay test after start": "启动后延迟测试",
|
"Delay test after start": "启动后延迟测试",
|
||||||
"Enable": "启用",
|
"Enable": "启用",
|
||||||
"Detection interval(sec)": "检测间隔(秒)",
|
"Detection interval(sec)": "检测间隔(秒)",
|
||||||
@@ -178,7 +170,6 @@
|
|||||||
"STUN Server Port": "STUN 服务器端口",
|
"STUN Server Port": "STUN 服务器端口",
|
||||||
"Custom ACL": "自定义 ACL 规则",
|
"Custom ACL": "自定义 ACL 规则",
|
||||||
"Language": "语言",
|
"Language": "语言",
|
||||||
"Saved.": "保存成功",
|
|
||||||
|
|
||||||
"Profile": "配置名",
|
"Profile": "配置名",
|
||||||
"Profiles": "配置",
|
"Profiles": "配置",
|
||||||
|
|||||||
Reference in New Issue
Block a user