Compare commits

..

No commits in common. "8ea5a57988e7e40b95fdff547541b3f19b2607a5" and "3f0bcf7b836e8245d099986daff1aa4a0ffebb03" have entirely different histories.

12 changed files with 28 additions and 80 deletions

View file

@ -425,7 +425,7 @@ public class Utils
var domain = authority; var domain = authority;
// Handle IPv6 addresses, e.g., "[2001:db8::1]:443" // Handle IPv6 addresses, e.g., "[2001:db8::1]:443"
if (authority.StartsWith('[') && authority.Contains(']')) if (authority.StartsWith("[") && authority.Contains("]"))
{ {
var closingBracketIndex = authority.LastIndexOf(']'); var closingBracketIndex = authority.LastIndexOf(']');
if (closingBracketIndex < authority.Length - 1 && authority[closingBracketIndex + 1] == ':') if (closingBracketIndex < authority.Length - 1 && authority[closingBracketIndex + 1] == ':')

View file

@ -45,18 +45,18 @@ public class SocksFmt : BaseFmt
}; };
result = result[Global.ProtocolShares[EConfigType.SOCKS].Length..]; result = result[Global.ProtocolShares[EConfigType.SOCKS].Length..];
//remark //remark
var indexRemark = result.IndexOf('#'); var indexRemark = result.IndexOf("#");
if (indexRemark > 0) if (indexRemark > 0)
{ {
try try
{ {
item.Remarks = Utils.UrlDecode(result.Substring(indexRemark + 1)); item.Remarks = Utils.UrlDecode(result.Substring(indexRemark + 1, result.Length - indexRemark - 1));
} }
catch { } catch { }
result = result[..indexRemark]; result = result[..indexRemark];
} }
//part decode //part decode
var indexS = result.IndexOf('@'); var indexS = result.IndexOf("@");
if (indexS > 0) if (indexS > 0)
{ {
} }

View file

@ -2355,15 +2355,6 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Press ESC to terminate the test 的本地化字符串。
/// </summary>
public static string SpeedtestingPressEscToExit {
get {
return ResourceManager.GetString("SpeedtestingPressEscToExit", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Skip test 的本地化字符串。 /// 查找类似 Skip test 的本地化字符串。
/// </summary> /// </summary>
@ -2392,7 +2383,7 @@ namespace ServiceLib.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 Waiting... 的本地化字符串。 /// 查找类似 Waiting for testing (press ESC to terminate)... 的本地化字符串。
/// </summary> /// </summary>
public static string SpeedtestingWait { public static string SpeedtestingWait {
get { get {

View file

@ -976,10 +976,7 @@
<value>فعال‌ سازی شتاب‌ دهنده سخت‌ افزاری (نیاز به راه‌اندازی مجدد)</value> <value>فعال‌ سازی شتاب‌ دهنده سخت‌ افزاری (نیاز به راه‌اندازی مجدد)</value>
</data> </data>
<data name="SpeedtestingWait" xml:space="preserve"> <data name="SpeedtestingWait" xml:space="preserve">
<value>در انتظار آزمایش...</value> <value>در انتظار آزمایش (برای پایان دادن به ESC فشار دهید)...</value>
</data>
<data name="SpeedtestingPressEscToExit" xml:space="preserve">
<value>برای پایان دادن به ESC فشار دهید</value>
</data> </data>
<data name="TipDisplayLog" xml:space="preserve"> <data name="TipDisplayLog" xml:space="preserve">
<value>لطفاً در صورت قطع غیرعادی آن را خاموش کنید</value> <value>لطفاً در صورت قطع غیرعادی آن را خاموش کنید</value>

View file

@ -976,10 +976,7 @@
<value>Activer laccélération matérielle (redémarrage requis)</value> <value>Activer laccélération matérielle (redémarrage requis)</value>
</data> </data>
<data name="SpeedtestingWait" xml:space="preserve"> <data name="SpeedtestingWait" xml:space="preserve">
<value>En attente du test...</value> <value>En attente du test (appuyer sur Échap pour arrêter)...</value>
</data>
<data name="SpeedtestingPressEscToExit" xml:space="preserve">
<value>Appuyer sur Échap pour arrêter</value>
</data> </data>
<data name="TipDisplayLog" xml:space="preserve"> <data name="TipDisplayLog" xml:space="preserve">
<value>Désactiver cette option si coupure anormale</value> <value>Désactiver cette option si coupure anormale</value>

View file

@ -976,10 +976,7 @@
<value>Hardveres gyorsítás engedélyezése (újraindítást igényel)</value> <value>Hardveres gyorsítás engedélyezése (újraindítást igényel)</value>
</data> </data>
<data name="SpeedtestingWait" xml:space="preserve"> <data name="SpeedtestingWait" xml:space="preserve">
<value>Tesztelésre vár...</value> <value>Tesztelésre vár (ESC megnyomásával megszakítható)...</value>
</data>
<data name="SpeedtestingPressEscToExit" xml:space="preserve">
<value>ESC megnyomásával megszakítható</value>
</data> </data>
<data name="TipDisplayLog" xml:space="preserve"> <data name="TipDisplayLog" xml:space="preserve">
<value>Kérjük, kapcsolja ki rendellenes megszakadás esetén</value> <value>Kérjük, kapcsolja ki rendellenes megszakadás esetén</value>

View file

@ -976,10 +976,7 @@
<value>Enable hardware acceleration (requires restart)</value> <value>Enable hardware acceleration (requires restart)</value>
</data> </data>
<data name="SpeedtestingWait" xml:space="preserve"> <data name="SpeedtestingWait" xml:space="preserve">
<value>Waiting...</value> <value>Waiting for testing (press ESC to terminate)...</value>
</data>
<data name="SpeedtestingPressEscToExit" xml:space="preserve">
<value>Press ESC to terminate the test</value>
</data> </data>
<data name="TipDisplayLog" xml:space="preserve"> <data name="TipDisplayLog" xml:space="preserve">
<value>Please turn off when there is an abnormal disconnection</value> <value>Please turn off when there is an abnormal disconnection</value>

View file

@ -976,10 +976,7 @@
<value>Включить аппаратное ускорение (требуется перезагрузка)</value> <value>Включить аппаратное ускорение (требуется перезагрузка)</value>
</data> </data>
<data name="SpeedtestingWait" xml:space="preserve"> <data name="SpeedtestingWait" xml:space="preserve">
<value>Ожидание тестирования…</value> <value>Ожидание тестирования (нажмите ESC для отмены)…</value>
</data>
<data name="SpeedtestingPressEscToExit" xml:space="preserve">
<value>нажмите ESC для отмены</value>
</data> </data>
<data name="TipDisplayLog" xml:space="preserve"> <data name="TipDisplayLog" xml:space="preserve">
<value>Отключите при аномальном разрыве соединения</value> <value>Отключите при аномальном разрыве соединения</value>

View file

@ -976,10 +976,7 @@
<value>启用硬件加速 (需重启)</value> <value>启用硬件加速 (需重启)</value>
</data> </data>
<data name="SpeedtestingWait" xml:space="preserve"> <data name="SpeedtestingWait" xml:space="preserve">
<value>等待测试...</value> <value>等待测试中 (按 ESC 终止)...</value>
</data>
<data name="SpeedtestingPressEscToExit" xml:space="preserve">
<value>按 ESC 可终止测试</value>
</data> </data>
<data name="TipDisplayLog" xml:space="preserve"> <data name="TipDisplayLog" xml:space="preserve">
<value>当有异常断流时请关闭</value> <value>当有异常断流时请关闭</value>

View file

@ -976,10 +976,7 @@
<value>啟用硬體加速 (需重啟)</value> <value>啟用硬體加速 (需重啟)</value>
</data> </data>
<data name="SpeedtestingWait" xml:space="preserve"> <data name="SpeedtestingWait" xml:space="preserve">
<value>等待測試中...</value> <value>等待測試中(按 ESC 終止)...</value>
</data>
<data name="SpeedtestingPressEscToExit" xml:space="preserve">
<value>按 ECS 以終止測試</value>
</data> </data>
<data name="TipDisplayLog" xml:space="preserve"> <data name="TipDisplayLog" xml:space="preserve">
<value>當有異常斷流時請關閉</value> <value>當有異常斷流時請關閉</value>

View file

@ -300,7 +300,7 @@ public partial class CoreConfigSingboxService
private bool ParseV2Domain(string domain, Rule4Sbox rule) private bool ParseV2Domain(string domain, Rule4Sbox rule)
{ {
if (domain.StartsWith('#') || domain.StartsWith("ext:") || domain.StartsWith("ext-domain:")) if (domain.StartsWith("#") || domain.StartsWith("ext:") || domain.StartsWith("ext-domain:"))
{ {
return false; return false;
} }

View file

@ -19,7 +19,7 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
public void ExitLoop() public void ExitLoop()
{ {
if (!_lstExitLoop.IsEmpty) if (_lstExitLoop.Count > 0)
{ {
_ = UpdateFunc("", ResUI.SpeedtestingStop); _ = UpdateFunc("", ResUI.SpeedtestingStop);
@ -27,11 +27,6 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
} }
} }
private static bool ShouldStopTest(string exitLoopKey)
{
return !_lstExitLoop.Any(p => p == exitLoopKey);
}
private async Task RunAsync(ESpeedActionType actionType, List<ProfileItem> selecteds) private async Task RunAsync(ESpeedActionType actionType, List<ProfileItem> selecteds)
{ {
var exitLoopKey = Utils.GetGuid(false); var exitLoopKey = Utils.GetGuid(false);
@ -108,11 +103,6 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
} }
} }
if (lstSelected.Count > 1 && (actionType == ESpeedActionType.Speedtest || actionType == ESpeedActionType.Mixedtest))
{
NoticeManager.Instance.Enqueue(ResUI.SpeedtestingPressEscToExit);
}
return lstSelected; return lstSelected;
} }
@ -162,7 +152,7 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
var pageSizeNext = pageSize / 2; var pageSizeNext = pageSize / 2;
if (lstFailed.Count > 0 && pageSizeNext > 0) if (lstFailed.Count > 0 && pageSizeNext > 0)
{ {
if (ShouldStopTest(exitLoopKey)) if (_lstExitLoop.Any(p => p == exitLoopKey) == false)
{ {
await UpdateFunc("", ResUI.SpeedtestingSkip); await UpdateFunc("", ResUI.SpeedtestingSkip);
return; return;
@ -200,12 +190,6 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
{ {
continue; continue;
} }
if (ShouldStopTest(exitLoopKey))
{
return false;
}
tasks.Add(Task.Run(async () => tasks.Add(Task.Run(async () =>
{ {
await DoRealPing(it); await DoRealPing(it);
@ -234,7 +218,7 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
List<Task> tasks = new(); List<Task> tasks = new();
foreach (var it in selecteds) foreach (var it in selecteds)
{ {
if (ShouldStopTest(exitLoopKey)) if (_lstExitLoop.Any(p => p == exitLoopKey) == false)
{ {
await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip); await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
continue; continue;
@ -250,27 +234,21 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
if (processService is null) if (processService is null)
{ {
await UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore); await UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore);
return;
} }
else
await Task.Delay(1000);
var delay = await DoRealPing(it);
if (blSpeedTest)
{ {
if (ShouldStopTest(exitLoopKey)) await Task.Delay(1000);
var delay = await DoRealPing(it);
if (blSpeedTest)
{ {
await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip); if (delay > 0)
return; {
} await DoSpeedTest(downloadHandle, it);
}
if (delay > 0) else
{ {
await DoSpeedTest(downloadHandle, it); await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
} }
else
{
await UpdateFunc(it.IndexId, "", ResUI.SpeedtestingSkip);
} }
} }
} }