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.Enums;
global using ServiceLib.Handler; global using ServiceLib.Handler;
global using ServiceLib.Helper; global using ServiceLib.Helper;
global using ServiceLib.Manager;
global using ServiceLib.Handler.Fmt; global using ServiceLib.Handler.Fmt;
global using ServiceLib.Services; global using ServiceLib.Services;
global using ServiceLib.Services.Statistics; global using ServiceLib.Services.Statistics;

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
namespace ServiceLib.Handler.SysProxy; namespace ServiceLib.Handler.SysProxy;
public class ProxySettingOSX public static class ProxySettingOSX
{ {
private static readonly string _proxySetFileName = $"{Global.ProxySetOSXShellFileName.Replace(Global.NamespaceSample, "")}.sh"; 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; namespace ServiceLib.Handler.SysProxy;
public class ProxySettingWindows public static class ProxySettingWindows
{ {
private const string _regPath = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings"; 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 public sealed class AppHandler
{ {
@ -97,7 +97,7 @@ public sealed class AppHandler
return localPort + (int)protocol; return localPort + (int)protocol;
} }
public void AddProcess(IntPtr processHandle) public void AddProcess(nint processHandle)
{ {
if (Utils.IsWindows()) if (Utils.IsWindows())
{ {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -334,7 +334,7 @@ public class StatusBarViewModel : MyReactiveObject
_updateView?.Invoke(EViewAction.DispatcherServerAvailability, ResUI.Speedtesting); _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); NoticeHandler.Instance.SendMessageEx(msg);
_updateView?.Invoke(EViewAction.DispatcherServerAvailability, msg); _updateView?.Invoke(EViewAction.DispatcherServerAvailability, msg);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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