Code clean

This commit is contained in:
2dust
2026-11-18 17:35:10 +08:00
parent 184a7c11b3
commit f6dc9d1833
33 changed files with 48 additions and 64 deletions
@@ -1,4 +1,3 @@
using ServiceLib.Tests.CoreConfig;
namespace ServiceLib.Tests.Handler;
@@ -1,5 +1,3 @@
namespace ServiceLib.Handler;
public class SubscriptionHandler(
@@ -8,6 +8,7 @@ public class HttpClientHelper
// private readonly SocketsHttpHandler _directHandler = CreateSocketsHttpHandler(false);
private readonly Lazy<SocketsHttpHandler> _directHandlerLazy = new(() => CreateSocketsHttpHandler(false));
private Uri _proxyUri = null!;
public static HttpClientHelper Instance => _instance.Value;
@@ -152,7 +152,7 @@ public class EndpointResolveManager
stream.WriteByte((byte)(value & 0xFF));
}
#endregion
#endregion Build DNS Query
#region Parse DNS Response
@@ -427,7 +427,7 @@ public class EndpointResolveManager
data[offset + 1]);
}
#endregion
#endregion Parse DNS Response
}
public interface IDnsResolver
-2
View File
@@ -1,5 +1,3 @@
namespace ServiceLib.Manager;
public class TaskManager
@@ -512,7 +512,9 @@ public class MaskSettings4Ray
// udphop
public string? mode { get; set; }
public string? interval { get; set; }
// public List<string>? remoteIPs { get; set; }
public string? remotePorts { get; set; }
+2
View File
@@ -9,8 +9,10 @@ public class SsServer
{
public string? remarks { get; set; }
public string? server { get; set; }
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)]
public int server_port { get; set; }
public string? method { get; set; }
public string? password { get; set; }
public string? plugin { get; set; }
@@ -1,5 +1,3 @@
namespace ServiceLib.ViewModels;
public partial class AddServer2ViewModel : MyReactiveObject, ICloseable
@@ -1,5 +1,3 @@
namespace ServiceLib.ViewModels;
public partial class BackupAndRestoreViewModel : MyReactiveObject
@@ -1,5 +1,3 @@
namespace ServiceLib.ViewModels;
public partial class CheckUpdateViewModel : MyReactiveObject
@@ -1,5 +1,3 @@
namespace ServiceLib.ViewModels;
public partial class DNSSettingViewModel : MyReactiveObject, ICloseable
@@ -1,5 +1,3 @@
namespace ServiceLib.ViewModels;
public partial class FullConfigTemplateViewModel : MyReactiveObject, ICloseable
@@ -1,5 +1,3 @@
namespace ServiceLib.ViewModels;
public class GlobalHotkeySettingViewModel : MyReactiveObject, ICloseable
@@ -1,5 +1,3 @@
namespace ServiceLib.ViewModels;
public partial class RoutingRuleSettingViewModel : MyReactiveObject, ICloseable
@@ -1,5 +1,3 @@
namespace ServiceLib.ViewModels;
public partial class RoutingSettingViewModel : MyReactiveObject
@@ -1,5 +1,3 @@
namespace ServiceLib.ViewModels;
public partial class SubEditViewModel : MyReactiveObject, ICloseable
@@ -1,5 +1,3 @@
namespace ServiceLib.ViewModels;
public partial class SubSettingViewModel : MyReactiveObject
@@ -1,6 +1,5 @@
using Semi.Avalonia;
namespace v2rayN.Desktop.ViewModels;
public partial class ThemeSettingViewModel : MyReactiveObject
@@ -574,7 +574,6 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
};
}).DisposeWith(currentLayoutDisposables);
break;
}
RestoreUI();
@@ -317,7 +317,6 @@ public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
}
}
private void BtnAutofitColumnWidth_Click(object? sender, RoutedEventArgs e)
{
AutofitColumnWidth();
@@ -155,6 +155,7 @@ public class UpdatePreReleaseSettingsTests
private readonly FieldInfo _configField = typeof(ConfigState)
.GetField("_current", BindingFlags.Instance | BindingFlags.NonPublic)
?? throw new MissingFieldException(typeof(ConfigState).FullName, "_current");
private readonly object? _previousConfig;
private readonly string? _previousLocalData;
private readonly string _configPath;
@@ -146,6 +146,7 @@ public class WebAuthRateLimitTests
await proxy.StopAsync();
}
}
private static WebApplication CreatePartitionTestApp()
{
var builder = WebApplication.CreateBuilder();
@@ -198,9 +199,12 @@ public class WebAuthRateLimitTests
private sealed class FixedProxy(Uri address) : IWebProxy
{
public ICredentials? Credentials { get; set; }
public Uri GetProxy(Uri destination) => address;
public bool IsBypassed(Uri host) => false;
}
private sealed class TemporaryDirectory : IDisposable
{
public TemporaryDirectory()
@@ -99,8 +99,10 @@ public class WebInstanceLockProcessTests
{
private readonly DirectoryInfo _directory = Directory.CreateTempSubdirectory("v2rayn-instance-lock-tests-");
public string Path => _directory.FullName;
public void Dispose() => _directory.Delete(recursive: true);
}
private sealed class LockProcess : IAsyncDisposable
{
private static readonly TimeSpan Timeout = TimeSpan.FromSeconds(20);
@@ -6,6 +6,7 @@ public class WebLauncherTests
{
// Keep fixture PIDs outside Linux's assignable range so host services cannot affect stop tests.
private const int FakeOwnerProcessId = int.MaxValue - 1;
private const int OtherProcessId = int.MaxValue;
[Test]
@@ -351,7 +351,9 @@ public class WebRestartCoordinatorTests
public bool HasExited { get; } = hasExited;
public bool Killed { get; private set; }
public bool Disposed { get; private set; }
public void KillTree() => Killed = true;
public void Dispose() => Disposed = true;
}
-1
View File
@@ -1,7 +1,6 @@
using System.Drawing;
using System.Windows.Media.Imaging;
namespace v2rayN.Manager;
public sealed class WindowsManager
@@ -3,7 +3,6 @@ using MaterialDesignColors.ColorManipulation;
using MaterialDesignThemes.Wpf;
using Microsoft.Win32;
namespace v2rayN.ViewModels;
public partial class ThemeSettingViewModel : MyReactiveObject
-1
View File
@@ -1138,7 +1138,6 @@
Style="{StaticResource DefTextBox}" />
</StackPanel>
</materialDesign:PopupBox>
</Grid>
<Separator