From 4e8f096b4dc430903aad8e5499752fccd4894edd Mon Sep 17 00:00:00 2001 From: Bagus Nur Listiyono Date: Sun, 25 Aug 2024 23:08:29 +0700 Subject: [PATCH] CodeQA I hope Qodana is happi --- .../GameSettings/StarRail/RegistryClass/Model.cs | 1 - .../Universal/RegistryClass/CollapseMiscSetting.cs | 1 - CollapseLauncher/XAMLs/MainApp/MainPage.xaml.cs | 2 +- .../GameSettingsPages/StarRailGameSettingsPage.xaml.cs | 1 - .../XAMLs/MainApp/Pages/SettingsPage.xaml.cs | 9 ++++----- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CollapseLauncher/Classes/GameManagement/GameSettings/StarRail/RegistryClass/Model.cs b/CollapseLauncher/Classes/GameManagement/GameSettings/StarRail/RegistryClass/Model.cs index fbac6b5a4..a6d0521f5 100644 --- a/CollapseLauncher/Classes/GameManagement/GameSettings/StarRail/RegistryClass/Model.cs +++ b/CollapseLauncher/Classes/GameManagement/GameSettings/StarRail/RegistryClass/Model.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; using System.Text; -using System.Threading.Tasks; using static CollapseLauncher.GameSettings.Base.SettingsBase; using static Hi3Helper.Logger; diff --git a/CollapseLauncher/Classes/GameManagement/GameSettings/Universal/RegistryClass/CollapseMiscSetting.cs b/CollapseLauncher/Classes/GameManagement/GameSettings/Universal/RegistryClass/CollapseMiscSetting.cs index 37f66920a..9498d77ca 100644 --- a/CollapseLauncher/Classes/GameManagement/GameSettings/Universal/RegistryClass/CollapseMiscSetting.cs +++ b/CollapseLauncher/Classes/GameManagement/GameSettings/Universal/RegistryClass/CollapseMiscSetting.cs @@ -109,7 +109,6 @@ public bool UseCustomRegionBG /// The path of the custom BG for each region /// public string? CustomRegionBGPath { get; set; } -#nullable restore #endregion diff --git a/CollapseLauncher/XAMLs/MainApp/MainPage.xaml.cs b/CollapseLauncher/XAMLs/MainApp/MainPage.xaml.cs index 517edd67d..3fc9b1280 100644 --- a/CollapseLauncher/XAMLs/MainApp/MainPage.xaml.cs +++ b/CollapseLauncher/XAMLs/MainApp/MainPage.xaml.cs @@ -523,7 +523,7 @@ internal async void ChangeBackgroundImageAsRegionAsync(bool ShowLoadingMsg = fal // Check if Regional Custom BG is enabled and available if (isUseCustomPerRegionBg) { - var regionBgPath = ((IGameSettingsUniversal)currentGameProperty?._GameSettings)?.SettingsCollapseMisc?.CustomRegionBGPath; + var regionBgPath = ((IGameSettingsUniversal)currentGameProperty._GameSettings)?.SettingsCollapseMisc?.CustomRegionBGPath; if (!string.IsNullOrEmpty(regionBgPath) && File.Exists(regionBgPath)) { if (BackgroundMediaUtility.GetMediaType(regionBgPath) == BackgroundMediaUtility.MediaType.StillImage) diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/GameSettingsPages/StarRailGameSettingsPage.xaml.cs b/CollapseLauncher/XAMLs/MainApp/Pages/GameSettingsPages/StarRailGameSettingsPage.xaml.cs index 060b2bb3c..48a713cd4 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/GameSettingsPages/StarRailGameSettingsPage.xaml.cs +++ b/CollapseLauncher/XAMLs/MainApp/Pages/GameSettingsPages/StarRailGameSettingsPage.xaml.cs @@ -17,7 +17,6 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Numerics; - using System.Threading.Tasks; using Windows.UI; using static Hi3Helper.Locale; using static Hi3Helper.Logger; diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml.cs b/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml.cs index 1d0a9abb6..c81315583 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml.cs +++ b/CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml.cs @@ -14,7 +14,6 @@ using CollapseLauncher.Statics; using CommunityToolkit.WinUI; using Hi3Helper; - using Hi3Helper.Data; using Hi3Helper.Shared.ClassStruct; using Hi3Helper.Shared.Region; using Microsoft.UI.Xaml; @@ -430,9 +429,9 @@ private async void SelectBackgroundImg(object sender, RoutedEventArgs e) { BackgroundImgChanger.ChangeBackground(LauncherMetadataHelper.CurrentMetadataConfig.GameLauncherApi.GameBackgroundImgLocal, null, true, true, true); } - else if (!string.IsNullOrEmpty(((IGameSettingsUniversal)currentGameProperty?._GameSettings)?.SettingsCollapseMisc?.CustomRegionBGPath)) + else if (!string.IsNullOrEmpty(((IGameSettingsUniversal)currentGameProperty._GameSettings)?.SettingsCollapseMisc?.CustomRegionBGPath)) { - currentMediaType = BackgroundMediaUtility.GetMediaType(((IGameSettingsUniversal)currentGameProperty?._GameSettings)?.SettingsCollapseMisc?.CustomRegionBGPath); + currentMediaType = BackgroundMediaUtility.GetMediaType(((IGameSettingsUniversal)currentGameProperty._GameSettings)?.SettingsCollapseMisc?.CustomRegionBGPath); } if (currentMediaType == MediaType.Media) @@ -533,7 +532,7 @@ private bool IsBGCustom ToggleCustomBgButtons(); } - else if (isUseRegionCustomBG && value) + else if (isUseRegionCustomBG) { string currentRegionCustomBg = ((IGameSettingsUniversal)currentGameProperty._GameSettings).SettingsCollapseMisc.CustomRegionBGPath; LauncherMetadataHelper.CurrentMetadataConfig.GameLauncherApi.GameBackgroundImgLocal = currentRegionCustomBg; @@ -543,7 +542,7 @@ private bool IsBGCustom } else { - string BGPath = GetAppConfigValue("CustomBGPath").ToString(); + var BGPath = GetAppConfigValue("CustomBGPath").ToString(); if (string.IsNullOrEmpty(BGPath)) { LauncherMetadataHelper.CurrentMetadataConfig.GameLauncherApi.GameBackgroundImgLocal = AppDefaultBG;