diff --git a/EllieHub/EllieHub.csproj b/EllieHub/EllieHub.csproj index 1c3af54..45e59e6 100644 --- a/EllieHub/EllieHub.csproj +++ b/EllieHub/EllieHub.csproj @@ -8,7 +8,6 @@ enable enable Nullable - True True True True @@ -16,11 +15,12 @@ true + true true embedded - 1.0.2.0 + 1.0.3.0 app.manifest @@ -30,6 +30,13 @@ true + + False + + + True + + diff --git a/EllieHub/Extensions/WindowExt.cs b/EllieHub/Extensions/WindowExt.cs index 02de951..71bbe95 100644 --- a/EllieHub/Extensions/WindowExt.cs +++ b/EllieHub/Extensions/WindowExt.cs @@ -83,8 +83,8 @@ public static class WindowExt { return (!activeView.TryFindResource(resourceName, theme, out var resource)) ? throw new InvalidOperationException($"Resource '{resourceName}' was not found.") - : (!Utilities.TryCastTo(resource, out var result)) - ? throw new InvalidCastException($"Could not convert resource of type '{resource?.GetType()?.FullName}' to '{nameof(T)}'.") - : result; + : (resource is T castResource) + ? castResource + : throw new InvalidCastException($"Could not convert resource of type '{resource?.GetType()?.FullName}' to '{nameof(T)}'."); } } \ No newline at end of file diff --git a/EllieHub/Features/AppConfig/ViewModels/ConfigViewModel.cs b/EllieHub/Features/AppConfig/ViewModels/ConfigViewModel.cs index 08d1c41..54861b0 100644 --- a/EllieHub/Features/AppConfig/ViewModels/ConfigViewModel.cs +++ b/EllieHub/Features/AppConfig/ViewModels/ConfigViewModel.cs @@ -20,7 +20,7 @@ namespace EllieHub.Features.AppConfig.ViewModels; /// public class ConfigViewModel : ViewModelBase { - private static readonly string _unixNotice = Environment.OSVersion.Platform is not PlatformID.Unix + private static readonly string _unixNotice = (Environment.OSVersion.Platform is not PlatformID.Unix) ? string.Empty : Environment.NewLine + "To make the dependencies accessible to your bot instances without this updater, consider installing " + $"them through your package manager or adding the directory \"{AppStatics.AppDepsUri}\" to your PATH environment variable."; diff --git a/EllieHub/Features/AppWindow/Views/Controls/LateralBarView.axaml.cs b/EllieHub/Features/AppWindow/Views/Controls/LateralBarView.axaml.cs index 0e10701..1885fc6 100644 --- a/EllieHub/Features/AppWindow/Views/Controls/LateralBarView.axaml.cs +++ b/EllieHub/Features/AppWindow/Views/Controls/LateralBarView.axaml.cs @@ -69,10 +69,10 @@ public partial class LateralBarView : ReactiveUserControl /// Occurs when the visual tree has an unexpected structure. public void ApplyBotButtonBorder(Button button) { - if (!Utilities.TryCastTo(button.Parent?.Parent, out var border)) + if (button.Parent?.Parent is not Border border) throw new InvalidOperationException("Visual tree has an unexpected structure."); - if (!Utilities.TryCastTo(this.FindResource(base.ActualThemeVariant, "BotSelectionColor"), out var resourceColor)) + if (this.FindResource(base.ActualThemeVariant, "BotSelectionColor") is not ImmutableSolidColorBrush resourceColor) return; border.BorderBrush = resourceColor; @@ -95,7 +95,7 @@ public partial class LateralBarView : ReactiveUserControl private void LoadBotViewModel(object sender, RoutedEventArgs eventArgs) { // "sender", for some reason, is not one of the buttons stored in the lateral bar's view-model. - if (Utilities.TryCastTo