Add Manager folder

This commit is contained in:
2dust 2025-08-17 16:52:51 +08:00
parent c9c1cd8cbb
commit 2060ac18fd
51 changed files with 57 additions and 28 deletions

View file

@ -3,6 +3,7 @@ global using ServiceLib.Common;
global using ServiceLib.Enums;
global using ServiceLib.Handler;
global using ServiceLib.Helper;
global using ServiceLib.Manager;
global using ServiceLib.Handler.Fmt;
global using ServiceLib.Services;
global using ServiceLib.Services.Statistics;

View file

@ -3,7 +3,7 @@ using System.Text.RegularExpressions;
namespace ServiceLib.Handler;
public class ConfigHandler
public static class ConfigHandler
{
private static readonly string _configRes = Global.ConfigFileName;
private static readonly string _tag = "ConfigHandler";

View file

@ -1,11 +1,8 @@
namespace ServiceLib.Handler;
public class ConnectionHandler
public static class ConnectionHandler
{
private static readonly Lazy<ConnectionHandler> _instance = new(() => new());
public static ConnectionHandler Instance => _instance.Value;
public async Task<string> RunAvailabilityCheck()
public static async Task<string> RunAvailabilityCheck()
{
var downloadHandle = new DownloadService();
var time = await downloadHandle.RunAvailabilityCheck(null);
@ -14,7 +11,7 @@ public class ConnectionHandler
return string.Format(ResUI.TestMeOutput, time, ip);
}
private async Task<string?> GetIPInfo(DownloadService downloadHandle)
private static async Task<string?> GetIPInfo(DownloadService downloadHandle)
{
var url = AppHandler.Instance.Config.SpeedTestItem.IPAPIUrl;
if (url.IsNullOrEmpty())

View file

@ -3,7 +3,7 @@ namespace ServiceLib.Handler;
/// <summary>
/// Core configuration file processing class
/// </summary>
public class CoreConfigHandler
public static class CoreConfigHandler
{
private static readonly string _tag = "CoreConfigHandler";

View file

@ -1,6 +1,6 @@
namespace ServiceLib.Handler;
public class SubscriptionHandler
public static class SubscriptionHandler
{
public static async Task UpdateProcess(Config config, string subId, bool blProxy, Action<bool, string> updateFunc)
{

View file

@ -1,6 +1,6 @@
namespace ServiceLib.Handler.SysProxy;
public class ProxySettingLinux
public static class ProxySettingLinux
{
private static readonly string _proxySetFileName = $"{Global.ProxySetLinuxShellFileName.Replace(Global.NamespaceSample, "")}.sh";

View file

@ -1,6 +1,6 @@
namespace ServiceLib.Handler.SysProxy;
public class ProxySettingOSX
public static class ProxySettingOSX
{
private static readonly string _proxySetFileName = $"{Global.ProxySetOSXShellFileName.Replace(Global.NamespaceSample, "")}.sh";

View file

@ -3,7 +3,7 @@ using static ServiceLib.Handler.SysProxy.ProxySettingWindows.InternetConnectionO
namespace ServiceLib.Handler.SysProxy;
public class ProxySettingWindows
public static class ProxySettingWindows
{
private const string _regPath = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings";

View file

@ -1,4 +1,4 @@
namespace ServiceLib.Handler;
namespace ServiceLib.Manager;
public sealed class AppHandler
{
@ -97,7 +97,7 @@ public sealed class AppHandler
return localPort + (int)protocol;
}
public void AddProcess(IntPtr processHandle)
public void AddProcess(nint processHandle)
{
if (Utils.IsWindows())
{

View file

@ -1,6 +1,6 @@
using static ServiceLib.Models.ClashProxies;
namespace ServiceLib.Handler;
namespace ServiceLib.Manager;
public sealed class ClashApiHandler
{

View file

@ -3,7 +3,7 @@ using System.Text;
using CliWrap;
using CliWrap.Buffered;
namespace ServiceLib.Handler;
namespace ServiceLib.Manager;
public class CoreAdminHandler
{

View file

@ -1,7 +1,7 @@
using System.Diagnostics;
using System.Text;
namespace ServiceLib.Handler;
namespace ServiceLib.Manager;
/// <summary>
/// Core process processing class

View file

@ -1,4 +1,4 @@
namespace ServiceLib.Handler;
namespace ServiceLib.Manager;
public sealed class CoreInfoHandler
{

View file

@ -1,6 +1,6 @@
using ReactiveUI;
namespace ServiceLib.Handler;
namespace ServiceLib.Manager;
public class NoticeHandler
{

View file

@ -1,7 +1,7 @@
using System.Net.Sockets;
using System.Text;
namespace ServiceLib.Handler;
namespace ServiceLib.Manager;
public class PacHandler
{

View file

@ -1,4 +1,4 @@
namespace ServiceLib.Handler;
namespace ServiceLib.Manager;
public class StatisticsHandler
{
@ -91,7 +91,7 @@ public class StatisticsHandler
{
await SQLiteHelper.Instance.ExecuteAsync($"delete from ServerStatItem where indexId not in ( select indexId from ProfileItem )");
long ticks = DateTime.Now.Date.Ticks;
var ticks = DateTime.Now.Date.Ticks;
await SQLiteHelper.Instance.ExecuteAsync($"update ServerStatItem set todayUp = 0,todayDown=0,dateNow={ticks} where dateNow<>{ticks}");
_lstServerStat = await SQLiteHelper.Instance.TableAsync<ServerStatItem>().ToListAsync();
@ -128,7 +128,7 @@ public class StatisticsHandler
private async Task GetServerStatItem(string indexId)
{
long ticks = DateTime.Now.Date.Ticks;
var ticks = DateTime.Now.Date.Ticks;
if (_serverStatItem != null && _serverStatItem.IndexId != indexId)
{
_serverStatItem = null;

View file

@ -1,4 +1,4 @@
namespace ServiceLib.Handler;
namespace ServiceLib.Manager;
public class TaskHandler
{
@ -66,7 +66,7 @@ public class TaskHandler
foreach (var item in lstSubs)
{
await SubscriptionHandler.UpdateProcess(config, item.Id, true, (bool success, string msg) =>
await SubscriptionHandler.UpdateProcess(config, item.Id, true, (success, msg) =>
{
updateFunc?.Invoke(success, msg);
if (success)
@ -87,7 +87,7 @@ public class TaskHandler
Logging.SaveLog("Execute update geo files");
var updateHandle = new UpdateService();
await updateHandle.UpdateGeoFileAll(config, (bool success, string msg) =>
await updateHandle.UpdateGeoFileAll(config, (success, msg) =>
{
updateFunc?.Invoke(false, msg);
});

View file

@ -1,7 +1,7 @@
using System.Net;
using WebDav;
namespace ServiceLib.Handler;
namespace ServiceLib.Manager;
public sealed class WebDavHandler
{

View file

@ -334,7 +334,7 @@ public class StatusBarViewModel : MyReactiveObject
_updateView?.Invoke(EViewAction.DispatcherServerAvailability, ResUI.Speedtesting);
var msg = await Task.Run(ConnectionHandler.Instance.RunAvailabilityCheck);
var msg = await Task.Run(ConnectionHandler.RunAvailabilityCheck);
NoticeHandler.Instance.SendMessageEx(msg);
_updateView?.Invoke(EViewAction.DispatcherServerAvailability, msg);

View file

@ -1,6 +1,7 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using ServiceLib.Manager;
using Splat;
using v2rayN.Desktop.Common;
using v2rayN.Desktop.Views;

View file

@ -1,6 +1,7 @@
using Avalonia;
using Avalonia.Interactivity;
using Avalonia.ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Desktop.Base;

View file

@ -1,5 +1,6 @@
using Avalonia;
using Avalonia.ReactiveUI;
using ServiceLib.Manager;
using v2rayN.Desktop.Common;
namespace v2rayN.Desktop;

View file

@ -8,6 +8,7 @@ using Avalonia.Styling;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using Semi.Avalonia;
using ServiceLib.Manager;
namespace v2rayN.Desktop.ViewModels;

View file

@ -2,6 +2,7 @@ using System.Reactive.Disposables;
using Avalonia.Controls;
using Avalonia.Interactivity;
using ReactiveUI;
using ServiceLib.Manager;
using v2rayN.Desktop.Base;
namespace v2rayN.Desktop.Views;

View file

@ -2,6 +2,7 @@ using System.Reactive.Disposables;
using Avalonia.Controls;
using Avalonia.Interactivity;
using ReactiveUI;
using ServiceLib.Manager;
using v2rayN.Desktop.Base;
namespace v2rayN.Desktop.Views;

View file

@ -1,6 +1,7 @@
using System.Reactive.Disposables;
using Avalonia.Interactivity;
using ReactiveUI;
using ServiceLib.Manager;
using v2rayN.Desktop.Base;
namespace v2rayN.Desktop.Views;

View file

@ -9,6 +9,7 @@ using Avalonia.Threading;
using DialogHostAvalonia;
using MsBox.Avalonia.Enums;
using ReactiveUI;
using ServiceLib.Manager;
using Splat;
using v2rayN.Desktop.Base;
using v2rayN.Desktop.Common;

View file

@ -1,6 +1,7 @@
using System.Reactive.Disposables;
using Avalonia.Controls;
using ReactiveUI;
using ServiceLib.Manager;
using v2rayN.Desktop.Base;
namespace v2rayN.Desktop.Views;

View file

@ -7,6 +7,7 @@ using Avalonia.Threading;
using DialogHostAvalonia;
using MsBox.Avalonia.Enums;
using ReactiveUI;
using ServiceLib.Manager;
using Splat;
using v2rayN.Desktop.Common;

View file

@ -6,6 +6,7 @@ using Avalonia.ReactiveUI;
using Avalonia.Threading;
using DialogHostAvalonia;
using ReactiveUI;
using ServiceLib.Manager;
using Splat;
using v2rayN.Desktop.Common;

View file

@ -2,6 +2,7 @@ using Avalonia.Controls;
using Avalonia.Threading;
using CliWrap.Buffered;
using DialogHostAvalonia;
using ServiceLib.Manager;
namespace v2rayN.Desktop.Views;

View file

@ -1,6 +1,7 @@
using System.Diagnostics;
using System.Windows;
using System.Windows.Threading;
using ServiceLib.Manager;
namespace v2rayN;

View file

@ -1,5 +1,6 @@
using System.Windows;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Base;

View file

@ -1,4 +1,5 @@
using System.Windows.Media;
using ServiceLib.Manager;
namespace v2rayN.Converters;

View file

@ -4,6 +4,7 @@ using System.Text;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using ServiceLib.Manager;
namespace v2rayN.Handler;

View file

@ -9,6 +9,7 @@ using MaterialDesignColors.ColorManipulation;
using MaterialDesignThemes.Wpf;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using ServiceLib.Manager;
namespace v2rayN.ViewModels;

View file

@ -1,6 +1,7 @@
using System.Reactive.Disposables;
using System.Windows;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Views;

View file

@ -2,6 +2,7 @@ using System.Reactive.Disposables;
using System.Windows;
using System.Windows.Controls;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Views;

View file

@ -1,6 +1,7 @@
using System.Reactive.Disposables;
using System.Windows;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Views;

View file

@ -1,6 +1,7 @@
using System.Reactive.Disposables;
using System.Windows;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Views;

View file

@ -4,6 +4,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using ReactiveUI;
using ServiceLib.Manager;
using v2rayN.Handler;
namespace v2rayN.Views;

View file

@ -8,6 +8,7 @@ using System.Windows.Media;
using System.Windows.Threading;
using MaterialDesignThemes.Wpf;
using ReactiveUI;
using ServiceLib.Manager;
using Splat;
using v2rayN.Handler;

View file

@ -4,6 +4,7 @@ using System.Reactive.Disposables;
using System.Windows;
using System.Windows.Media;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Views;

View file

@ -7,6 +7,7 @@ using System.Windows.Media;
using System.Windows.Threading;
using MaterialDesignThemes.Wpf;
using ReactiveUI;
using ServiceLib.Manager;
using Splat;
using v2rayN.Base;
using Point = System.Windows.Point;

View file

@ -1,6 +1,7 @@
using System.Reactive.Disposables;
using System.Windows;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Views;

View file

@ -2,6 +2,7 @@ using System.Reactive.Disposables;
using System.Windows;
using System.Windows.Input;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Views;

View file

@ -2,6 +2,7 @@ using System.Reactive.Disposables;
using System.Windows;
using System.Windows.Input;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Views;

View file

@ -3,6 +3,7 @@ using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using ReactiveUI;
using ServiceLib.Manager;
using Splat;
using v2rayN.Handler;

View file

@ -1,6 +1,7 @@
using System.Reactive.Disposables;
using System.Windows;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Views;

View file

@ -4,6 +4,7 @@ using System.Windows;
using System.Windows.Input;
using MaterialDesignThemes.Wpf;
using ReactiveUI;
using ServiceLib.Manager;
namespace v2rayN.Views;