Merge branch '2dust:master' into Fix

This commit is contained in:
DecorativeFamily 2024-11-02 11:47:40 +03:30 committed by GitHub
commit e5b5c141eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 21 additions and 23 deletions

View file

@ -5,6 +5,7 @@
ClearMsg,
SendMsgView,
SendSnackMsg,
RefreshProfiles
RefreshProfiles,
StopSpeedtest
}
}

View file

@ -1,7 +1,7 @@
using System.Diagnostics;
using ReactiveUI;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
namespace ServiceLib.Services
{
public class SpeedtestService
@ -80,10 +80,12 @@ namespace ServiceLib.Services
Task.Run(RunMixedtestAsync);
break;
}
MessageBus.Current.Listen<string>(EMsgCommand.StopSpeedtest.ToString()).Subscribe(ExitLoop);
}
public void ExitLoop()
private void ExitLoop(string x)
{
if(_exitLoop) return;
_exitLoop = true;
UpdateFunc("", ResUI.SpeedtestingStop);
}

View file

@ -6,12 +6,10 @@ namespace ServiceLib.Services
public class UpdateService
{
private Action<bool, string>? _updateFunc;
private Config _config;
private int _timeout = 30;
public async Task CheckUpdateGuiN(Config config, Action<bool, string> updateFunc, bool preRelease)
{
_config = config;
_updateFunc = updateFunc;
var url = string.Empty;
var fileName = string.Empty;
@ -53,7 +51,6 @@ namespace ServiceLib.Services
public async Task CheckUpdateCore(ECoreType type, Config config, Action<bool, string> updateFunc, bool preRelease)
{
_config = config;
_updateFunc = updateFunc;
var url = string.Empty;
var fileName = string.Empty;
@ -108,7 +105,6 @@ namespace ServiceLib.Services
public async Task UpdateSubscriptionProcess(Config config, string subId, bool blProxy, Action<bool, string> updateFunc)
{
_config = config;
_updateFunc = updateFunc;
_updateFunc?.Invoke(false, ResUI.MsgUpdateSubscriptionStart);
@ -454,7 +450,6 @@ namespace ServiceLib.Services
private async Task UpdateGeoFile(string geoName, Config config, Action<bool, string> updateFunc)
{
_config = config;
_updateFunc = updateFunc;
var geoUrl = string.IsNullOrEmpty(config?.ConstItem.GeoSourceUrl)
@ -470,7 +465,6 @@ namespace ServiceLib.Services
private async Task UpdateSrsFileAll(Config config, Action<bool, string> updateFunc)
{
_config = config;
_updateFunc = updateFunc;
var geoipFiles = new List<string>();
@ -521,9 +515,9 @@ namespace ServiceLib.Services
private async Task UpdateSrsFile(string type, string srsName, Config config, Action<bool, string> updateFunc)
{
var srsUrl = string.IsNullOrEmpty(_config.ConstItem.SrsSourceUrl)
var srsUrl = string.IsNullOrEmpty(config.ConstItem.SrsSourceUrl)
? Global.SingboxRulesetUrl
: _config.ConstItem.SrsSourceUrl;
: config.ConstItem.SrsSourceUrl;
var fileName = $"{type}-{srsName}.srs";
var targetPath = Path.Combine(Utils.GetBinPath("srss"), fileName);

View file

@ -16,7 +16,6 @@ namespace ServiceLib.ViewModels
private List<ProfileItem> _lstProfile;
private string _serverFilter = string.Empty;
private Dictionary<string, bool> _dicHeaderSort = new();
private SpeedtestService? _speedtestHandler;
#endregion private prop
@ -686,12 +685,13 @@ namespace ServiceLib.ViewModels
}
//ClearTestResult();
_speedtestHandler = new SpeedtestService(_config, lstSelecteds, actionType, UpdateSpeedtestHandler);
_ = new SpeedtestService(_config, lstSelecteds, actionType, UpdateSpeedtestHandler);
}
public void ServerSpeedtestStop()
{
_speedtestHandler?.ExitLoop();
MessageBus.Current.SendMessage("", EMsgCommand.StopSpeedtest.ToString());
}
private async Task Export2ClientConfigAsync(bool blClipboard)

View file

@ -83,6 +83,7 @@
Classes="TextArea"
IsReadOnly="True"
TextAlignment="Left"
VerticalAlignment="Stretch"
TextWrapping="Wrap">
<TextBox.ContextMenu>
<ContextMenu>

View file

@ -20,16 +20,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.1.4" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.1.4" />
<PackageReference Include="Avalonia.Desktop" Version="11.1.4" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.4" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.4" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.1.4" />
<PackageReference Include="Avalonia" Version="11.2.0" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.2.0" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.0" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.2.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.2.0" />
<PackageReference Include="DialogHost.Avalonia" Version="0.8.1" />
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
<PackageReference Include="Semi.Avalonia" Version="11.1.0.4" />
<PackageReference Include="Semi.Avalonia.DataGrid" Version="11.1.0.4" />
<PackageReference Include="Semi.Avalonia" Version="11.2.0" />
<PackageReference Include="Semi.Avalonia.DataGrid" Version="11.2.0" />
<PackageReference Include="ReactiveUI" Version="20.1.63" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
</ItemGroup>