diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index c2fc24ad..89fb435f 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -78,6 +78,7 @@ public const string SpeedUnit = ""; public const int MinFontSize = 10; public const string RebootAs = "rebootas"; + public const string AvaAssets = "avares://v2rayN/Assets/"; public static readonly List IEProxyProtocols = new() { "{ip}:{http_port}", diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs index e841ccf3..13bbf1d1 100644 --- a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs +++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs @@ -1,6 +1,5 @@ using Avalonia; using Avalonia.Media; -using System.Reflection; namespace v2rayN.Desktop.Common { @@ -8,7 +7,7 @@ namespace v2rayN.Desktop.Common { 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() { DefaultFamilyName = uri, diff --git a/v2rayN/v2rayN.Desktop/Common/AvaUtils.cs b/v2rayN/v2rayN.Desktop/Common/AvaUtils.cs index 81b63799..30e8ecc8 100644 --- a/v2rayN/v2rayN.Desktop/Common/AvaUtils.cs +++ b/v2rayN/v2rayN.Desktop/Common/AvaUtils.cs @@ -3,7 +3,6 @@ using Avalonia.Controls; using Avalonia.Input; using Avalonia.Media.Imaging; using Avalonia.Platform; -using System.Reflection; namespace v2rayN.Desktop.Common { @@ -41,7 +40,7 @@ namespace v2rayN.Desktop.Common public static WindowIcon GetAppIcon(ESysProxyType sysProxyType) { 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)); return new(bitmap); } diff --git a/v2rayN/v2rayN/App.xaml.cs b/v2rayN/v2rayN/App.xaml.cs index 5b7377d8..42c086fc 100644 --- a/v2rayN/v2rayN/App.xaml.cs +++ b/v2rayN/v2rayN/App.xaml.cs @@ -14,7 +14,6 @@ namespace v2rayN public App() { - // Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.GetCallingAssembly()); this.DispatcherUnhandledException += App_DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;