diff --git a/CollapseLauncher/Classes/RepairManagement/StarRail/Fetch.cs b/CollapseLauncher/Classes/RepairManagement/StarRail/Fetch.cs index 9e30cdcf0..3d6a596d0 100644 --- a/CollapseLauncher/Classes/RepairManagement/StarRail/Fetch.cs +++ b/CollapseLauncher/Classes/RepairManagement/StarRail/Fetch.cs @@ -104,7 +104,7 @@ private async Task Fetch(List assetIndex, CancellationToke // Initialize the metadata tool (including dispatcher and gateway). // Perform this if only base._isVersionOverride is false to indicate that the repair performed is // not for delta patch integrity check. - if (!base._isVersionOverride && !this._isOnlyRecoverMain && await _innerGameVersionManager.StarRailMetadataTool.Initialize(token, downloadClient, _httpClient_FetchAssetProgress, GetExistingGameRegionID(), Path.Combine(_gamePath, $"{Path.GetFileNameWithoutExtension(_innerGameVersionManager.GamePreset.GameExecutableName)}_Data\\Persistent"))) + if (!_isVersionOverride && !this._isOnlyRecoverMain && await _innerGameVersionManager.StarRailMetadataTool.Initialize(token, downloadClient, _httpClient_FetchAssetProgress, GetExistingGameRegionID(), Path.Combine(_gamePath, $"{Path.GetFileNameWithoutExtension(_innerGameVersionManager.GamePreset.GameExecutableName)}_Data\\Persistent"))) { // Read block metadata and convert to FilePropertiesRemote await _innerGameVersionManager.StarRailMetadataTool.ReadAsbMetadataInformation(downloadClient, _httpClient_FetchAssetProgress, token); @@ -223,35 +223,28 @@ private void ConvertPkgVersionToAssetIndex(List pkgVersion #endregion #region Utilities - private FilePropertiesRemote GetNormalizedFilePropertyTypeBased(string remoteAbsolutePath, string remoteRelativePath, long fileSize, - string hash, FileType type, bool isPatchApplicable, bool isHasHashMark) => - GetNormalizedFilePropertyTypeBased(remoteAbsolutePath, remoteRelativePath, fileSize, - hash, type, false, isPatchApplicable, isHasHashMark); - private FilePropertiesRemote GetNormalizedFilePropertyTypeBased(string remoteParentURL, string remoteRelativePath, long fileSize, string hash, FileType type = FileType.Generic, - bool isPkgVersion = true, bool isPatchApplicable = false, bool isHasHashMark = false) { - string localAbsolutePath, - remoteAbsolutePath = type switch - { - FileType.Generic => CombineURLFromString(remoteParentURL, remoteRelativePath), - _ => remoteParentURL - }, + string remoteAbsolutePath = type switch + { + FileType.Generic => CombineURLFromString(remoteParentURL, remoteRelativePath), + _ => remoteParentURL + }, typeAssetRelativeParentPath = string.Format(type switch - { - FileType.Blocks => _assetGameBlocksStreamingPath, - FileType.Audio => _assetGameAudioStreamingPath, - FileType.Video => _assetGameVideoStreamingPath, - _ => string.Empty - }, _execName); - - localAbsolutePath = Path.Combine(_gamePath, typeAssetRelativeParentPath, NormalizePath(remoteRelativePath)); + { + FileType.Blocks => _assetGameBlocksStreamingPath, + FileType.Audio => _assetGameAudioStreamingPath, + FileType.Video => _assetGameVideoStreamingPath, + _ => string.Empty + }, _execName); + + var localAbsolutePath = Path.Combine(_gamePath, typeAssetRelativeParentPath, NormalizePath(remoteRelativePath)); return new FilePropertiesRemote { diff --git a/CollapseLauncher/Classes/RepairManagement/StarRail/Repair.cs b/CollapseLauncher/Classes/RepairManagement/StarRail/Repair.cs index d9bd0076e..6fe5cf417 100644 --- a/CollapseLauncher/Classes/RepairManagement/StarRail/Repair.cs +++ b/CollapseLauncher/Classes/RepairManagement/StarRail/Repair.cs @@ -110,7 +110,7 @@ private async Task RepairAssetTypeGeneric((FilePropertiesRemote AssetIndex, IAss // If asset type is unused, then delete it if (asset.AssetIndex.FT == FileType.Unused) { - FileInfo fileInfo = new FileInfo(asset.AssetIndex.N); + FileInfo fileInfo = new FileInfo(asset.AssetIndex.N!); if (fileInfo.Exists) { fileInfo.IsReadOnly = false; @@ -122,7 +122,7 @@ private async Task RepairAssetTypeGeneric((FilePropertiesRemote AssetIndex, IAss else { // Start asset download task - await RunDownloadTask(asset.AssetIndex.S, asset.AssetIndex.N, asset.AssetIndex.RN, downloadClient, downloadProgress, token); + await RunDownloadTask(asset.AssetIndex.S, asset.AssetIndex.N!, asset.AssetIndex.RN, downloadClient, downloadProgress, token); LogWriteLine($"File [T: {asset.AssetIndex.FT}] {(asset.AssetIndex.FT == FileType.Blocks ? asset.AssetIndex.CRC : asset.AssetIndex.N)} has been downloaded!", LogType.Default, true); }