mirror of
https://github.com/netchx/netch.git
synced 2026-05-11 23:45:06 +08:00
Update texts
rename Subscribe Link (WTF??) to Subscription Full English log Remove Debug Logging Sink Add Console Logging Sink
This commit is contained in:
@@ -157,7 +157,7 @@ namespace Netch.Controllers
|
||||
}
|
||||
catch (Win32Exception e)
|
||||
{
|
||||
Log.Error(e, "停止 {Name} 异常", Instance.ProcessName);
|
||||
Log.Error(e, "Stop {Name} failed", Instance.ProcessName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@ using Netch.Models;
|
||||
using Netch.Servers;
|
||||
using Netch.Utils;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace Netch.Controllers
|
||||
{
|
||||
@@ -48,14 +47,6 @@ namespace Netch.Controllers
|
||||
|
||||
await Task.WhenAll(Task.Run(NativeMethods.RefreshDNSCache), Task.Run(Firewall.AddNetchFwRules));
|
||||
|
||||
if (Log.IsEnabled(LogEventLevel.Debug))
|
||||
Task.Run(() =>
|
||||
{
|
||||
// TODO log level setting
|
||||
Log.Debug("Running Processes: \n{Processes}", string.Join("\n", SystemInfo.Processes(false)));
|
||||
})
|
||||
.Forget();
|
||||
|
||||
try
|
||||
{
|
||||
(ModeController, ModeFeatures) = ModeHelper.GetModeControllerByType(mode.Type, out var modePort, out var portName);
|
||||
|
||||
@@ -149,8 +149,7 @@ namespace Netch.Controllers
|
||||
if (invalidList.Any())
|
||||
throw new MessageException(GenerateInvalidRulesMessage(invalidList));
|
||||
|
||||
Dial(NameList.TYPE_ADDNAME, @"NTT\.exe");
|
||||
Dial(NameList.TYPE_BYPNAME, "^" + Global.NetchDir.ToRegexString() + @"((?!NTT\.exe).)*$");
|
||||
Dial(NameList.TYPE_BYPNAME, "^" + Global.NetchDir.ToRegexString());
|
||||
}
|
||||
|
||||
private void CheckCore()
|
||||
@@ -166,8 +165,8 @@ namespace Netch.Controllers
|
||||
var binFileVersion = Utils.Utils.GetFileVersion(Constants.NFDriver);
|
||||
var systemFileVersion = Utils.Utils.GetFileVersion(SystemDriver);
|
||||
|
||||
Log.Information("内置驱动版本: {Name}", binFileVersion);
|
||||
Log.Information("系统驱动版本: {Name}", systemFileVersion);
|
||||
Log.Information("Built-in netfilter2 driver version: {Name}", binFileVersion);
|
||||
Log.Information("Installed netfilter2 driver version: {Name}", systemFileVersion);
|
||||
|
||||
if (!File.Exists(SystemDriver))
|
||||
{
|
||||
@@ -197,7 +196,7 @@ namespace Netch.Controllers
|
||||
if (!reinstall)
|
||||
return;
|
||||
|
||||
Log.Information("更新驱动");
|
||||
Log.Information("Update netfilter2 driver");
|
||||
UninstallDriver();
|
||||
InstallDriver();
|
||||
}
|
||||
@@ -208,7 +207,8 @@ namespace Netch.Controllers
|
||||
/// <returns>驱动是否安装成功</returns>
|
||||
private static void InstallDriver()
|
||||
{
|
||||
Log.Information("安装 NF 驱动");
|
||||
Log.Information("Install netfilter2 driver");
|
||||
Global.MainForm.StatusText(i18N.Translate("Installing netfilter2 driver"));
|
||||
|
||||
if (!File.Exists(Constants.NFDriver))
|
||||
throw new MessageException(i18N.Translate("builtin driver files missing, can't install NF driver"));
|
||||
@@ -219,21 +219,20 @@ namespace Netch.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e, "驱动复制失败\n");
|
||||
throw new MessageException($"Copy NF driver file failed\n{e.Message}");
|
||||
Log.Error(e, "Copy netfilter2.sys failed\n");
|
||||
throw new MessageException($"Copy netfilter2.sys failed\n{e.Message}");
|
||||
}
|
||||
|
||||
Global.MainForm.StatusText(i18N.Translate("Register driver"));
|
||||
// 注册驱动文件
|
||||
var result = NFAPI.nf_registerDriver("netfilter2");
|
||||
if (result == NF_STATUS.NF_STATUS_SUCCESS)
|
||||
{
|
||||
Log.Information("驱动安装成功");
|
||||
Log.Information("Install netfilter2 driver finished");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error("注册驱动失败: {Result}", result);
|
||||
throw new MessageException($"Register NF driver failed\n{result}");
|
||||
Log.Error("Register netfilter2 failed: {Result}", result);
|
||||
throw new MessageException($"Register netfilter2 failed\n{result}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +242,7 @@ namespace Netch.Controllers
|
||||
/// <returns>是否成功卸载</returns>
|
||||
public static bool UninstallDriver()
|
||||
{
|
||||
Log.Information("卸载 NF 驱动");
|
||||
Log.Information("Uninstall netfilter2");
|
||||
try
|
||||
{
|
||||
if (NFService.Status == ServiceControllerStatus.Running)
|
||||
|
||||
@@ -125,8 +125,8 @@ namespace Netch.Controllers
|
||||
|
||||
var binHash = Utils.Utils.SHA256CheckSum(binDriver);
|
||||
var sysHash = Utils.Utils.SHA256CheckSum(sysDriver);
|
||||
Log.Information("自带 wintun.dll Hash: {Hash}", binHash);
|
||||
Log.Information("系统 wintun.dll Hash: {Hash}", sysHash);
|
||||
Log.Information("Built-in wintun.dll Hash: {Hash}", binHash);
|
||||
Log.Information("Installed wintun.dll Hash: {Hash}", sysHash);
|
||||
if (binHash == sysHash)
|
||||
return;
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Netch.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e, "复制 wintun.dll 异常");
|
||||
Log.Error(e, "Copy wintun.dll failed");
|
||||
throw new MessageException($"Failed to copy wintun.dll to system directory: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,24 +48,24 @@ namespace Netch.Controllers
|
||||
|
||||
var releases = JsonSerializer.Deserialize<List<Release>>(json)!;
|
||||
LatestRelease = GetLatestRelease(releases, isPreRelease);
|
||||
Log.Information("Github 最新发布版本: {Version}", LatestRelease.tag_name);
|
||||
Log.Information("Github latest release: {Version}", LatestRelease.tag_name);
|
||||
if (VersionUtil.CompareVersion(LatestRelease.tag_name, Version) > 0)
|
||||
{
|
||||
Log.Information("发现新版本");
|
||||
Log.Information("Found newer version");
|
||||
NewVersionFound?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Information("目前是最新版本");
|
||||
Log.Information("Already the latest version");
|
||||
NewVersionNotFound?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e is WebException)
|
||||
Log.Warning(e, "获取新版本失败");
|
||||
Log.Warning(e, "Get releases failed");
|
||||
else
|
||||
Log.Error(e, "获取新版本异常");
|
||||
Log.Error(e, "Get releases error");
|
||||
|
||||
NewVersionFoundFailed?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user