From a09ace0d3916edf1c417b4867d107453d1ce5f35 Mon Sep 17 00:00:00 2001 From: Cinka Date: Mon, 8 Sep 2025 21:26:12 +0300 Subject: [PATCH] - fix: UpdateResolver preview think --- Nebula.Launcher/Converters/TypeConverters.cs | 2 +- Nebula.Launcher/LauncherConVar.cs | 2 -- Nebula.Launcher/Services/LocalisationService.cs | 4 ---- .../ViewModels/Pages/ContentBrowserViewModel.cs | 17 +++++++++++++++-- Nebula.Runner/Services/RunnerService.cs | 3 ++- Nebula.UpdateResolver/App.axaml.cs | 3 +-- Nebula.UpdateResolver/MainWindow.axaml.cs | 5 ++++- Nebula.sln.DotSettings.user | 1 + 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Nebula.Launcher/Converters/TypeConverters.cs b/Nebula.Launcher/Converters/TypeConverters.cs index 6fdf9c1..962247c 100644 --- a/Nebula.Launcher/Converters/TypeConverters.cs +++ b/Nebula.Launcher/Converters/TypeConverters.cs @@ -24,5 +24,5 @@ public static class TypeConverters }); public static FuncValueConverter NameColorRepresentation { get; } = - new(ColorUtils.GetColorFromString); + new((str)=>ColorUtils.GetColorFromString(str ?? throw new ArgumentNullException(nameof(str),"Name of color is null!"))); } \ No newline at end of file diff --git a/Nebula.Launcher/LauncherConVar.cs b/Nebula.Launcher/LauncherConVar.cs index 6260913..d5a869a 100644 --- a/Nebula.Launcher/LauncherConVar.cs +++ b/Nebula.Launcher/LauncherConVar.cs @@ -54,6 +54,4 @@ public static class LauncherConVar public static readonly ConVar CurrentLang = ConVarBuilder.Build("launcher.language", CultureInfo.CurrentCulture.Name); public static readonly ConVar ILSpyUrl = ConVarBuilder.Build("decompiler.url", "https://github.com/icsharpcode/ILSpy/releases/download/v9.0/ILSpy_binaries_9.0.0.7889-x64.zip"); - - } \ No newline at end of file diff --git a/Nebula.Launcher/Services/LocalisationService.cs b/Nebula.Launcher/Services/LocalisationService.cs index 5988d25..be16444 100644 --- a/Nebula.Launcher/Services/LocalisationService.cs +++ b/Nebula.Launcher/Services/LocalisationService.cs @@ -72,10 +72,6 @@ public class LocaledText : MarkupExtension public LocaledText(string key) => Key = key; - public LocaledText() - { - } - public override object ProvideValue(IServiceProvider serviceProvider) { return LocalisationService.GetString(Key, Options); diff --git a/Nebula.Launcher/ViewModels/Pages/ContentBrowserViewModel.cs b/Nebula.Launcher/ViewModels/Pages/ContentBrowserViewModel.cs index 8967985..3e519e5 100644 --- a/Nebula.Launcher/ViewModels/Pages/ContentBrowserViewModel.cs +++ b/Nebula.Launcher/ViewModels/Pages/ContentBrowserViewModel.cs @@ -416,7 +416,20 @@ public abstract class BaseFolderContentEntry : ViewModelBase, IContentEntry private Dictionary _childs = []; public string IconPath => "/Assets/svg/folder.svg"; - public IContentHolder Holder { get; private set; } + + private IContentHolder? _holder = null; + public IContentHolder Holder + { + get + { + if(_holder == null) + throw new InvalidOperationException( + GetType().Name + " was not initialised! Call Init(IContentHolder holder, string? name = null) before using it."); + + return _holder; + } + } + public IContentEntry? Parent { get; set; } public string? Name { get; private set; } @@ -432,7 +445,7 @@ public abstract class BaseFolderContentEntry : ViewModelBase, IContentEntry public void Init(IContentHolder holder, string? name = null) { Name = name; - Holder = holder; + _holder = holder; } public T AddChild(T child) where T: IContentEntry diff --git a/Nebula.Runner/Services/RunnerService.cs b/Nebula.Runner/Services/RunnerService.cs index 3b1d711..ab44822 100644 --- a/Nebula.Runner/Services/RunnerService.cs +++ b/Nebula.Runner/Services/RunnerService.cs @@ -93,7 +93,8 @@ public static class MetricsEnabledPatcher var harmony = harmonyService.Instance.Harmony; var targetType = reflectionService.GetType("Robust.Shared.GameObjects.EntitySystemManager"); - var targetMethod = targetType.GetProperty("MetricsEnabled").GetGetMethod(); + var targetMethod = targetType.GetProperty("MetricsEnabled")?.GetGetMethod() ?? + throw new Exception("target method is null.. huh.. do we have patch a right think?"); var prefix = typeof(MetricsEnabledPatcher).GetMethod(nameof(MetricsEnabledGetterPrefix), BindingFlags.Static | BindingFlags.NonPublic); diff --git a/Nebula.UpdateResolver/App.axaml.cs b/Nebula.UpdateResolver/App.axaml.cs index 27f80d2..bc5eb13 100644 --- a/Nebula.UpdateResolver/App.axaml.cs +++ b/Nebula.UpdateResolver/App.axaml.cs @@ -1,4 +1,5 @@ using Avalonia; +using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; @@ -13,8 +14,6 @@ public partial class App : Application public override void OnFrameworkInitializationCompleted() { - - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { desktop.MainWindow = new MainWindow(); diff --git a/Nebula.UpdateResolver/MainWindow.axaml.cs b/Nebula.UpdateResolver/MainWindow.axaml.cs index 768539a..81b0fe0 100644 --- a/Nebula.UpdateResolver/MainWindow.axaml.cs +++ b/Nebula.UpdateResolver/MainWindow.axaml.cs @@ -36,7 +36,10 @@ public partial class MainWindow : Window Console.WriteLine(messageOut); LogStr += messageOut + "\n"; }; - Start(); + if (!Design.IsDesignMode) + Task.Run(()=> Start()); + else + LogStandalone.Log("Debug information", 51); } private async Task Start() diff --git a/Nebula.sln.DotSettings.user b/Nebula.sln.DotSettings.user index e73f77b..61e5608 100644 --- a/Nebula.sln.DotSettings.user +++ b/Nebula.sln.DotSettings.user @@ -21,6 +21,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded