From df925d3561de8ff2f56bed3066f5365207e2c92d Mon Sep 17 00:00:00 2001 From: Sewer 56 Date: Tue, 9 Aug 2022 22:17:05 +0100 Subject: [PATCH] Fixed: Resolved some compiler warnings. --- .../Pages/BaseSubpages/ApplicationPage.xaml.cs | 6 +++--- .../DownloadPackagesPages/PackagePreviewPage.xaml.cs | 4 ++-- .../Reloaded.Mod.Loader.Tests.csproj | 1 + .../Update/Mocks/DummyDownloadablePackage.cs | 2 +- .../Reloaded.Mod.Loader.Update.Index/Structures/Package.cs | 2 ++ .../Caching/AkavacheContentStore.cs | 2 +- source/Reloaded.Mod.Loader/Reloaded.Mod.Loader.csproj | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source/Reloaded.Mod.Launcher/Pages/BaseSubpages/ApplicationPage.xaml.cs b/source/Reloaded.Mod.Launcher/Pages/BaseSubpages/ApplicationPage.xaml.cs index 7c142266..bdecb4a7 100644 --- a/source/Reloaded.Mod.Launcher/Pages/BaseSubpages/ApplicationPage.xaml.cs +++ b/source/Reloaded.Mod.Launcher/Pages/BaseSubpages/ApplicationPage.xaml.cs @@ -18,11 +18,11 @@ public ApplicationPage() SwappedOut += Dispose; InitializeComponent(); ViewModel = new ApplicationViewModel(Lib.IoC.Get().SelectedApplication!, Lib.IoC.Get(), Lib.IoC.Get(), Lib.IoC.Get()); - ViewModel.PropertyChanged += OnPageChanged; + ViewModel.PropertyChanged += WhenPageChanged; ViewModel.ChangeApplicationPage(ApplicationSubPage.ApplicationSummary); } - private void OnPageChanged(object? sender, PropertyChangedEventArgs e) + private void WhenPageChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(ViewModel.Page)) SwitchPage(ViewModel.Page); @@ -39,7 +39,7 @@ public void Dispose() return; _disposed = true; - ViewModel.PropertyChanged -= OnPageChanged; + ViewModel.PropertyChanged -= WhenPageChanged; ActionWrappers.ExecuteWithApplicationDispatcherAsync(() => { if (PageHost.CurrentPage is IDisposable disposable) diff --git a/source/Reloaded.Mod.Launcher/Pages/BaseSubpages/DownloadPackagesPages/PackagePreviewPage.xaml.cs b/source/Reloaded.Mod.Launcher/Pages/BaseSubpages/DownloadPackagesPages/PackagePreviewPage.xaml.cs index b11c21d6..b4808e0c 100644 --- a/source/Reloaded.Mod.Launcher/Pages/BaseSubpages/DownloadPackagesPages/PackagePreviewPage.xaml.cs +++ b/source/Reloaded.Mod.Launcher/Pages/BaseSubpages/DownloadPackagesPages/PackagePreviewPage.xaml.cs @@ -25,7 +25,7 @@ public PackagePreviewPage(DownloadPackagePreviewViewModel viewModel, Action clos _close = close; InitializeComponent(); this.AnimateInFinished -= OnAnimateInFinished; - PreviewCarousel.OnPageIndexChanged += OnPageIndexChanged; + PreviewCarousel.OnPageIndexChanged += WhenPageIndexChanged; ControllerSupport.SubscribePreviewCustomInputs(SubscribePreviewCustomInputs); // We need to explicitly set focus in case person changes page on controller without @@ -211,7 +211,7 @@ protected override Animation[] MakeExitAnimations() // Don't navigate hyperlinks in our markdown, thanks! private void Page_Click(object sender, RoutedEventArgs e) => e.Handled = true; - private void OnPageIndexChanged(int pageIndex) + private void WhenPageIndexChanged(int pageIndex) { if (ViewModel.Package.Images != null) ViewModel.SelectedImage = ViewModel.Package.Images[pageIndex]; diff --git a/source/Reloaded.Mod.Loader.Tests/Reloaded.Mod.Loader.Tests.csproj b/source/Reloaded.Mod.Loader.Tests/Reloaded.Mod.Loader.Tests.csproj index 7a2d2e6f..075ac930 100644 --- a/source/Reloaded.Mod.Loader.Tests/Reloaded.Mod.Loader.Tests.csproj +++ b/source/Reloaded.Mod.Loader.Tests/Reloaded.Mod.Loader.Tests.csproj @@ -7,6 +7,7 @@ preview ..\Output\Tests\ disable + $(NoWarn);NU1605;NU1701;MSB3270 diff --git a/source/Reloaded.Mod.Loader.Tests/Update/Mocks/DummyDownloadablePackage.cs b/source/Reloaded.Mod.Loader.Tests/Update/Mocks/DummyDownloadablePackage.cs index a3803e59..900ee206 100644 --- a/source/Reloaded.Mod.Loader.Tests/Update/Mocks/DummyDownloadablePackage.cs +++ b/source/Reloaded.Mod.Loader.Tests/Update/Mocks/DummyDownloadablePackage.cs @@ -27,7 +27,7 @@ public class DummyDownloadablePackage : IDownloadablePackage public long? ViewCount { get; } = null; public long? DownloadCount { get; } = null; public DateTime? Published { get; set; } = null!; - public string? Changelog { get; } = null!; + public string Changelog { get; } = null!; public Task DownloadAsync(string packageFolder, IProgress progress, CancellationToken token = default) { diff --git a/source/Reloaded.Mod.Loader.Update.Index/Structures/Package.cs b/source/Reloaded.Mod.Loader.Update.Index/Structures/Package.cs index d96be4cc..5082b078 100644 --- a/source/Reloaded.Mod.Loader.Update.Index/Structures/Package.cs +++ b/source/Reloaded.Mod.Loader.Update.Index/Structures/Package.cs @@ -10,7 +10,9 @@ namespace Reloaded.Mod.Loader.Update.Index.Structures; [Equals(DoNotAddEqualityOperators = true)] public class Package : IDownloadablePackage { +#pragma warning disable CS0067 public event PropertyChangedEventHandler? PropertyChanged; +#pragma warning restore CS0067 /// public string Name { get; set; } = ""; diff --git a/source/Reloaded.Mod.Loader.Update/Caching/AkavacheContentStore.cs b/source/Reloaded.Mod.Loader.Update/Caching/AkavacheContentStore.cs index 0bb96a18..21f4058c 100644 --- a/source/Reloaded.Mod.Loader.Update/Caching/AkavacheContentStore.cs +++ b/source/Reloaded.Mod.Loader.Update/Caching/AkavacheContentStore.cs @@ -97,7 +97,7 @@ public async Task TryRemoveAsync(CacheKey key) await observable; return result; } - catch (KeyNotFoundException e) + catch (KeyNotFoundException) { return false; } diff --git a/source/Reloaded.Mod.Loader/Reloaded.Mod.Loader.csproj b/source/Reloaded.Mod.Loader/Reloaded.Mod.Loader.csproj index 31af1e95..6a52f0d9 100644 --- a/source/Reloaded.Mod.Loader/Reloaded.Mod.Loader.csproj +++ b/source/Reloaded.Mod.Loader/Reloaded.Mod.Loader.csproj @@ -10,7 +10,7 @@ true true false - $(NoWarn);NU1605 + $(NoWarn);NU1605;NU1701 1.19.2 x86;x64 true