diff --git a/.editorconfig b/.editorconfig index cc6424e58..ed40c7fb3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -80,3 +80,5 @@ dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion dotnet_style_prefer_compound_assignment = true:suggestion dotnet_style_prefer_simplified_interpolation = true:suggestion dotnet_style_namespace_match_folder = true:suggestion + +resharper_localizable_element_highlighting=hint \ No newline at end of file diff --git a/CollapseLauncher/Classes/GameManagement/GameSettings/Genshin/RegistryClass/GlobalPerfData.cs b/CollapseLauncher/Classes/GameManagement/GameSettings/Genshin/RegistryClass/GlobalPerfData.cs index 8bb75080a..987d277e1 100644 --- a/CollapseLauncher/Classes/GameManagement/GameSettings/Genshin/RegistryClass/GlobalPerfData.cs +++ b/CollapseLauncher/Classes/GameManagement/GameSettings/Genshin/RegistryClass/GlobalPerfData.cs @@ -120,6 +120,8 @@ internal class GlobalPerfData // Generate the list of the FPSOption value and order by ascending it. public static readonly FPSOption[] FPSOptionsList = Enum.GetValues().OrderBy(GetFPSOptionNumber).ToArray(); // Generate the list of the FPS number to be displayed on FPS Combobox + // Queried in XAML, ReSharper fails to find it + // ReSharper disable once CollectionNeverQueried.Global public static readonly int[] FPSIndex = FPSOptionsList.Select(GetFPSOptionNumber).ToArray(); private static int GetFPSOptionNumber(FPSOption value) @@ -131,7 +133,9 @@ private static int GetFPSOptionNumber(FPSOption value) // Return the number return number; } - + + // Queried in XAML, ReSharper fails to find it + // ReSharper disable once CollectionNeverQueried.Global public static readonly string[] RenderScaleValuesStr = DictionaryCategory.RenderResolutionOption.Keys.Select(x => x.ToString("0.0")).ToArray(); public static readonly List RenderScaleValues = DictionaryCategory.RenderResolutionOption.Keys.ToList(); public static readonly List RenderScaleIndex = DictionaryCategory.RenderResolutionOption.Values.ToList(); diff --git a/CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs b/CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs index 284662a8e..0d5484f84 100644 --- a/CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs +++ b/CollapseLauncher/Classes/Helper/Metadata/PresetConfig.cs @@ -849,7 +849,7 @@ private bool CheckInnerGameConfig(string gamePath, LauncherType launcherType) return false; IniFile ini = IniFile.LoadFrom(configPath); - string? path1 = ini["launcher"]!["game_install_path"].ToString(); + string? path1 = ini["launcher"]["game_install_path"].ToString(); if (string.IsNullOrEmpty(path1)) return false; diff --git a/CollapseLauncher/Classes/Helper/WindowUtility.cs b/CollapseLauncher/Classes/Helper/WindowUtility.cs index 02b2f6318..e0b68d2d6 100644 --- a/CollapseLauncher/Classes/Helper/WindowUtility.cs +++ b/CollapseLauncher/Classes/Helper/WindowUtility.cs @@ -21,6 +21,7 @@ using Microsoft.UI.Xaml.Media; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using Windows.Foundation; using Windows.Graphics; @@ -285,13 +286,13 @@ internal static IconShowOptions CurrentWindowTitlebarIconShowOption } } - private static NotificationService? _currentToastNotificationService; - internal static NotificationService? CurrentToastNotificationService + [field: AllowNull, MaybeNull] + internal static NotificationService CurrentToastNotificationService { get { // If toast notification service field is null, then initialize - if (_currentToastNotificationService == null) + if (field == null) { // Get Icon location paths (string iconLocationStartMenu, _) @@ -302,7 +303,7 @@ internal static NotificationService? CurrentToastNotificationService out _); // Register notification service - _currentToastNotificationService = new NotificationService(ILoggerHelper.GetILogger("ToastCOM")); + field = new NotificationService(ILoggerHelper.GetILogger("ToastCOM")); // Get AUMID name from Win32 PInvoke.GetProcessAumid(out string? appAumIdName); @@ -314,19 +315,19 @@ internal static NotificationService? CurrentToastNotificationService if (!string.IsNullOrEmpty(appAumIdName)) { // Initialize Toast Notification service - _currentToastNotificationService.Initialize( - appAumIdName, - executablePath ?? "", - iconLocationStartMenu, - asElevatedUser: true - ); + field.Initialize( + appAumIdName, + executablePath ?? "", + iconLocationStartMenu, + asElevatedUser: true + ); // Subscribe ToastCallback - _currentToastNotificationService.ToastCallback += Service_ToastNotificationCallback; + field.ToastCallback += Service_ToastNotificationCallback; } } - return _currentToastNotificationService; + return field; } } diff --git a/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs b/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs index b6b586cdf..70e8a451a 100644 --- a/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs +++ b/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs @@ -1752,18 +1752,18 @@ private async Task ExtractUsingNativeZipWorker(IEnumerable entriesIndex, L await runningTask.ConfigureAwait(false); } - void StartWriteInner(byte[] buffer, FileStream outputStream, Stream entryStream, CancellationToken cancellationToken) + void StartWriteInner(byte[] bufferInner, FileStream outputStream, Stream entryStream, CancellationToken cancellationTokenInner) { int read; // Perform async read - while ((read = entryStream.Read(buffer, 0, buffer.Length)) > 0) + while ((read = entryStream.Read(bufferInner, 0, bufferInner.Length)) > 0) { // Throw if cancellation requested - cancellationToken.ThrowIfCancellationRequested(); + cancellationTokenInner.ThrowIfCancellationRequested(); // Perform sync write - outputStream.Write(buffer, 0, read); + outputStream.Write(bufferInner, 0, read); // Increment total size _progressAllSizeCurrent += read; diff --git a/CollapseLauncher/Classes/Interfaces/Class/DeltaPatchProperty.cs b/CollapseLauncher/Classes/Interfaces/Class/DeltaPatchProperty.cs index 4e407a991..d2fe75a96 100644 --- a/CollapseLauncher/Classes/Interfaces/Class/DeltaPatchProperty.cs +++ b/CollapseLauncher/Classes/Interfaces/Class/DeltaPatchProperty.cs @@ -8,13 +8,13 @@ internal class DeltaPatchProperty internal DeltaPatchProperty(string PatchFile) { ReadOnlySpan strings = Path.GetFileNameWithoutExtension(PatchFile).Split('_'); - this.MD5hash = strings[5]; - this.ZipHash = strings[4]; - this.ProfileName = strings[0]; - this.SourceVer = strings[1]; - this.TargetVer = strings[2]; - this.PatchCompr = strings[3]; - this.PatchPath = PatchFile; + MD5hash = strings[5]; + ZipHash = strings[4]; + ProfileName = strings[0]; + SourceVer = strings[1]; + TargetVer = strings[2]; + PatchCompr = strings[3]; + PatchPath = PatchFile; } public string ZipHash { get; set; } diff --git a/CollapseLauncher/Classes/Interfaces/Class/GamePropertyBase.cs b/CollapseLauncher/Classes/Interfaces/Class/GamePropertyBase.cs index d7a0e14e8..7b3fc632c 100644 --- a/CollapseLauncher/Classes/Interfaces/Class/GamePropertyBase.cs +++ b/CollapseLauncher/Classes/Interfaces/Class/GamePropertyBase.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Diagnostics; using static Hi3Helper.Shared.Region.LauncherConfig; namespace CollapseLauncher.Interfaces diff --git a/CollapseLauncher/Classes/Interfaces/Class/ProgressBase.cs b/CollapseLauncher/Classes/Interfaces/Class/ProgressBase.cs index 67af489f2..e7aee12a8 100644 --- a/CollapseLauncher/Classes/Interfaces/Class/ProgressBase.cs +++ b/CollapseLauncher/Classes/Interfaces/Class/ProgressBase.cs @@ -201,22 +201,19 @@ protected virtual void _httpClient_UpdateAssetProgress(int size, DownloadProgres double percentage = ConverterTool.GetPercentageNumber(_progressAllSizeCurrent, _progressAllSizeTotal); // Update current progress percentages and speed - if (_progress != null) + lock (_progress) { _progress.ProgressAllPercentage = percentage; } // Update current activity status - if (_status != null) - { - _status.IsProgressAllIndetermined = false; - string timeLeftString = string.Format(Lang._Misc.TimeRemainHMSFormat, timeLeftSpan); - _status.ActivityAll = string.Format(Lang._Misc.Downloading + ": {0}/{1} ", _progressAllCountCurrent, - _progressAllCountTotal) - + string.Format($"({Lang._Misc.SpeedPerSec})", - ConverterTool.SummarizeSizeSimple(speedClamped)) - + $" | {timeLeftString}"; - } + _status.IsProgressAllIndetermined = false; + string timeLeftString = string.Format(Lang._Misc.TimeRemainHMSFormat, timeLeftSpan); + _status.ActivityAll = string.Format(Lang._Misc.Downloading + ": {0}/{1} ", _progressAllCountCurrent, + _progressAllCountTotal) + + string.Format($"({Lang._Misc.SpeedPerSec})", + ConverterTool.SummarizeSizeSimple(speedClamped)) + + $" | {timeLeftString}"; // Trigger update UpdateAll(); @@ -462,15 +459,12 @@ protected void UpdateSophonFileDownloadProgress(long downloadedWrite, long curre protected void UpdateSophonDownloadStatus(SophonAsset asset) { Interlocked.Add(ref _progressAllCountCurrent, 1); - if (_status != null) - { - _status.ActivityStatus = string.Format("{0}: {1}", - _isSophonInUpdateMode - ? Lang._Misc.Updating - : Lang._Misc.Downloading, - string.Format(Lang._Misc.PerFromTo, _progressAllCountCurrent, - _progressAllCountTotal)); - } + _status.ActivityStatus = string.Format("{0}: {1}", + _isSophonInUpdateMode + ? Lang._Misc.Updating + : Lang._Misc.Downloading, + string.Format(Lang._Misc.PerFromTo, _progressAllCountCurrent, + _progressAllCountTotal)); UpdateStatus(); } @@ -884,17 +878,13 @@ protected async Task TryRunExamineThrow(Task action) } finally { - // Define that the status is not running - if (_status != null) + // Clear the _assetIndex after that + if (_status is { IsCompleted: false }) { - // Clear the _assetIndex after that - if (_status is { IsCompleted: false }) - { - _assetIndex.Clear(); - } - - _status.IsRunning = false; + _assetIndex.Clear(); } + + _status.IsRunning = false; } } diff --git a/CollapseLauncher/Classes/RepairManagement/Genshin/Fetch.cs b/CollapseLauncher/Classes/RepairManagement/Genshin/Fetch.cs index a93383ea3..ca5edf561 100644 --- a/CollapseLauncher/Classes/RepairManagement/Genshin/Fetch.cs +++ b/CollapseLauncher/Classes/RepairManagement/Genshin/Fetch.cs @@ -28,11 +28,8 @@ internal partial class GenshinRepair private async ValueTask> Fetch(List assetIndex, CancellationToken token) { // Set total activity string as "Loading Indexes..." - if (_status != null) - { - _status.ActivityStatus = Lang._GameRepairPage.Status2; - _status.IsProgressAllIndetermined = true; - } + _status.ActivityStatus = Lang._GameRepairPage.Status2; + _status.IsProgressAllIndetermined = true; UpdateStatus(); @@ -582,15 +579,13 @@ private void _httpClient_FetchManifestAssetProgress(int read, DownloadProgress d { // Update fetch status double speed = CalculateSpeed(read); - if (_status != null) - { - _status.IsProgressPerFileIndetermined = false; - _status.ActivityPerFile = - string.Format(Lang._GameRepairPage.PerProgressSubtitle3, SummarizeSizeSimple(speed)); - } + + _status.IsProgressPerFileIndetermined = false; + _status.ActivityPerFile = + string.Format(Lang._GameRepairPage.PerProgressSubtitle3, SummarizeSizeSimple(speed)); // Update fetch progress - if (_progress != null) + lock (_progress) { _progress.ProgressPerFilePercentage = GetPercentageNumber(downloadProgress.BytesDownloaded, downloadProgress.BytesTotal); diff --git a/CollapseLauncher/Classes/RepairManagement/Genshin/GenshinRepair.cs b/CollapseLauncher/Classes/RepairManagement/Genshin/GenshinRepair.cs index 8fa4c124a..e508eafe6 100644 --- a/CollapseLauncher/Classes/RepairManagement/Genshin/GenshinRepair.cs +++ b/CollapseLauncher/Classes/RepairManagement/Genshin/GenshinRepair.cs @@ -9,7 +9,7 @@ namespace CollapseLauncher { - public enum GenshinAudioLanguage : int + public enum GenshinAudioLanguage { English = 0, Chinese = 1, diff --git a/CollapseLauncher/Classes/RepairManagement/Honkai/Check.cs b/CollapseLauncher/Classes/RepairManagement/Honkai/Check.cs index 239c6c060..830dcda2a 100644 --- a/CollapseLauncher/Classes/RepairManagement/Honkai/Check.cs +++ b/CollapseLauncher/Classes/RepairManagement/Honkai/Check.cs @@ -22,14 +22,11 @@ private async Task Check(List assetIndex, CancellationToke List brokenAssetIndex = new List(); // Set Indetermined status as false - if (_status != null) - { - _status.IsProgressAllIndetermined = false; - _status.IsProgressPerFileIndetermined = false; + _status.IsProgressAllIndetermined = false; + _status.IsProgressPerFileIndetermined = false; - // Show the asset entry panel - _status.IsAssetEntryPanelShow = true; - } + // Show the asset entry panel + _status.IsAssetEntryPanelShow = true; // Find unused assets CheckUnusedAsset(assetIndex, brokenAssetIndex); @@ -124,10 +121,7 @@ private void CheckAssetTypeVideo(FilePropertiesRemote asset, List targetAssetIndex, CancellationToken token) { // Update activity status - if (_status != null) - { - _status.ActivityStatus = string.Format(Lang._GameRepairPage.Status6, asset.N); - } + _status.ActivityStatus = string.Format(Lang._GameRepairPage.Status6, asset.N); // Increment current total count _progressAllCountCurrent++; @@ -212,9 +206,9 @@ private async ValueTask CheckAssetTypeAudio(FilePropertiesRemote asset, List targetAssetIndex, CancellationToken token) { // Update activity status - if (_status != null) - { - _status.ActivityStatus = string.Format(Lang._GameRepairPage.Status6, asset.N); - } + _status.ActivityStatus = string.Format(Lang._GameRepairPage.Status6, asset.N); // Increment current total count _progressAllCountCurrent++; @@ -344,7 +335,7 @@ private void RemoveSkippableAssets(List assetIndex) // Iterate the skippable asset and do LINQ check foreach (string skippableAsset in _skippableAssets) { - // Try get the filename and the enum type + // Try to get the filename and the enum type ReadOnlySpan skippableNameSpan = skippableAsset.AsSpan(); _ = skippableNameSpan.Split(ranges, '$'); ReadOnlySpan skippableName = skippableNameSpan[ranges[0]]; @@ -352,7 +343,7 @@ private void RemoveSkippableAssets(List assetIndex) if (Enum.TryParse(skippableType, true, out FileType skippableFt)) { - // Try get the IEnumerable to iterate the asset + // Try to get the IEnumerable to iterate the asset foreach (FilePropertiesRemote asset in assetIndex) { // If the asset name and type is equal, then add as removable @@ -383,7 +374,7 @@ private void RemoveSkippableAssets(List assetIndex) .Value.PatchPairs? .Where(x => File.Exists( Path.Combine(directory, x.OldHashStr) + ".wmv" - ))?.FirstOrDefault(); + )).FirstOrDefault(); if (!existingOldBlockPair.HasValue || string.IsNullOrEmpty(existingOldBlockPair.Value.PatchHashStr)) return null; @@ -398,10 +389,7 @@ private void RemoveSkippableAssets(List assetIndex) private async ValueTask CheckAssetTypeBlocks(FilePropertiesRemote asset, List targetAssetIndex, CancellationToken token) { // Update activity status - if (_status != null) - { - _status.ActivityStatus = string.Format(Lang._GameRepairPage.Status5, asset.CRC); - } + _status.ActivityStatus = string.Format(Lang._GameRepairPage.Status5, asset.CRC); // Increment current total count _progressAllCountCurrent++; @@ -429,10 +417,10 @@ private async ValueTask CheckAssetTypeBlocks(FilePropertiesRemote asset, List( Path.GetFileName(asset.N), RepairAssetType.BlockUpdate, - Path.GetDirectoryName(asset.N) + $" (MetaVer: {string.Join('.', patchInfo?.PatchPairs[0].OldVersion)})", - (long)patchInfo?.PatchPairs[0].PatchSize, + Path.GetDirectoryName(asset.N) + $" (MetaVer: {string.Join('.', patchInfo.Value.PatchPairs[0].OldVersion)})", + patchInfo.Value.PatchPairs[0].PatchSize, localOldCRC, asset.CRCArray ) @@ -550,7 +538,7 @@ private async ValueTask CheckAssetTypeBlocks(FilePropertiesRemote asset, List assetIndex, List targetAssetIndex) { - // Build the list of existing files inside of the game folder + // Build the list of existing files inside the game folder // for comparison with asset index into catalog list List catalog = new List(); BuildAssetIndexCatalog(catalog, assetIndex); diff --git a/CollapseLauncher/Classes/RepairManagement/Honkai/Fetch.cs b/CollapseLauncher/Classes/RepairManagement/Honkai/Fetch.cs index 6147d7400..02e9a0974 100644 --- a/CollapseLauncher/Classes/RepairManagement/Honkai/Fetch.cs +++ b/CollapseLauncher/Classes/RepairManagement/Honkai/Fetch.cs @@ -640,7 +640,7 @@ private async Task FetchXMFFile(HttpClient _httpClient, List, IRepair, IRepairAssetIndex { #region Properties - private const string _assetBasePath = "BH3_Data/StreamingAssets/"; - private readonly string[] _skippableAssets = new string[] { "CG_Temp.usm$Generic", "BlockMeta.xmf$Generic", "Blocks.xmf$Generic" }; - private HonkaiCache _cacheUtil { get; init; } - private string _assetBaseURL { get; set; } - private string _blockBaseURL { get => ConverterTool.CombineURLFromString(_assetBaseURL, $"StreamingAsb/{string.Join('_', _gameVersion.VersionArray)}/pc/HD"); } - private string _blockAsbBaseURL { get => ConverterTool.CombineURLFromString(_blockBaseURL, "/asb"); } - private string _blockPatchBaseURL { get => ConverterTool.CombineURLFromString(_blockBaseURL, "/patch"); } - private string _blockPatchDiffBaseURL { get => ConverterTool.CombineURLFromString(_blockPatchBaseURL, "/{0}"); } - private string _blockPatchDiffPath { get => ConverterTool.CombineURLFromString(_assetBasePath, "Asb/pc/Patch"); } - private string _blockBasePath { get => ConverterTool.CombineURLFromString(_assetBasePath, "Asb/pc/"); } - private bool _isOnlyRecoverMain { get; set; } - private KianaDispatch _gameServer { get; set; } + private const string _assetBasePath = "BH3_Data/StreamingAssets/"; + private readonly string[] _skippableAssets = new[] { "CG_Temp.usm$Generic", "BlockMeta.xmf$Generic", "Blocks.xmf$Generic" }; + private HonkaiCache _cacheUtil { get; init; } + private string _assetBaseURL { get; set; } + private string _blockBaseURL { get => ConverterTool.CombineURLFromString(_assetBaseURL, $"StreamingAsb/{string.Join('_', _gameVersion.VersionArray)}/pc/HD"); } + private string _blockAsbBaseURL { get => ConverterTool.CombineURLFromString(_blockBaseURL, "/asb"); } + private string _blockPatchBaseURL { get => ConverterTool.CombineURLFromString(_blockBaseURL, "/patch"); } + private string _blockPatchDiffBaseURL { get => ConverterTool.CombineURLFromString(_blockPatchBaseURL, "/{0}"); } + private string _blockPatchDiffPath { get => ConverterTool.CombineURLFromString(_assetBasePath, "Asb/pc/Patch"); } + private string _blockBasePath { get => ConverterTool.CombineURLFromString(_assetBasePath, "Asb/pc/"); } + private bool _isOnlyRecoverMain { get; set; } + private KianaDispatch _gameServer { get; set; } #endregion #region ExtensionProperties diff --git a/CollapseLauncher/Classes/RepairManagement/Honkai/Repair.cs b/CollapseLauncher/Classes/RepairManagement/Honkai/Repair.cs index 964673cd5..58016d1a6 100644 --- a/CollapseLauncher/Classes/RepairManagement/Honkai/Repair.cs +++ b/CollapseLauncher/Classes/RepairManagement/Honkai/Repair.cs @@ -22,13 +22,10 @@ internal partial class HonkaiRepair private async Task Repair(List repairAssetIndex, CancellationToken token) { // Set total activity string as "Waiting for repair process to start..." - if (_status != null) - { - _status.ActivityStatus = Lang._GameRepairPage.Status11; - _status.IsProgressAllIndetermined = true; - _status.IsProgressPerFileIndetermined = true; - } - + _status.ActivityStatus = Lang._GameRepairPage.Status11; + _status.IsProgressAllIndetermined = true; + _status.IsProgressPerFileIndetermined = true; + // Update status UpdateStatus(); diff --git a/CollapseLauncher/Classes/RepairManagement/StarRail/Check.cs b/CollapseLauncher/Classes/RepairManagement/StarRail/Check.cs index 9bbf9e954..46fc093ac 100644 --- a/CollapseLauncher/Classes/RepairManagement/StarRail/Check.cs +++ b/CollapseLauncher/Classes/RepairManagement/StarRail/Check.cs @@ -70,14 +70,11 @@ private async Task Check(List assetIndex, CancellationToke List brokenAssetIndex = new List(); // Set Indetermined status as false - if (_status != null) - { - _status.IsProgressAllIndetermined = false; - _status.IsProgressPerFileIndetermined = false; + _status.IsProgressAllIndetermined = false; + _status.IsProgressPerFileIndetermined = false; - // Show the asset entry panel - _status.IsAssetEntryPanelShow = true; - } + // Show the asset entry panel + _status.IsAssetEntryPanelShow = true; // Await the task for parallel processing try @@ -119,11 +116,8 @@ private async Task Check(List assetIndex, CancellationToke private async ValueTask CheckGenericAssetType(FilePropertiesRemote asset, List targetAssetIndex, CancellationToken token) { // Update activity status - if (_status != null) - { - _status.ActivityStatus = string.Format(Lang._GameRepairPage.Status6, - StarRailRepairExtension.GetFileRelativePath(asset.N, _gamePath)); - } + _status.ActivityStatus = string.Format(Lang._GameRepairPage.Status6, + StarRailRepairExtension.GetFileRelativePath(asset.N, _gamePath)); // Increment current total count _progressAllCountCurrent++; @@ -218,11 +212,8 @@ void AddIndex() private async ValueTask CheckAssetType(FilePropertiesRemote asset, List targetAssetIndex, CancellationToken token) { // Update activity status - if (_status != null) - { - _status.ActivityStatus = string.Format(Lang._GameRepairPage.Status6, - StarRailRepairExtension.GetFileRelativePath(asset.N, _gamePath)); - } + _status.ActivityStatus = string.Format(Lang._GameRepairPage.Status6, + StarRailRepairExtension.GetFileRelativePath(asset.N, _gamePath)); // Increment current total count _progressAllCountCurrent++; diff --git a/CollapseLauncher/Classes/RepairManagement/StarRail/Fetch.cs b/CollapseLauncher/Classes/RepairManagement/StarRail/Fetch.cs index 1f38218eb..ba0e71309 100644 --- a/CollapseLauncher/Classes/RepairManagement/StarRail/Fetch.cs +++ b/CollapseLauncher/Classes/RepairManagement/StarRail/Fetch.cs @@ -65,11 +65,8 @@ internal partial class StarRailRepair private async Task Fetch(List assetIndex, CancellationToken token) { // Set total activity string as "Loading Indexes..." - if (_status != null) - { - _status.ActivityStatus = Lang._GameRepairPage.Status2; - _status.IsProgressAllIndetermined = true; - } + _status.ActivityStatus = Lang._GameRepairPage.Status2; + _status.IsProgressAllIndetermined = true; UpdateStatus(); StarRailRepairExtension.ClearHashtable(); @@ -376,7 +373,7 @@ private string[] GetCurrentAudioLangList(string fallbackCurrentLangname) Directory.CreateDirectory(audioLangPathDir); // Assign the default value and write to the file, then return. - returnValue = new string[] { fallbackCurrentLangname }; + returnValue = new[] { fallbackCurrentLangname }; if (audioLangListPathStatic != null) { File.WriteAllLines(audioLangListPathStatic, returnValue); @@ -389,7 +386,7 @@ private string[] GetCurrentAudioLangList(string fallbackCurrentLangname) returnValue = File.ReadAllLines(audioLangListPathStatic); if (returnValue.Length == 0) { - returnValue = new string[] { fallbackCurrentLangname }; + returnValue = new[] { fallbackCurrentLangname }; File.WriteAllLines(audioLangListPathStatic, returnValue); } diff --git a/CollapseLauncher/Classes/RepairManagement/StarRail/StarRailRepair.cs b/CollapseLauncher/Classes/RepairManagement/StarRail/StarRailRepair.cs index bc32a87a3..c3add0a99 100644 --- a/CollapseLauncher/Classes/RepairManagement/StarRail/StarRailRepair.cs +++ b/CollapseLauncher/Classes/RepairManagement/StarRail/StarRailRepair.cs @@ -55,7 +55,7 @@ public StarRailRepair(UIElement parentUI, IGameVersionCheck GameVersionManager, // Get flag to only recover main assets _isOnlyRecoverMain = onlyRecoverMainAsset; _innerGameVersionManager = GameVersionManager as GameTypeStarRailVersion; - _execName = Path.GetFileNameWithoutExtension(_innerGameVersionManager.GamePreset.GameExecutableName); + _execName = Path.GetFileNameWithoutExtension(_innerGameVersionManager!.GamePreset.GameExecutableName); } ~StarRailRepair() => Dispose(); diff --git a/CollapseLauncher/Classes/RepairManagement/Zenless/ZenlessRepair.Fetch.cs b/CollapseLauncher/Classes/RepairManagement/Zenless/ZenlessRepair.Fetch.cs index c811b85d7..8121a3330 100644 --- a/CollapseLauncher/Classes/RepairManagement/Zenless/ZenlessRepair.Fetch.cs +++ b/CollapseLauncher/Classes/RepairManagement/Zenless/ZenlessRepair.Fetch.cs @@ -442,13 +442,13 @@ private string[] GetCurrentAudioLangList(string fallbackCurrentLangname) // then create a new one from the fallback value if (audioLangListPath == null || !File.Exists(audioLangListPathStatic)) { - // Try check if the folder is exist. If not, create one. + // Try check if the folder is existed. If not, create one. string audioLangPathDir = Path.GetDirectoryName(audioLangListPathStatic); if (Directory.Exists(audioLangPathDir)) Directory.CreateDirectory(audioLangPathDir); // Assign the default value and write to the file, then return. - returnValue = new string[] { fallbackCurrentLangname }; + returnValue = new[] { fallbackCurrentLangname }; File.WriteAllLines(audioLangListPathStatic, returnValue); return returnValue; } @@ -457,7 +457,7 @@ private string[] GetCurrentAudioLangList(string fallbackCurrentLangname) returnValue = File.ReadAllLines(audioLangListPathStatic); if (returnValue.Length == 0) { - returnValue = new string[] { fallbackCurrentLangname }; + returnValue = new[] { fallbackCurrentLangname }; File.WriteAllLines(audioLangListPathStatic, returnValue); } @@ -467,13 +467,13 @@ private string[] GetCurrentAudioLangList(string fallbackCurrentLangname) // then create a new one from the fallback value if (audioLangListPathAlternative == null || !File.Exists(audioLangListPathAlternativeStatic)) { - // Try check if the folder is exist. If not, create one. + // Try check if the folder is existed. If not, create one. string audioLangPathDir = Path.GetDirectoryName(audioLangListPathAlternativeStatic); if (Directory.Exists(audioLangPathDir)) Directory.CreateDirectory(audioLangPathDir); // Assign the default value and write to the file, then return. - returnValueAlternate = new string[] { fallbackCurrentLangnameNative }; + returnValueAlternate = new[] { fallbackCurrentLangnameNative }; File.WriteAllLines(audioLangListPathAlternativeStatic, returnValueAlternate); return returnValueAlternate; } @@ -482,7 +482,7 @@ private string[] GetCurrentAudioLangList(string fallbackCurrentLangname) returnValueAlternate = File.ReadAllLines(audioLangListPathAlternativeStatic); if (returnValueAlternate.Length == 0) { - returnValueAlternate = new string[] { fallbackCurrentLangnameNative }; + returnValueAlternate = new[] { fallbackCurrentLangnameNative }; File.WriteAllLines(audioLangListPathAlternativeStatic, returnValueAlternate); } diff --git a/CollapseLauncher/Classes/RepairManagement/Zenless/ZenlessRepair.cs b/CollapseLauncher/Classes/RepairManagement/Zenless/ZenlessRepair.cs index 2d59027f9..b5bd88486 100644 --- a/CollapseLauncher/Classes/RepairManagement/Zenless/ZenlessRepair.cs +++ b/CollapseLauncher/Classes/RepairManagement/Zenless/ZenlessRepair.cs @@ -142,12 +142,9 @@ private async Task RepairRoutine() ResetStatusAndProgress(); // Set as completed - if (_status != null) - { - _status.IsCompleted = true; - _status.IsCanceled = false; - _status.ActivityStatus = IsCacheUpdateMode ? Locale.Lang._CachesPage.CachesStatusUpToDate : Locale.Lang._GameRepairPage.Status7; - } + _status.IsCompleted = true; + _status.IsCanceled = false; + _status.ActivityStatus = IsCacheUpdateMode ? Locale.Lang._CachesPage.CachesStatusUpToDate : Locale.Lang._GameRepairPage.Status7; // Update status and progress UpdateAll(); diff --git a/Hi3Helper.EncTool b/Hi3Helper.EncTool index c19bde013..137688e03 160000 --- a/Hi3Helper.EncTool +++ b/Hi3Helper.EncTool @@ -1 +1 @@ -Subproject commit c19bde0134d58860f3c85cc03873ba9444d4f504 +Subproject commit 137688e03c5f8adef925311ed9784e03e2e62732 diff --git a/Hi3Helper.Http b/Hi3Helper.Http index ab097531f..5757ee282 160000 --- a/Hi3Helper.Http +++ b/Hi3Helper.Http @@ -1 +1 @@ -Subproject commit ab097531ff12397e655ab7dfca838912c3b79fee +Subproject commit 5757ee28249d5bdaac91ae15ddd8f12e21cda2b3 diff --git a/Hi3Helper.SharpDiscordRPC b/Hi3Helper.SharpDiscordRPC index 9a23e58de..c599e4c8b 160000 --- a/Hi3Helper.SharpDiscordRPC +++ b/Hi3Helper.SharpDiscordRPC @@ -1 +1 @@ -Subproject commit 9a23e58dea30bfae50c557186c5b41dcdaceac49 +Subproject commit c599e4c8b6527ba89bd51eadd97969092171c891