Remove part System.Reflection

pull/6245/head^2
2dust 2024-12-08 11:11:06 +08:00
parent e7f04f55c2
commit 53a99e3f79
4 changed files with 3 additions and 5 deletions

View File

@ -78,6 +78,7 @@
public const string SpeedUnit = ""; public const string SpeedUnit = "";
public const int MinFontSize = 10; public const int MinFontSize = 10;
public const string RebootAs = "rebootas"; public const string RebootAs = "rebootas";
public const string AvaAssets = "avares://v2rayN/Assets/";
public static readonly List<string> IEProxyProtocols = new() { public static readonly List<string> IEProxyProtocols = new() {
"{ip}:{http_port}", "{ip}:{http_port}",

View File

@ -1,6 +1,5 @@
using Avalonia; using Avalonia;
using Avalonia.Media; using Avalonia.Media;
using System.Reflection;
namespace v2rayN.Desktop.Common namespace v2rayN.Desktop.Common
{ {
@ -8,7 +7,7 @@ namespace v2rayN.Desktop.Common
{ {
public static AppBuilder WithFontByDefault(this AppBuilder appBuilder) public static AppBuilder WithFontByDefault(this AppBuilder appBuilder)
{ {
var uri = $"avares://{Assembly.GetExecutingAssembly().GetName().Name}/Assets/Fonts#Noto Sans SC"; var uri = Path.Combine(Global.AvaAssets, "Fonts#Noto Sans SC");
return appBuilder.With(new FontManagerOptions() return appBuilder.With(new FontManagerOptions()
{ {
DefaultFamilyName = uri, DefaultFamilyName = uri,

View File

@ -3,7 +3,6 @@ using Avalonia.Controls;
using Avalonia.Input; using Avalonia.Input;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using Avalonia.Platform; using Avalonia.Platform;
using System.Reflection;
namespace v2rayN.Desktop.Common namespace v2rayN.Desktop.Common
{ {
@ -41,7 +40,7 @@ namespace v2rayN.Desktop.Common
public static WindowIcon GetAppIcon(ESysProxyType sysProxyType) public static WindowIcon GetAppIcon(ESysProxyType sysProxyType)
{ {
var index = (int)sysProxyType + 1; var index = (int)sysProxyType + 1;
var uri = new Uri($"avares://{Assembly.GetExecutingAssembly().GetName().Name}/Assets/NotifyIcon{index}.ico"); var uri = new Uri(Path.Combine(Global.AvaAssets, $"NotifyIcon{index}.ico"));
using var bitmap = new Bitmap(AssetLoader.Open(uri)); using var bitmap = new Bitmap(AssetLoader.Open(uri));
return new(bitmap); return new(bitmap);
} }

View File

@ -14,7 +14,6 @@ namespace v2rayN
public App() public App()
{ {
// Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.GetCallingAssembly());
this.DispatcherUnhandledException += App_DispatcherUnhandledException; this.DispatcherUnhandledException += App_DispatcherUnhandledException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;