Compare commits

..

No commits in common. "06500e0218f524a1653b25f80f64bbc99c8f5f6a" and "c81bc2f53614f0dc4d48c4188a48068d33c43c39" have entirely different histories.

8 changed files with 21 additions and 77 deletions

View file

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Version>7.12.6</Version>
<Version>7.12.5</Version>
</PropertyGroup>
<PropertyGroup>

View file

@ -5,21 +5,21 @@
<CentralPackageVersionOverrideEnabled>false</CentralPackageVersionOverrideEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.3.1" />
<PackageVersion Include="Avalonia.Desktop" Version="11.3.1" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.1" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.3.1" />
<PackageVersion Include="CliWrap" Version="3.9.0" />
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.3.0" />
<PackageVersion Include="Avalonia.Desktop" Version="11.3.0" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.0" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.3.0" />
<PackageVersion Include="CliWrap" Version="3.8.2" />
<PackageVersion Include="Downloader" Version="3.3.4" />
<PackageVersion Include="H.NotifyIcon.Wpf" Version="2.3.0" />
<PackageVersion Include="MaterialDesignThemes" Version="5.2.1" />
<PackageVersion Include="MessageBox.Avalonia" Version="3.2.0" />
<PackageVersion Include="QRCoder" Version="1.6.0" />
<PackageVersion Include="ReactiveUI" Version="20.3.1" />
<PackageVersion Include="ReactiveUI" Version="20.2.45" />
<PackageVersion Include="ReactiveUI.Fody" Version="19.5.41" />
<PackageVersion Include="ReactiveUI.WPF" Version="20.3.1" />
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.8" />
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="11.2.1.8" />
<PackageVersion Include="ReactiveUI.WPF" Version="20.2.45" />
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.7" />
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="11.2.1.7" />
<PackageVersion Include="Splat.NLog" Version="15.3.1" />
<PackageVersion Include="sqlite-net-pcl" Version="1.9.172" />
<PackageVersion Include="TaskScheduler" Version="2.12.1" />

View file

@ -582,7 +582,7 @@ public class Utils
var result = await cmd.ExecuteBufferedAsync();
if (result.IsSuccess)
{
return result.StandardOutput ?? "";
return result.StandardOutput.ToString();
}
Logging.SaveLog(result.ToString() ?? "");
@ -839,46 +839,14 @@ public class Utils
public static async Task<string?> SetLinuxChmod(string? fileName)
{
if (fileName.IsNullOrEmpty())
{
return null;
}
if (SetUnixFileMode(fileName))
{
Logging.SaveLog($"Successfully set the file execution permission, {fileName}");
return "";
}
if (fileName.Contains(' '))
{
fileName = fileName.AppendQuotes();
}
//File.SetUnixFileMode(fileName, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
var arg = new List<string>() { "-c", $"chmod +x {fileName}" };
return await GetCliWrapOutput(Global.LinuxBash, arg);
}
public static bool SetUnixFileMode(string? fileName)
{
try
{
if (fileName.IsNullOrEmpty())
{
return false;
}
if (File.Exists(fileName))
{
var currentMode = File.GetUnixFileMode(fileName);
File.SetUnixFileMode(fileName, currentMode | UnixFileMode.UserExecute | UnixFileMode.GroupExecute | UnixFileMode.OtherExecute);
return true;
}
}
catch (Exception ex)
{
Logging.SaveLog("SetUnixFileMode", ex);
}
return false;
}
public static async Task<string?> GetLinuxFontFamily(string lang)
{
// var arg = new List<string>() { "-c", $"fc-list :lang={lang} family" };

View file

@ -1366,32 +1366,16 @@ public class CoreConfigV2rayService
private async Task<int> GenBalancer(V2rayConfig v2rayConfig, EMultipleLoad multipleLoad)
{
if (multipleLoad == EMultipleLoad.LeastPing)
if (multipleLoad is EMultipleLoad.LeastLoad or EMultipleLoad.LeastPing)
{
var observatory = new Observatory4Ray
{
subjectSelector = [Global.ProxyTag],
probeUrl = AppHandler.Instance.Config.SpeedTestItem.SpeedPingTestUrl,
probeInterval = "3m",
enableConcurrency = true,
probeInterval = "3m"
};
v2rayConfig.observatory = observatory;
}
else if (multipleLoad == EMultipleLoad.LeastLoad)
{
var burstObservatory = new BurstObservatory4Ray
{
subjectSelector = [Global.ProxyTag],
pingConfig = new()
{
destination = AppHandler.Instance.Config.SpeedTestItem.SpeedPingTestUrl,
interval = "5m",
timeout = "30s",
sampling = 2,
}
};
v2rayConfig.burstObservatory = burstObservatory;
}
var strategyType = multipleLoad switch
{
EMultipleLoad.Random => "random",

View file

@ -196,7 +196,6 @@ public class SpeedtestService
{
return false;
}
await Task.Delay(1000);
var downloadHandle = new DownloadService();
@ -256,13 +255,9 @@ public class SpeedtestService
try
{
pid = await CoreHandler.Instance.LoadCoreConfigSpeedtest(it);
if (pid < 0)
if (pid > 0)
{
UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore);
}
else
{
await Task.Delay(1000);
await Task.Delay(500);
var delay = await DoRealPing(downloadHandle, it);
if (blSpeedTest)
{
@ -276,6 +271,10 @@ public class SpeedtestService
}
}
}
else
{
UpdateFunc(it.IndexId, "", ResUI.FailedToRunCore);
}
}
catch (Exception ex)
{

View file

@ -485,12 +485,6 @@ public class UpdateService
private async Task UpdateOtherFiles(Config config, Action<bool, string> updateFunc)
{
//If it is not in China area, no update is required
if (config.ConstItem.GeoSourceUrl.IsNotEmpty())
{
return;
}
_updateFunc = updateFunc;
foreach (var url in Global.OtherGeoUrls)

View file

@ -552,7 +552,6 @@ public class MainWindowViewModel : MyReactiveObject
{
await LoadCore();
await SysProxyHandler.UpdateSysProxy(_config, false);
await Task.Delay(1000);
});
Locator.Current.GetService<StatusBarViewModel>()?.TestServerAvailability();

View file

@ -29,7 +29,7 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
InitializeComponent();
_config = AppHandler.Instance.Config;
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.TopRight };
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.BottomRight };
this.KeyDown += MainWindow_KeyDown;
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click;