Compare commits

..

No commits in common. "43c95422b7451d1de9bf0b84ef5260ed1c2d5931" and "77b15cd5300cf32ba544801328a1deedc681d850" have entirely different histories.

39 changed files with 244 additions and 259 deletions

View file

@ -135,7 +135,7 @@
return await SQLiteHelper.Instance.TableAsync<SubItem>().OrderBy(t => t.Sort).ToListAsync(); return await SQLiteHelper.Instance.TableAsync<SubItem>().OrderBy(t => t.Sort).ToListAsync();
} }
public async Task<SubItem?> GetSubItem(string? subid) public async Task<SubItem?> GetSubItem(string subid)
{ {
return await SQLiteHelper.Instance.TableAsync<SubItem>().FirstOrDefaultAsync(t => t.Id == subid); return await SQLiteHelper.Instance.TableAsync<SubItem>().FirstOrDefaultAsync(t => t.Id == subid);
} }

View file

@ -45,8 +45,6 @@ namespace ServiceLib.Handler
{ {
AutoStartTaskService(autoRunName, "", ""); AutoStartTaskService(autoRunName, "", "");
} }
await Task.CompletedTask;
} }
private static async Task SetTaskWindows() private static async Task SetTaskWindows()
@ -68,7 +66,6 @@ namespace ServiceLib.Handler
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
await Task.CompletedTask;
} }
/// <summary> /// <summary>
@ -130,7 +127,6 @@ namespace ServiceLib.Handler
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
await Task.CompletedTask;
} }
private static async Task SetTaskLinux() private static async Task SetTaskLinux()

View file

@ -94,7 +94,10 @@ namespace ServiceLib.Handler
EnableTun = false, EnableTun = false,
Mtu = 9000, Mtu = 9000,
}; };
config.GuiItem ??= new(); config.GuiItem ??= new()
{
EnableStatistics = false,
};
config.MsgUIItem ??= new(); config.MsgUIItem ??= new();
config.UiItem ??= new UIItem() config.UiItem ??= new UIItem()
@ -159,7 +162,7 @@ namespace ServiceLib.Handler
Length = "100-200", Length = "100-200",
Interval = "10-20" Interval = "10-20"
}; };
if (config.SystemProxyItem.SystemProxyExceptions.IsNullOrEmpty()) if (config.SystemProxyItem.SystemProxyExceptions.IsNullOrEmpty())
{ {
config.SystemProxyItem.SystemProxyExceptions = Utils.IsWindows() ? Global.SystemProxyExceptionsWindows : Global.SystemProxyExceptionsLinux; config.SystemProxyItem.SystemProxyExceptions = Utils.IsWindows() ? Global.SystemProxyExceptionsWindows : Global.SystemProxyExceptionsLinux;
@ -469,7 +472,7 @@ namespace ServiceLib.Handler
} }
ProfileExHandler.Instance.SetSort(lstProfile[index].IndexId, sort); ProfileExHandler.Instance.SetSort(lstProfile[index].IndexId, sort);
return await Task.FromResult(0); return 0;
} }
/// <summary> /// <summary>
@ -1047,7 +1050,7 @@ namespace ServiceLib.Handler
Port = node.PreSocksPort.Value, Port = node.PreSocksPort.Value,
}; };
} }
await Task.CompletedTask;
return itemSocks; return itemSocks;
} }
@ -1617,7 +1620,7 @@ namespace ServiceLib.Handler
break; break;
} }
} }
return await Task.FromResult(0); return 0;
} }
public static async Task<int> SetDefaultRouting(Config config, RoutingItem routingItem) public static async Task<int> SetDefaultRouting(Config config, RoutingItem routingItem)

View file

@ -80,7 +80,7 @@
ret.Msg = string.Format(ResUI.SuccessfulConfiguration, ""); ret.Msg = string.Format(ResUI.SuccessfulConfiguration, "");
ret.Success = true; ret.Success = true;
return await Task.FromResult(ret); return ret;
} }
catch (Exception ex) catch (Exception ex)
{ {

View file

@ -52,146 +52,144 @@
private void InitCoreInfo() private void InitCoreInfo()
{ {
_coreInfo = _coreInfo = [];
[
new CoreInfo
{
CoreType = ECoreType.v2rayN,
Url = Global.NUrl,
ReleaseApiUrl = Global.NUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
DownloadUrlWin64 = Global.NUrl + "/download/{0}/v2rayN-windows-64.zip",
DownloadUrlWinArm64 = Global.NUrl + "/download/{0}/v2rayN-windows-arm64.zip",
DownloadUrlLinux64 = Global.NUrl + "/download/{0}/v2rayN-linux-64.zip",
DownloadUrlLinuxArm64 = Global.NUrl + "/download/{0}/v2rayN-linux-arm64.zip",
DownloadUrlOSX64 = Global.NUrl + "/download/{0}/v2rayN-macos-64.zip",
DownloadUrlOSXArm64 = Global.NUrl + "/download/{0}/v2rayN-macos-arm64.zip",
},
new CoreInfo _coreInfo.Add(new CoreInfo
{ {
CoreType = ECoreType.v2fly, CoreType = ECoreType.v2rayN,
CoreExes = ["wv2ray", "v2ray"], Url = Global.NUrl,
Arguments = "", ReleaseApiUrl = Global.NUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
Url = Global.V2flyCoreUrl, DownloadUrlWin64 = Global.NUrl + "/download/{0}/v2rayN-windows-64.zip",
ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), DownloadUrlWinArm64 = Global.NUrl + "/download/{0}/v2rayN-windows-arm64.zip",
Match = "V2Ray", DownloadUrlLinux64 = Global.NUrl + "/download/{0}/v2rayN-linux-64.zip",
VersionArg = "-version", DownloadUrlLinuxArm64 = Global.NUrl + "/download/{0}/v2rayN-linux-arm64.zip",
RedirectInfo = true, DownloadUrlOSX64 = Global.NUrl + "/download/{0}/v2rayN-macos-64.zip",
}, DownloadUrlOSXArm64 = Global.NUrl + "/download/{0}/v2rayN-macos-arm64.zip",
});
new CoreInfo _coreInfo.Add(new CoreInfo
{ {
CoreType = ECoreType.v2fly_v5, CoreType = ECoreType.v2fly,
CoreExes = ["v2ray"], CoreExes = new List<string> { "wv2ray", "v2ray" },
Arguments = "run -c config.json -format jsonv5", Arguments = "",
Url = Global.V2flyCoreUrl, Url = Global.V2flyCoreUrl,
ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
Match = "V2Ray", Match = "V2Ray",
VersionArg = "version", VersionArg = "-version",
RedirectInfo = true, RedirectInfo = true,
}, });
new CoreInfo _coreInfo.Add(new CoreInfo
{ {
CoreType = ECoreType.Xray, CoreType = ECoreType.v2fly_v5,
CoreExes = ["xray", "wxray"], CoreExes = new List<string> { "v2ray" },
Arguments = "run -c {0}", Arguments = "run -c config.json -format jsonv5",
Url = Global.XrayCoreUrl, Url = Global.V2flyCoreUrl,
ReleaseApiUrl = Global.XrayCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
DownloadUrlWin64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-64.zip", Match = "V2Ray",
DownloadUrlWinArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-arm64-v8a.zip", VersionArg = "version",
DownloadUrlLinux64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-64.zip", RedirectInfo = true,
DownloadUrlLinuxArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-arm64-v8a.zip", });
DownloadUrlOSX64 = Global.XrayCoreUrl + "/download/{0}/Xray-macos-64.zip",
DownloadUrlOSXArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-macos-arm64-v8a.zip",
Match = "Xray",
VersionArg = "-version",
RedirectInfo = true,
},
new CoreInfo _coreInfo.Add(new CoreInfo
{ {
CoreType = ECoreType.mihomo, CoreType = ECoreType.Xray,
CoreExes = ["mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-linux-amd64", "mihomo", "clash"], CoreExes = new List<string> { "xray", "wxray" },
Arguments = "-f config.json" + PortableMode(), Arguments = "run -c {0}",
Url = Global.MihomoCoreUrl, Url = Global.XrayCoreUrl,
ReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), ReleaseApiUrl = Global.XrayCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
DownloadUrlWin64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip", DownloadUrlWin64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-64.zip",
DownloadUrlWinArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip", DownloadUrlWinArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-arm64-v8a.zip",
DownloadUrlLinux64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-amd64-compatible-{0}.gz", DownloadUrlLinux64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-64.zip",
DownloadUrlLinuxArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-arm64-{0}.gz", DownloadUrlLinuxArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-arm64-v8a.zip",
DownloadUrlOSX64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-darwin-amd64-compatible-{0}.gz", DownloadUrlOSX64 = Global.XrayCoreUrl + "/download/{0}/Xray-macos-64.zip",
DownloadUrlOSXArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-darwin-arm64-{0}.gz", DownloadUrlOSXArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-macos-arm64-v8a.zip",
Match = "Mihomo", Match = "Xray",
VersionArg = "-v", VersionArg = "-version",
RedirectInfo = true, RedirectInfo = true,
}, });
new CoreInfo _coreInfo.Add(new CoreInfo
{ {
CoreType = ECoreType.hysteria, CoreType = ECoreType.mihomo,
CoreExes = ["hysteria-windows-amd64", "hysteria"], CoreExes = new List<string> { "mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-linux-amd64", "mihomo", "clash" },
Arguments = "", Arguments = "-f config.json" + PortableMode(),
Url = Global.HysteriaCoreUrl, Url = Global.MihomoCoreUrl,
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), ReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
RedirectInfo = true, DownloadUrlWin64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
}, DownloadUrlWinArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
DownloadUrlLinux64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-amd64-compatible-{0}.gz",
DownloadUrlLinuxArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-arm64-{0}.gz",
DownloadUrlOSX64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-darwin-amd64-compatible-{0}.gz",
DownloadUrlOSXArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-darwin-arm64-{0}.gz",
Match = "Mihomo",
VersionArg = "-v",
RedirectInfo = true,
});
new CoreInfo _coreInfo.Add(new CoreInfo
{ {
CoreType = ECoreType.naiveproxy, CoreType = ECoreType.hysteria,
CoreExes = ["naiveproxy", "naive"], CoreExes = new List<string> { "hysteria-windows-amd64", "hysteria" },
Arguments = "config.json", Arguments = "",
Url = Global.NaiveproxyCoreUrl, Url = Global.HysteriaCoreUrl,
RedirectInfo = false, ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
}, RedirectInfo = true,
});
new CoreInfo _coreInfo.Add(new CoreInfo
{ {
CoreType = ECoreType.tuic, CoreType = ECoreType.naiveproxy,
CoreExes = ["tuic-client", "tuic"], CoreExes = new List<string> { "naiveproxy", "naive" },
Arguments = "-c config.json", Arguments = "config.json",
Url = Global.TuicCoreUrl, Url = Global.NaiveproxyCoreUrl,
RedirectInfo = true, RedirectInfo = false,
}, });
new CoreInfo _coreInfo.Add(new CoreInfo
{ {
CoreType = ECoreType.sing_box, CoreType = ECoreType.tuic,
CoreExes = ["sing-box-client", "sing-box"], CoreExes = new List<string> { "tuic-client", "tuic" },
Arguments = "run -c {0} --disable-color", Arguments = "-c config.json",
Url = Global.SingboxCoreUrl, Url = Global.TuicCoreUrl,
RedirectInfo = true, RedirectInfo = true,
ReleaseApiUrl = Global.SingboxCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), });
DownloadUrlWin64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
DownloadUrlWinArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-arm64.zip",
DownloadUrlLinux64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-amd64.tar.gz",
DownloadUrlLinuxArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-arm64.tar.gz",
DownloadUrlOSX64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-darwin-amd64.tar.gz",
DownloadUrlOSXArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-darwin-arm64.tar.gz",
Match = "sing-box",
VersionArg = "version",
},
new CoreInfo _coreInfo.Add(new CoreInfo
{ {
CoreType = ECoreType.juicity, CoreType = ECoreType.sing_box,
CoreExes = ["juicity-client", "juicity"], CoreExes = new List<string> { "sing-box-client", "sing-box" },
Arguments = "run -c config.json", Arguments = "run -c {0} --disable-color",
Url = Global.JuicityCoreUrl Url = Global.SingboxCoreUrl,
}, RedirectInfo = true,
ReleaseApiUrl = Global.SingboxCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
DownloadUrlWin64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
DownloadUrlWinArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-arm64.zip",
DownloadUrlLinux64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-amd64.tar.gz",
DownloadUrlLinuxArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-arm64.tar.gz",
DownloadUrlOSX64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-darwin-amd64.tar.gz",
DownloadUrlOSXArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-darwin-arm64.tar.gz",
Match = "sing-box",
VersionArg = "version",
});
new CoreInfo _coreInfo.Add(new CoreInfo
{ {
CoreType = ECoreType.hysteria2, CoreType = ECoreType.juicity,
CoreExes = ["hysteria-windows-amd64", "hysteria-linux-amd64", "hysteria"], CoreExes = new List<string> { "juicity-client", "juicity" },
Arguments = "", Arguments = "run -c config.json",
Url = Global.HysteriaCoreUrl, Url = Global.JuicityCoreUrl
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), });
RedirectInfo = true,
}
]; _coreInfo.Add(new CoreInfo
{
CoreType = ECoreType.hysteria2,
CoreExes = new List<string> { "hysteria-windows-amd64", "hysteria-linux-amd64", "hysteria" },
Arguments = "",
Url = Global.HysteriaCoreUrl,
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
RedirectInfo = true,
});
} }
private string PortableMode() private string PortableMode()

View file

@ -20,7 +20,7 @@ namespace ServiceLib.Handler
public async Task Init() public async Task Init()
{ {
await InitData(); await InitData();
_ = Task.Run(async () => Task.Run(async () =>
{ {
while (true) while (true)
{ {
@ -32,7 +32,7 @@ namespace ServiceLib.Handler
public async Task<ConcurrentBag<ProfileExItem>> GetProfileExs() public async Task<ConcurrentBag<ProfileExItem>> GetProfileExs()
{ {
return await Task.FromResult(_lstProfileEx); return _lstProfileEx;
} }
private async Task InitData() private async Task InitData()

View file

@ -19,13 +19,15 @@
{ {
_config = config; _config = config;
_updateFunc = updateFunc; _updateFunc = updateFunc;
if (config.GuiItem.EnableStatistics || _config.GuiItem.DisplayRealTimeSpeed) if (!config.GuiItem.EnableStatistics)
{ {
await InitData(); return;
_statisticsXray = new StatisticsXrayService(config, UpdateServerStatHandler);
_statisticsSingbox = new StatisticsSingboxService(config, UpdateServerStatHandler);
} }
await InitData();
_statisticsXray = new StatisticsXrayService(config, UpdateServerStatHandler);
_statisticsSingbox = new StatisticsSingboxService(config, UpdateServerStatHandler);
} }
public void Close() public void Close()
@ -70,7 +72,7 @@
return; return;
} }
if (indexId == toIndexId) if(indexId == toIndexId)
{ {
return; return;
} }
@ -99,7 +101,7 @@
private void UpdateServerStatHandler(ServerSpeedItem server) private void UpdateServerStatHandler(ServerSpeedItem server)
{ {
_ = UpdateServerStat(server); UpdateServerStat(server);
} }
private async Task UpdateServerStat(ServerSpeedItem server) private async Task UpdateServerStat(ServerSpeedItem server)

View file

@ -29,7 +29,7 @@
public string? destinationPort { get; set; } public string? destinationPort { get; set; }
public string? host { get; set; } public string? host { get; set; }
public string? nsMode { get; set; } public string? nsMode { get; set; }
public object? uid { get; set; } public object uid { get; set; }
public string? process { get; set; } public string? process { get; set; }
public string? processPath { get; set; } public string? processPath { get; set; }
public string? remoteDestination { get; set; } public string? remoteDestination { get; set; }

View file

@ -67,13 +67,21 @@
public class GUIItem public class GUIItem
{ {
public bool AutoRun { get; set; } public bool AutoRun { get; set; }
public bool EnableStatistics { get; set; } public bool EnableStatistics { get; set; }
public bool DisplayRealTimeSpeed { get; set; }
public bool KeepOlderDedupl { get; set; } public bool KeepOlderDedupl { get; set; }
public bool IgnoreGeoUpdateCore { get; set; } = true;
public int AutoUpdateInterval { get; set; } public int AutoUpdateInterval { get; set; }
public bool EnableSecurityProtocolTls13 { get; set; } public bool EnableSecurityProtocolTls13 { get; set; }
public int TrayMenuServersLimit { get; set; } = 20; public int TrayMenuServersLimit { get; set; } = 20;
public bool EnableHWA { get; set; } = false; public bool EnableHWA { get; set; } = false;
public bool EnableLog { get; set; } = true; public bool EnableLog { get; set; } = true;
} }

View file

@ -2914,15 +2914,6 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Display real-time speed 的本地化字符串。
/// </summary>
public static string TbSettingsDisplayRealTimeSpeed {
get {
return ResourceManager.GetString("TbSettingsDisplayRealTimeSpeed", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Outbound DNS address 的本地化字符串。 /// 查找类似 Outbound DNS address 的本地化字符串。
/// </summary> /// </summary>
@ -3121,6 +3112,15 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Ignore Geo files when updating core 的本地化字符串。
/// </summary>
public static string TbSettingsIgnoreGeoUpdateCore {
get {
return ResourceManager.GetString("TbSettingsIgnoreGeoUpdateCore", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Keep older when deduplication 的本地化字符串。 /// 查找类似 Keep older when deduplication 的本地化字符串。
/// </summary> /// </summary>
@ -3401,7 +3401,7 @@ namespace ServiceLib.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 Enable traffic statistics (Require restart) 的本地化字符串。 /// 查找类似 Enable Statistics (Require restart) 的本地化字符串。
/// </summary> /// </summary>
public static string TbSettingsStatistics { public static string TbSettingsStatistics {
get { get {

View file

@ -718,8 +718,8 @@
<data name="TbSettingsHttpPort" xml:space="preserve"> <data name="TbSettingsHttpPort" xml:space="preserve">
<value>پورت Http</value> <value>پورت Http</value>
</data> </data>
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve"> <data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
<value>Display real-time speed</value> <value>هنگام به‌روزرسانی هسته، فایل‌های Geo را نادیده بگیرید</value>
</data> </data>
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve"> <data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
<value>هنگام کپی برداری، نگه داری قدیمی تر ها</value> <value>هنگام کپی برداری، نگه داری قدیمی تر ها</value>
@ -1393,4 +1393,4 @@
<data name="menuCopyProxyCmdToClipboard" xml:space="preserve"> <data name="menuCopyProxyCmdToClipboard" xml:space="preserve">
<value>کپی کردن دستور پروکسی در کلیپ بورد</value> <value>کپی کردن دستور پروکسی در کلیپ بورد</value>
</data> </data>
</root> </root>

View file

@ -718,8 +718,8 @@
<data name="TbSettingsHttpPort" xml:space="preserve"> <data name="TbSettingsHttpPort" xml:space="preserve">
<value>HTTP Port</value> <value>HTTP Port</value>
</data> </data>
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve"> <data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
<value>Display real-time speed</value> <value>Geo fájlok figyelmen kívül hagyása a yalap frissítésekor</value>
</data> </data>
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve"> <data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
<value>Régi megőrzése a deduplikáció során</value> <value>Régi megőrzése a deduplikáció során</value>

View file

@ -718,8 +718,8 @@
<data name="TbSettingsHttpPort" xml:space="preserve"> <data name="TbSettingsHttpPort" xml:space="preserve">
<value>HTTP Port</value> <value>HTTP Port</value>
</data> </data>
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve"> <data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
<value>Display real-time speed (Require restart)</value> <value>Ignore Geo files when updating core</value>
</data> </data>
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve"> <data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
<value>Keep older when deduplication</value> <value>Keep older when deduplication</value>
@ -755,7 +755,7 @@
<value>Start on boot</value> <value>Start on boot</value>
</data> </data>
<data name="TbSettingsStatistics" xml:space="preserve"> <data name="TbSettingsStatistics" xml:space="preserve">
<value>Enable traffic statistics (Require restart)</value> <value>Enable Statistics (Require restart)</value>
</data> </data>
<data name="TbSettingsSubConvert" xml:space="preserve"> <data name="TbSettingsSubConvert" xml:space="preserve">
<value>Subscription conversion URL</value> <value>Subscription conversion URL</value>

View file

@ -724,8 +724,8 @@
<data name="TbSettingsHttpPort" xml:space="preserve"> <data name="TbSettingsHttpPort" xml:space="preserve">
<value>HTTP порт</value> <value>HTTP порт</value>
</data> </data>
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve"> <data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
<value>Display real-time speed</value> <value>Игнорировать файлы Geo при обновлении ядра</value>
</data> </data>
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve"> <data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
<value>Сохранить старые при удалении дублей</value> <value>Сохранить старые при удалении дублей</value>

View file

@ -718,8 +718,8 @@
<data name="TbSettingsHttpPort" xml:space="preserve"> <data name="TbSettingsHttpPort" xml:space="preserve">
<value>本地http监听端口</value> <value>本地http监听端口</value>
</data> </data>
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve"> <data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
<value>显示实时速度(需重启)</value> <value>更新Core时忽略Geo文件</value>
</data> </data>
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve"> <data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
<value>去重时保留序号较小的项</value> <value>去重时保留序号较小的项</value>
@ -755,7 +755,7 @@
<value>开机启动(可能会不成功)</value> <value>开机启动(可能会不成功)</value>
</data> </data>
<data name="TbSettingsStatistics" xml:space="preserve"> <data name="TbSettingsStatistics" xml:space="preserve">
<value>启用流量统计(需重启)</value> <value>启用统计(实时网速显示,需重启)</value>
</data> </data>
<data name="TbSettingsSubConvert" xml:space="preserve"> <data name="TbSettingsSubConvert" xml:space="preserve">
<value>订阅转换网址(可选)</value> <value>订阅转换网址(可选)</value>

View file

@ -719,8 +719,8 @@
<data name="TbSettingsHttpPort" xml:space="preserve"> <data name="TbSettingsHttpPort" xml:space="preserve">
<value>本機HTTP偵聽埠</value> <value>本機HTTP偵聽埠</value>
</data> </data>
<data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve"> <data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve">
<value>顯示即時速度(需重啟)</value> <value>更新Core時忽略Geo檔案</value>
</data> </data>
<data name="TbSettingsKeepOlderDedupl" xml:space="preserve"> <data name="TbSettingsKeepOlderDedupl" xml:space="preserve">
<value>去重時保留序號較小的項</value> <value>去重時保留序號較小的項</value>
@ -756,7 +756,7 @@
<value>開機啟動(可能會不成功)</value> <value>開機啟動(可能會不成功)</value>
</data> </data>
<data name="TbSettingsStatistics" xml:space="preserve"> <data name="TbSettingsStatistics" xml:space="preserve">
<value>啟用流量統計(需重啟)</value> <value>啟用統計(即時網速顯示,需重啟)</value>
</data> </data>
<data name="TbSettingsSubConvert" xml:space="preserve"> <data name="TbSettingsSubConvert" xml:space="preserve">
<value>訂閱轉換網址(可選)</value> <value>訂閱轉換網址(可選)</value>

View file

@ -2,7 +2,7 @@
"servers": [ "servers": [
{ {
"tag": "remote", "tag": "remote",
"address": "tcp://8.8.8.8", "address": "8.8.8.8",
"strategy": "prefer_ipv4", "strategy": "prefer_ipv4",
"detour": "proxy" "detour": "proxy"
}, },
@ -32,4 +32,4 @@
} }
], ],
"final": "remote" "final": "remote"
} }

View file

@ -2,7 +2,7 @@
"servers": [ "servers": [
{ {
"tag": "remote", "tag": "remote",
"address": "tcp://8.8.8.8", "address": "8.8.8.8",
"strategy": "prefer_ipv4", "strategy": "prefer_ipv4",
"detour": "proxy" "detour": "proxy"
}, },
@ -33,4 +33,4 @@
} }
], ],
"final": "remote" "final": "remote"
} }

View file

@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>7.6.2</Version> <Version>7.6.1</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -476,7 +476,7 @@ namespace ServiceLib.Services.CoreConfig
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
return await Task.FromResult(0); return 0;
} }
private async Task<int> GenInbounds(SingboxConfig singboxConfig) private async Task<int> GenInbounds(SingboxConfig singboxConfig)
@ -721,7 +721,7 @@ namespace ServiceLib.Services.CoreConfig
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
return await Task.FromResult(0); return 0;
} }
private async Task<int> GenOutboundTls(ProfileItem node, Outbound4Sbox outbound) private async Task<int> GenOutboundTls(ProfileItem node, Outbound4Sbox outbound)
@ -771,7 +771,7 @@ namespace ServiceLib.Services.CoreConfig
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
return await Task.FromResult(0); return 0;
} }
private async Task<int> GenOutboundTransport(ProfileItem node, Outbound4Sbox outbound) private async Task<int> GenOutboundTransport(ProfileItem node, Outbound4Sbox outbound)
@ -848,7 +848,7 @@ namespace ServiceLib.Services.CoreConfig
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
return await Task.FromResult(0); return 0;
} }
private async Task<int> GenMoreOutbounds(ProfileItem node, SingboxConfig singboxConfig) private async Task<int> GenMoreOutbounds(ProfileItem node, SingboxConfig singboxConfig)
@ -1088,7 +1088,7 @@ namespace ServiceLib.Services.CoreConfig
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
return await Task.FromResult(0); return 0;
} }
private bool ParseV2Domain(string domain, Rule4Sbox rule) private bool ParseV2Domain(string domain, Rule4Sbox rule)
@ -1240,7 +1240,7 @@ namespace ServiceLib.Services.CoreConfig
} }
singboxConfig.dns = dns4Sbox; singboxConfig.dns = dns4Sbox;
return await Task.FromResult(0); return 0;
} }
private async Task<int> GenExperimental(SingboxConfig singboxConfig) private async Task<int> GenExperimental(SingboxConfig singboxConfig)
@ -1264,7 +1264,7 @@ namespace ServiceLib.Services.CoreConfig
}; };
} }
return await Task.FromResult(0); return 0;
} }
private async Task<int> ConvertGeo2Ruleset(SingboxConfig singboxConfig) private async Task<int> ConvertGeo2Ruleset(SingboxConfig singboxConfig)

View file

@ -379,7 +379,7 @@ namespace ServiceLib.Services.CoreConfig
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
return await Task.FromResult(0); return 0;
} }
private async Task<int> GenInbounds(V2rayConfig v2rayConfig) private async Task<int> GenInbounds(V2rayConfig v2rayConfig)
@ -423,7 +423,7 @@ namespace ServiceLib.Services.CoreConfig
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
return await Task.FromResult(0); return 0;
} }
private Inbounds4Ray GetInbound(InItem inItem, EInboundProtocol protocol, bool bSocks) private Inbounds4Ray GetInbound(InItem inItem, EInboundProtocol protocol, bool bSocks)
@ -560,7 +560,7 @@ namespace ServiceLib.Services.CoreConfig
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
return await Task.FromResult(0); return 0;
} }
private async Task<int> GenOutbound(ProfileItem node, Outbounds4Ray outbound) private async Task<int> GenOutbound(ProfileItem node, Outbounds4Ray outbound)
@ -774,7 +774,7 @@ namespace ServiceLib.Services.CoreConfig
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
return await Task.FromResult(0); return 0;
} }
private async Task<int> GenBoundStreamSettings(ProfileItem node, Outbounds4Ray outbound) private async Task<int> GenBoundStreamSettings(ProfileItem node, Outbounds4Ray outbound)
@ -1103,12 +1103,12 @@ namespace ServiceLib.Services.CoreConfig
servers.AsArray().Add(JsonUtils.SerializeToNode(dnsServer)); servers.AsArray().Add(JsonUtils.SerializeToNode(dnsServer));
} }
} }
return await Task.FromResult(0); return 0;
} }
private async Task<int> GenStatistic(V2rayConfig v2rayConfig) private async Task<int> GenStatistic(V2rayConfig v2rayConfig)
{ {
if (_config.GuiItem.EnableStatistics || _config.GuiItem.DisplayRealTimeSpeed) if (_config.GuiItem.EnableStatistics)
{ {
string tag = EInboundProtocol.api.ToString(); string tag = EInboundProtocol.api.ToString();
Metrics4Ray apiObj = new(); Metrics4Ray apiObj = new();
@ -1150,7 +1150,7 @@ namespace ServiceLib.Services.CoreConfig
v2rayConfig.routing.rules.Add(apiRoutingRule); v2rayConfig.routing.rules.Add(apiRoutingRule);
} }
} }
return await Task.FromResult(0); return 0;
} }
private async Task<int> GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConfig) private async Task<int> GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConfig)

View file

@ -25,7 +25,6 @@ namespace ServiceLib.ViewModels
BrowseServerCmd = ReactiveCommand.CreateFromTask(async () => BrowseServerCmd = ReactiveCommand.CreateFromTask(async () =>
{ {
_updateView?.Invoke(EViewAction.BrowseServer, null); _updateView?.Invoke(EViewAction.BrowseServer, null);
await Task.CompletedTask;
}); });
EditServerCmd = ReactiveCommand.CreateFromTask(async () => EditServerCmd = ReactiveCommand.CreateFromTask(async () =>
{ {
@ -110,7 +109,6 @@ namespace ServiceLib.ViewModels
{ {
NoticeHandler.Instance.Enqueue(ResUI.FailedReadConfiguration); NoticeHandler.Instance.Enqueue(ResUI.FailedReadConfiguration);
} }
await Task.CompletedTask;
} }
} }
} }

View file

@ -176,7 +176,7 @@ namespace ServiceLib.ViewModels
FileManager.CopyDirectory(configDir, configDirTemp, false, "cache.db"); FileManager.CopyDirectory(configDir, configDirTemp, false, "cache.db");
var ret = FileManager.CreateFromDirectory(configDirZipTemp, fileName); var ret = FileManager.CreateFromDirectory(configDirZipTemp, fileName);
Directory.Delete(configDirZipTemp, true); Directory.Delete(configDirZipTemp, true);
return await Task.FromResult(ret); return ret;
} }
} }
} }

View file

@ -259,7 +259,7 @@ namespace ServiceLib.ViewModels
} }
else else
{ {
FileManager.ZipExtractToFile(fileName, toPath, "geo"); FileManager.ZipExtractToFile(fileName, toPath, _config.GuiItem.IgnoreGeoUpdateCore ? "geo" : "");
} }
if (Utils.IsNonWindows()) if (Utils.IsNonWindows())

View file

@ -48,7 +48,7 @@ namespace ServiceLib.ViewModels
await ClashConnectionClose(true); await ClashConnectionClose(true);
}); });
_ = Init(); Init();
} }
private async Task Init() private async Task Init()
@ -73,7 +73,6 @@ namespace ServiceLib.ViewModels
Task.Delay(1000).Wait(); Task.Delay(1000).Wait();
} }
}); });
await Task.CompletedTask;
} }
private async Task GetClashConnections() private async Task GetClashConnections()

View file

@ -90,13 +90,13 @@ namespace ServiceLib.ViewModels
y => y == true) y => y == true)
.Subscribe(c => { _config.ClashUIItem.ProxiesAutoRefresh = AutoRefresh; }); .Subscribe(c => { _config.ClashUIItem.ProxiesAutoRefresh = AutoRefresh; });
_ = Init(); Init();
} }
private async Task Init() private async Task Init()
{ {
await ProxiesReload(); await ProxiesReload();
_ = DelayTestTask(); DelayTestTask();
} }
private async Task DoRulemodeSelected(bool c) private async Task DoRulemodeSelected(bool c)
@ -265,7 +265,7 @@ namespace ServiceLib.ViewModels
return; return;
} }
_proxies.TryGetValue(name, out var proxy); _proxies.TryGetValue(name, out ProxiesItem proxy);
if (proxy == null || proxy.all == null) if (proxy == null || proxy.all == null)
{ {
return; return;
@ -316,7 +316,7 @@ namespace ServiceLib.ViewModels
{ {
if (_proxies is null) if (_proxies is null)
return null; return null;
_proxies.TryGetValue(name, out var proxy2); _proxies.TryGetValue(name, out ProxiesItem proxy2);
if (proxy2 != null) if (proxy2 != null)
{ {
return proxy2; return proxy2;
@ -399,7 +399,6 @@ namespace ServiceLib.ViewModels
_updateView?.Invoke(EViewAction.DispatcherProxiesDelayTest, new SpeedTestResult() { IndexId = item.Name, Delay = result }); _updateView?.Invoke(EViewAction.DispatcherProxiesDelayTest, new SpeedTestResult() { IndexId = item.Name, Delay = result });
}); });
await Task.CompletedTask;
} }
public void ProxiesDelayTestResult(SpeedTestResult result) public void ProxiesDelayTestResult(SpeedTestResult result)
@ -435,7 +434,7 @@ namespace ServiceLib.ViewModels
public async Task DelayTestTask() public async Task DelayTestTask()
{ {
var lastTime = DateTime.Now; var lastTime = DateTime.Now;
_ = Task.Run(async () => Task.Run(async () =>
{ {
while (true) while (true)
{ {
@ -458,7 +457,6 @@ namespace ServiceLib.ViewModels
lastTime = dtNow; lastTime = dtNow;
} }
}); });
await Task.CompletedTask;
} }
#endregion task #endregion task

View file

@ -32,17 +32,15 @@ namespace ServiceLib.ViewModels
ImportDefConfig4V2rayCmd = ReactiveCommand.CreateFromTask(async () => ImportDefConfig4V2rayCmd = ReactiveCommand.CreateFromTask(async () =>
{ {
normalDNS = Utils.GetEmbedText(Global.DNSV2rayNormalFileName); normalDNS = Utils.GetEmbedText(Global.DNSV2rayNormalFileName);
await Task.CompletedTask;
}); });
ImportDefConfig4SingboxCmd = ReactiveCommand.CreateFromTask(async () => ImportDefConfig4SingboxCmd = ReactiveCommand.CreateFromTask(async () =>
{ {
normalDNS2 = Utils.GetEmbedText(Global.DNSSingboxNormalFileName); normalDNS2 = Utils.GetEmbedText(Global.DNSSingboxNormalFileName);
tunDNS2 = Utils.GetEmbedText(Global.TunSingboxDNSFileName); tunDNS2 = Utils.GetEmbedText(Global.TunSingboxDNSFileName);
await Task.CompletedTask;
}); });
_ = Init(); Init();
} }
private async Task Init() private async Task Init()

View file

@ -206,7 +206,7 @@ namespace ServiceLib.ViewModels
#endregion WhenAnyValue && ReactiveCommand #endregion WhenAnyValue && ReactiveCommand
_ = Init(); Init();
} }
private async Task Init() private async Task Init()
@ -219,7 +219,7 @@ namespace ServiceLib.ViewModels
await CoreHandler.Instance.Init(_config, UpdateHandler); await CoreHandler.Instance.Init(_config, UpdateHandler);
TaskHandler.Instance.RegUpdateTask(_config, UpdateTaskHandler); TaskHandler.Instance.RegUpdateTask(_config, UpdateTaskHandler);
if (_config.GuiItem.EnableStatistics || _config.GuiItem.DisplayRealTimeSpeed) if (_config.GuiItem.EnableStatistics)
{ {
await StatisticsHandler.Instance.Init(_config, UpdateStatisticsHandler); await StatisticsHandler.Instance.Init(_config, UpdateStatisticsHandler);
} }
@ -252,7 +252,7 @@ namespace ServiceLib.ViewModels
RefreshServers(); RefreshServers();
if (indexIdOld != _config.IndexId) if (indexIdOld != _config.IndexId)
{ {
_ = Reload(); Reload();
} }
if (_config.UiItem.EnableAutoAdjustMainLvColWidth) if (_config.UiItem.EnableAutoAdjustMainLvColWidth)
{ {
@ -272,13 +272,16 @@ namespace ServiceLib.ViewModels
public void SetStatisticsResult(ServerSpeedItem update) public void SetStatisticsResult(ServerSpeedItem update)
{ {
if (_config.GuiItem.DisplayRealTimeSpeed) try
{ {
Locator.Current.GetService<StatusBarViewModel>()?.UpdateStatistics(update); Locator.Current.GetService<StatusBarViewModel>()?.UpdateStatistics(update);
if ((update.ProxyUp + update.ProxyDown) > 0 && DateTime.Now.Second % 9 == 0)
{
Locator.Current.GetService<ProfilesViewModel>()?.UpdateStatistics(update);
}
} }
if (_config.GuiItem.EnableStatistics && (update.ProxyUp + update.ProxyDown) > 0 && DateTime.Now.Second % 9 == 0) catch
{ {
Locator.Current.GetService<ProfilesViewModel>()?.UpdateStatistics(update);
} }
} }
@ -403,7 +406,6 @@ namespace ServiceLib.ViewModels
public async Task AddServerViaScanAsync() public async Task AddServerViaScanAsync()
{ {
_updateView?.Invoke(EViewAction.ScanScreenTask, null); _updateView?.Invoke(EViewAction.ScanScreenTask, null);
await Task.CompletedTask;
} }
public async Task ScanScreenResult(byte[]? bytes) public async Task ScanScreenResult(byte[]? bytes)
@ -415,7 +417,6 @@ namespace ServiceLib.ViewModels
public async Task AddServerViaImageAsync() public async Task AddServerViaImageAsync()
{ {
_updateView?.Invoke(EViewAction.ScanImageTask, null); _updateView?.Invoke(EViewAction.ScanImageTask, null);
await Task.CompletedTask;
} }
public async Task ScanImageResult(string fileName) public async Task ScanImageResult(string fileName)
@ -529,7 +530,6 @@ namespace ServiceLib.ViewModels
{ {
ProcUtils.ProcessStart("open", path); ProcUtils.ProcessStart("open", path);
} }
await Task.CompletedTask;
} }
#endregion Setting #endregion Setting
@ -548,8 +548,8 @@ namespace ServiceLib.ViewModels
BlReloadEnabled = false; BlReloadEnabled = false;
await LoadCore(); await LoadCore();
await SysProxyHandler.UpdateSysProxy(_config, false);
Locator.Current.GetService<StatusBarViewModel>()?.TestServerAvailability(); Locator.Current.GetService<StatusBarViewModel>()?.TestServerAvailability();
await SysProxyHandler.UpdateSysProxy(_config, false);
_updateView?.Invoke(EViewAction.DispatcherReload, null); _updateView?.Invoke(EViewAction.DispatcherReload, null);
@ -591,7 +591,6 @@ namespace ServiceLib.ViewModels
{ {
ShowHideWindow(false); ShowHideWindow(false);
} }
await Task.CompletedTask;
} }
#endregion core job #endregion core job

View file

@ -105,7 +105,6 @@ namespace ServiceLib.ViewModels
{ {
_queueMsg.Enqueue(Environment.NewLine); _queueMsg.Enqueue(Environment.NewLine);
} }
await Task.CompletedTask;
} }
public void ClearMsg() public void ClearMsg()

View file

@ -49,7 +49,7 @@ namespace ServiceLib.ViewModels
[Reactive] public bool AutoRun { get; set; } [Reactive] public bool AutoRun { get; set; }
[Reactive] public bool EnableStatistics { get; set; } [Reactive] public bool EnableStatistics { get; set; }
[Reactive] public bool KeepOlderDedupl { get; set; } [Reactive] public bool KeepOlderDedupl { get; set; }
[Reactive] public bool DisplayRealTimeSpeed { get; set; } [Reactive] public bool IgnoreGeoUpdateCore { get; set; }
[Reactive] public bool EnableAutoAdjustMainLvColWidth { get; set; } [Reactive] public bool EnableAutoAdjustMainLvColWidth { get; set; }
[Reactive] public bool EnableUpdateSubOnlyRemarksExist { get; set; } [Reactive] public bool EnableUpdateSubOnlyRemarksExist { get; set; }
[Reactive] public bool EnableSecurityProtocolTls13 { get; set; } [Reactive] public bool EnableSecurityProtocolTls13 { get; set; }
@ -115,7 +115,7 @@ namespace ServiceLib.ViewModels
await SaveSettingAsync(); await SaveSettingAsync();
}); });
_ = Init(); Init();
} }
private async Task Init() private async Task Init()
@ -164,8 +164,8 @@ namespace ServiceLib.ViewModels
AutoRun = _config.GuiItem.AutoRun; AutoRun = _config.GuiItem.AutoRun;
EnableStatistics = _config.GuiItem.EnableStatistics; EnableStatistics = _config.GuiItem.EnableStatistics;
DisplayRealTimeSpeed = _config.GuiItem.DisplayRealTimeSpeed;
KeepOlderDedupl = _config.GuiItem.KeepOlderDedupl; KeepOlderDedupl = _config.GuiItem.KeepOlderDedupl;
IgnoreGeoUpdateCore = _config.GuiItem.IgnoreGeoUpdateCore;
EnableAutoAdjustMainLvColWidth = _config.UiItem.EnableAutoAdjustMainLvColWidth; EnableAutoAdjustMainLvColWidth = _config.UiItem.EnableAutoAdjustMainLvColWidth;
EnableUpdateSubOnlyRemarksExist = _config.UiItem.EnableUpdateSubOnlyRemarksExist; EnableUpdateSubOnlyRemarksExist = _config.UiItem.EnableUpdateSubOnlyRemarksExist;
EnableSecurityProtocolTls13 = _config.GuiItem.EnableSecurityProtocolTls13; EnableSecurityProtocolTls13 = _config.GuiItem.EnableSecurityProtocolTls13;
@ -261,7 +261,6 @@ namespace ServiceLib.ViewModels
break; break;
} }
}); });
await Task.CompletedTask;
} }
private async Task SaveSettingAsync() private async Task SaveSettingAsync()
@ -273,7 +272,6 @@ namespace ServiceLib.ViewModels
return; return;
} }
var needReboot = (EnableStatistics != _config.GuiItem.EnableStatistics var needReboot = (EnableStatistics != _config.GuiItem.EnableStatistics
|| DisplayRealTimeSpeed != _config.GuiItem.DisplayRealTimeSpeed
|| EnableDragDropSort != _config.UiItem.EnableDragDropSort || EnableDragDropSort != _config.UiItem.EnableDragDropSort
|| EnableHWA != _config.GuiItem.EnableHWA || EnableHWA != _config.GuiItem.EnableHWA
|| CurrentFontFamily != _config.UiItem.CurrentFontFamily || CurrentFontFamily != _config.UiItem.CurrentFontFamily
@ -319,8 +317,8 @@ namespace ServiceLib.ViewModels
_config.GuiItem.AutoRun = AutoRun; _config.GuiItem.AutoRun = AutoRun;
_config.GuiItem.EnableStatistics = EnableStatistics; _config.GuiItem.EnableStatistics = EnableStatistics;
_config.GuiItem.DisplayRealTimeSpeed = DisplayRealTimeSpeed;
_config.GuiItem.KeepOlderDedupl = KeepOlderDedupl; _config.GuiItem.KeepOlderDedupl = KeepOlderDedupl;
_config.GuiItem.IgnoreGeoUpdateCore = IgnoreGeoUpdateCore;
_config.UiItem.EnableAutoAdjustMainLvColWidth = EnableAutoAdjustMainLvColWidth; _config.UiItem.EnableAutoAdjustMainLvColWidth = EnableAutoAdjustMainLvColWidth;
_config.UiItem.EnableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist; _config.UiItem.EnableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist;
_config.GuiItem.EnableSecurityProtocolTls13 = EnableSecurityProtocolTls13; _config.GuiItem.EnableSecurityProtocolTls13 = EnableSecurityProtocolTls13;
@ -412,7 +410,6 @@ namespace ServiceLib.ViewModels
} }
item.CoreType = (ECoreType)Enum.Parse(typeof(ECoreType), type); item.CoreType = (ECoreType)Enum.Parse(typeof(ECoreType), type);
} }
await Task.CompletedTask;
} }
} }
} }

View file

@ -231,7 +231,7 @@ namespace ServiceLib.ViewModels
MessageBus.Current.Listen<string>(EMsgCommand.RefreshProfiles.ToString()).Subscribe(OnNext); MessageBus.Current.Listen<string>(EMsgCommand.RefreshProfiles.ToString()).Subscribe(OnNext);
} }
_ = Init(); Init();
} }
private async Task Init() private async Task Init()

View file

@ -257,7 +257,7 @@ namespace ServiceLib.ViewModels
return; return;
} }
var result = Utils.LoadResource(fileName); string result = Utils.LoadResource(fileName);
if (Utils.IsNullOrEmpty(result)) if (Utils.IsNullOrEmpty(result))
{ {
return; return;

View file

@ -67,7 +67,7 @@ namespace ServiceLib.ViewModels
await SaveRoutingAsync(); await SaveRoutingAsync();
}); });
_ = Init(); Init();
} }
private async Task Init() private async Task Init()

View file

@ -137,7 +137,6 @@ namespace ServiceLib.ViewModels
NotifyLeftClickCmd = ReactiveCommand.CreateFromTask(async () => NotifyLeftClickCmd = ReactiveCommand.CreateFromTask(async () =>
{ {
Locator.Current.GetService<MainWindowViewModel>()?.ShowHideWindow(null); Locator.Current.GetService<MainWindowViewModel>()?.ShowHideWindow(null);
await Task.CompletedTask;
}); });
AddServerViaClipboardCmd = ReactiveCommand.CreateFromTask(async () => AddServerViaClipboardCmd = ReactiveCommand.CreateFromTask(async () =>
@ -181,7 +180,7 @@ namespace ServiceLib.ViewModels
{ {
InitUpdateView(updateView); InitUpdateView(updateView);
} }
_ = Init(); Init();
} }
private async Task Init() private async Task Init()
@ -479,19 +478,12 @@ namespace ServiceLib.ViewModels
{ {
InboundLanDisplay = $"{ResUI.LabLAN}:{Global.None}"; InboundLanDisplay = $"{ResUI.LabLAN}:{Global.None}";
} }
await Task.CompletedTask;
} }
public void UpdateStatistics(ServerSpeedItem update) public void UpdateStatistics(ServerSpeedItem update)
{ {
try SpeedProxyDisplay = string.Format(ResUI.SpeedDisplayText, Global.ProxyTag, Utils.HumanFy(update.ProxyUp), Utils.HumanFy(update.ProxyDown));
{ SpeedDirectDisplay = string.Format(ResUI.SpeedDisplayText, Global.DirectTag, Utils.HumanFy(update.DirectUp), Utils.HumanFy(update.DirectDown));
SpeedProxyDisplay = string.Format(ResUI.SpeedDisplayText, Global.ProxyTag, Utils.HumanFy(update.ProxyUp), Utils.HumanFy(update.ProxyDown));
SpeedDirectDisplay = string.Format(ResUI.SpeedDisplayText, Global.DirectTag, Utils.HumanFy(update.DirectUp), Utils.HumanFy(update.DirectDown));
}
catch
{
}
} }
#endregion UI #endregion UI

View file

@ -48,7 +48,7 @@ namespace ServiceLib.ViewModels
await _updateView?.Invoke(EViewAction.ShareSub, SelectedSource?.Url); await _updateView?.Invoke(EViewAction.ShareSub, SelectedSource?.Url);
}, canEditRemove); }, canEditRemove);
_ = Init(); Init();
} }
private async Task Init() private async Task Init()

View file

@ -385,9 +385,9 @@
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsDisplayRealTimeSpeed}" /> Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" />
<ToggleSwitch <ToggleSwitch
x:Name="togDisplayRealTimeSpeed" x:Name="togKeepOlderDedupl"
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
@ -398,9 +398,9 @@
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" /> Text="{x:Static resx:ResUI.TbSettingsIgnoreGeoUpdateCore}" />
<ToggleSwitch <ToggleSwitch
x:Name="togKeepOlderDedupl" x:Name="togIgnoreGeoUpdateCore"
Grid.Row="4" Grid.Row="4"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"

View file

@ -126,8 +126,8 @@ namespace v2rayN.Desktop.Views
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.DisplayRealTimeSpeed, v => v.togDisplayRealTimeSpeed.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.IgnoreGeoUpdateCore, v => v.togIgnoreGeoUpdateCore.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables);

View file

@ -601,9 +601,9 @@
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsDisplayRealTimeSpeed}" /> Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" />
<ToggleButton <ToggleButton
x:Name="togDisplayRealTimeSpeed" x:Name="togKeepOlderDedupl"
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
@ -615,9 +615,9 @@
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" /> Text="{x:Static resx:ResUI.TbSettingsIgnoreGeoUpdateCore}" />
<ToggleButton <ToggleButton
x:Name="togKeepOlderDedupl" x:Name="togIgnoreGeoUpdateCore"
Grid.Row="4" Grid.Row="4"
Grid.Column="1" Grid.Column="1"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"

View file

@ -136,8 +136,8 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.DisplayRealTimeSpeed, v => v.togDisplayRealTimeSpeed.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.IgnoreGeoUpdateCore, v => v.togIgnoreGeoUpdateCore.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables);
@ -248,9 +248,7 @@ namespace v2rayN.Views
{ {
Logging.SaveLog("GetFonts", ex); Logging.SaveLog("GetFonts", ex);
} }
return lstFonts.OrderBy(t => t).ToList();
var lst = lstFonts.OrderBy(t => t).ToList();
return await Task.FromResult(lst);
} }
private void ClbdestOverride_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) private void ClbdestOverride_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)