From e8bf71e0ff5ef04f92ec6c110e7446e204dad5b9 Mon Sep 17 00:00:00 2001 From: Bagus Nur Listiyono Date: Sat, 13 Jul 2024 13:25:41 +0700 Subject: [PATCH] CodeQA pt 2 --- .../GameSettings/BaseClass/MagicNodeBaseValues.cs | 6 +++--- CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CollapseLauncher/Classes/GameManagement/GameSettings/BaseClass/MagicNodeBaseValues.cs b/CollapseLauncher/Classes/GameManagement/GameSettings/BaseClass/MagicNodeBaseValues.cs index 968123715..30cb8b423 100644 --- a/CollapseLauncher/Classes/GameManagement/GameSettings/BaseClass/MagicNodeBaseValues.cs +++ b/CollapseLauncher/Classes/GameManagement/GameSettings/BaseClass/MagicNodeBaseValues.cs @@ -264,7 +264,7 @@ public static T LoadWithMagic(byte[] magic, SettingsGameVersionManager versionMa try { - string? filePath = versionManager.ConfigFilePath; + string filePath = versionManager.ConfigFilePath; if (!File.Exists(filePath)) throw new FileNotFoundException("MagicNodeBaseValues config file not found!"); string raw = Sleepy.ReadString(filePath, magic); @@ -305,7 +305,7 @@ public T DefaultValue(byte[] magic, SettingsGameVersionManager versionManager, J public void Save() { // Get the file and dir path - string? filePath = GameVersionManager.ConfigFilePath; + string filePath = GameVersionManager.ConfigFilePath; string? fileDirPath = Path.GetDirectoryName(filePath); // Create the dir if not exist @@ -314,7 +314,7 @@ public void Save() // Write into the file string jsonString = SettingsJsonNode.SerializeJsonNode(Context, false, false); - Sleepy.WriteString(filePath!, jsonString, Magic); + Sleepy.WriteString(filePath, jsonString, Magic); } public bool Equals(GeneralData? other) diff --git a/CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs b/CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs index 15e7b77f4..823e87f00 100644 --- a/CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs +++ b/CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs @@ -75,6 +75,7 @@ internal class PresetConfig { #region Constants + // ReSharper disable once UnusedMember.Local private const string PrefixRegInstallLocation = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{0}"; @@ -473,6 +474,7 @@ private void SetVoiceLanguageID_StarRail(int langID) if (kvpTemp == null) return null; + // ReSharper disable once ConstantConditionalAccessQualifier verData = kvpTemp?.Value; }