Compare commits

...

6 commits

Author SHA1 Message Date
2dust
43c95422b7 up 7.6.2
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release macOS / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run
2025-01-15 19:49:14 +08:00
esmaiel777
2662243641
Update dns_singbox_normal (#6511) 2025-01-15 19:47:45 +08:00
esmaiel777
060a35e091
Update tun_singbox_dns (#6510) 2025-01-15 19:47:34 +08:00
2dust
de1132c2df Added option to display real-time speed 2025-01-15 19:45:53 +08:00
2dust
f19edc9370 Improvements and Adjustments
InitCoreInfo()
2025-01-15 17:31:13 +08:00
2dust
f1601c463b Improvements and Adjustments
await Task.CompletedTask;
return await Task.FromResult(0);
2025-01-15 17:26:15 +08:00
39 changed files with 259 additions and 244 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,6 +45,8 @@ namespace ServiceLib.Handler
{ {
AutoStartTaskService(autoRunName, "", ""); AutoStartTaskService(autoRunName, "", "");
} }
await Task.CompletedTask;
} }
private static async Task SetTaskWindows() private static async Task SetTaskWindows()
@ -66,6 +68,7 @@ namespace ServiceLib.Handler
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
await Task.CompletedTask;
} }
/// <summary> /// <summary>
@ -127,6 +130,7 @@ 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,10 +94,7 @@ 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()
@ -472,7 +469,7 @@ namespace ServiceLib.Handler
} }
ProfileExHandler.Instance.SetSort(lstProfile[index].IndexId, sort); ProfileExHandler.Instance.SetSort(lstProfile[index].IndexId, sort);
return 0; return await Task.FromResult(0);
} }
/// <summary> /// <summary>
@ -1050,7 +1047,7 @@ namespace ServiceLib.Handler
Port = node.PreSocksPort.Value, Port = node.PreSocksPort.Value,
}; };
} }
await Task.CompletedTask;
return itemSocks; return itemSocks;
} }
@ -1620,7 +1617,7 @@ namespace ServiceLib.Handler
break; break;
} }
} }
return 0; return await Task.FromResult(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 ret; return await Task.FromResult(ret);
} }
catch (Exception ex) catch (Exception ex)
{ {

View file

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

View file

@ -19,15 +19,13 @@
{ {
_config = config; _config = config;
_updateFunc = updateFunc; _updateFunc = updateFunc;
if (!config.GuiItem.EnableStatistics) if (config.GuiItem.EnableStatistics || _config.GuiItem.DisplayRealTimeSpeed)
{ {
return; await InitData();
_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()
@ -72,7 +70,7 @@
return; return;
} }
if(indexId == toIndexId) if (indexId == toIndexId)
{ {
return; return;
} }
@ -101,7 +99,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,21 +67,13 @@
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,6 +2914,15 @@ 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>
@ -3112,15 +3121,6 @@ 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 Statistics (Require restart) 的本地化字符串。 /// 查找类似 Enable traffic 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="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve"> <data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
<value>هنگام به‌روزرسانی هسته، فایل‌های Geo را نادیده بگیرید</value> <value>Display real-time speed</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 Port</value> <value>HTTP Port</value>
</data> </data>
<data name="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve"> <data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
<value>Geo fájlok figyelmen kívül hagyása a yalap frissítésekor</value> <value>Display real-time speed</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="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve"> <data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
<value>Ignore Geo files when updating core</value> <value>Display real-time speed (Require restart)</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 Statistics (Require restart)</value> <value>Enable traffic 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="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve"> <data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
<value>Игнорировать файлы Geo при обновлении ядра</value> <value>Display real-time speed</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="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve"> <data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
<value>更新Core时忽略Geo文件</value> <value>显示实时速度(需重启)</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="TbSettingsIgnoreGeoUpdateCore" xml:space="preserve"> <data name="TbSettingsDisplayRealTimeSpeed" xml:space="preserve">
<value>更新Core時忽略Geo檔案</value> <value>顯示即時速度(需重啟)</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": "8.8.8.8", "address": "tcp://8.8.8.8",
"strategy": "prefer_ipv4", "strategy": "prefer_ipv4",
"detour": "proxy" "detour": "proxy"
}, },

View file

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

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.1</Version> <Version>7.6.2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -476,7 +476,7 @@ namespace ServiceLib.Services.CoreConfig
{ {
Logging.SaveLog(_tag, ex); Logging.SaveLog(_tag, ex);
} }
return 0; return await Task.FromResult(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 0; return await Task.FromResult(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 0; return await Task.FromResult(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 0; return await Task.FromResult(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 0; return await Task.FromResult(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 0; return await Task.FromResult(0);
} }
private async Task<int> GenExperimental(SingboxConfig singboxConfig) private async Task<int> GenExperimental(SingboxConfig singboxConfig)
@ -1264,7 +1264,7 @@ namespace ServiceLib.Services.CoreConfig
}; };
} }
return 0; return await Task.FromResult(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 0; return await Task.FromResult(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 0; return await Task.FromResult(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 0; return await Task.FromResult(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 0; return await Task.FromResult(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 0; return await Task.FromResult(0);
} }
private async Task<int> GenStatistic(V2rayConfig v2rayConfig) private async Task<int> GenStatistic(V2rayConfig v2rayConfig)
{ {
if (_config.GuiItem.EnableStatistics) if (_config.GuiItem.EnableStatistics || _config.GuiItem.DisplayRealTimeSpeed)
{ {
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 0; return await Task.FromResult(0);
} }
private async Task<int> GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConfig) private async Task<int> GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConfig)

View file

@ -25,6 +25,7 @@ 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 () =>
{ {
@ -109,6 +110,7 @@ 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 ret; return await Task.FromResult(ret);
} }
} }
} }

View file

@ -259,7 +259,7 @@ namespace ServiceLib.ViewModels
} }
else else
{ {
FileManager.ZipExtractToFile(fileName, toPath, _config.GuiItem.IgnoreGeoUpdateCore ? "geo" : ""); FileManager.ZipExtractToFile(fileName, toPath, "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,6 +73,7 @@ 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 ProxiesItem proxy); _proxies.TryGetValue(name, out var 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 ProxiesItem proxy2); _proxies.TryGetValue(name, out var proxy2);
if (proxy2 != null) if (proxy2 != null)
{ {
return proxy2; return proxy2;
@ -399,6 +399,7 @@ 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)
@ -434,7 +435,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)
{ {
@ -457,6 +458,7 @@ namespace ServiceLib.ViewModels
lastTime = dtNow; lastTime = dtNow;
} }
}); });
await Task.CompletedTask;
} }
#endregion task #endregion task

View file

@ -32,15 +32,17 @@ 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) if (_config.GuiItem.EnableStatistics || _config.GuiItem.DisplayRealTimeSpeed)
{ {
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,16 +272,13 @@ namespace ServiceLib.ViewModels
public void SetStatisticsResult(ServerSpeedItem update) public void SetStatisticsResult(ServerSpeedItem update)
{ {
try if (_config.GuiItem.DisplayRealTimeSpeed)
{ {
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);
}
} }
catch if (_config.GuiItem.EnableStatistics && (update.ProxyUp + update.ProxyDown) > 0 && DateTime.Now.Second % 9 == 0)
{ {
Locator.Current.GetService<ProfilesViewModel>()?.UpdateStatistics(update);
} }
} }
@ -406,6 +403,7 @@ 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)
@ -417,6 +415,7 @@ 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)
@ -530,6 +529,7 @@ 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();
Locator.Current.GetService<StatusBarViewModel>()?.TestServerAvailability();
await SysProxyHandler.UpdateSysProxy(_config, false); await SysProxyHandler.UpdateSysProxy(_config, false);
Locator.Current.GetService<StatusBarViewModel>()?.TestServerAvailability();
_updateView?.Invoke(EViewAction.DispatcherReload, null); _updateView?.Invoke(EViewAction.DispatcherReload, null);
@ -591,6 +591,7 @@ namespace ServiceLib.ViewModels
{ {
ShowHideWindow(false); ShowHideWindow(false);
} }
await Task.CompletedTask;
} }
#endregion core job #endregion core job

View file

@ -105,6 +105,7 @@ 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 IgnoreGeoUpdateCore { get; set; } [Reactive] public bool DisplayRealTimeSpeed { 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,6 +261,7 @@ namespace ServiceLib.ViewModels
break; break;
} }
}); });
await Task.CompletedTask;
} }
private async Task SaveSettingAsync() private async Task SaveSettingAsync()
@ -272,6 +273,7 @@ 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
@ -317,8 +319,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;
@ -410,6 +412,7 @@ 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;
} }
string result = Utils.LoadResource(fileName); var 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,6 +137,7 @@ 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 () =>
@ -180,7 +181,7 @@ namespace ServiceLib.ViewModels
{ {
InitUpdateView(updateView); InitUpdateView(updateView);
} }
Init(); _ = Init();
} }
private async Task Init() private async Task Init()
@ -478,12 +479,19 @@ 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)
{ {
SpeedProxyDisplay = string.Format(ResUI.SpeedDisplayText, Global.ProxyTag, Utils.HumanFy(update.ProxyUp), Utils.HumanFy(update.ProxyDown)); try
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.TbSettingsKeepOlderDedupl}" /> Text="{x:Static resx:ResUI.TbSettingsDisplayRealTimeSpeed}" />
<ToggleSwitch <ToggleSwitch
x:Name="togKeepOlderDedupl" x:Name="togDisplayRealTimeSpeed"
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.TbSettingsIgnoreGeoUpdateCore}" /> Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" />
<ToggleSwitch <ToggleSwitch
x:Name="togIgnoreGeoUpdateCore" x:Name="togKeepOlderDedupl"
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.TbSettingsKeepOlderDedupl}" /> Text="{x:Static resx:ResUI.TbSettingsDisplayRealTimeSpeed}" />
<ToggleButton <ToggleButton
x:Name="togKeepOlderDedupl" x:Name="togDisplayRealTimeSpeed"
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.TbSettingsIgnoreGeoUpdateCore}" /> Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" />
<ToggleButton <ToggleButton
x:Name="togIgnoreGeoUpdateCore" x:Name="togKeepOlderDedupl"
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,7 +248,9 @@ 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)