Skip to content

Commit 9cce3af

Browse files
committed
Allow Genshin Repair if no dispatch token is available
1 parent 52c70c7 commit 9cce3af

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

  • CollapseLauncher/Classes/RepairManagement/Genshin

CollapseLauncher/Classes/RepairManagement/Genshin/Repair.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// ReSharper disable StringLiteralTypo
2222
// ReSharper disable CommentTypo
2323

24+
#nullable enable
2425
namespace CollapseLauncher
2526
{
2627
internal partial class GenshinRepair
@@ -46,7 +47,15 @@ private async Task<bool> Repair(List<PkgVersionProperties> repairAssetIndex, Can
4647
DownloadClient downloadClient = DownloadClient.CreateInstance(client);
4748

4849
// Get the Dispatcher Query
49-
QueryProperty queryProperty = await GetCachedDispatcherQuery(downloadClient.GetHttpClient(), token);
50+
QueryProperty? queryProperty = null;
51+
try
52+
{
53+
queryProperty = await GetCachedDispatcherQuery(downloadClient.GetHttpClient(), token);
54+
}
55+
catch (Exception ex)
56+
{
57+
LogWriteLine($"An error has occurred while parsing Persistent Manifests! {ex}", LogType.Warning, true);
58+
}
5059

5160
// Iterate repair asset
5261
ObservableCollection<IAssetProperty> assetProperty = [.. AssetEntry];
@@ -97,7 +106,10 @@ await Parallel.ForEachAsync(
97106
}
98107
}
99108

100-
await SavePersistentRevision(queryProperty, token);
109+
if (queryProperty != null)
110+
{
111+
await SavePersistentRevision(queryProperty, token);
112+
}
101113

102114
// Duplicate ctable.dat to ctable_streaming.dat
103115
string streamingAssetsPath = Path.Combine(GamePath, $"{ExecPrefix}_Data", "StreamingAssets");
@@ -157,7 +169,7 @@ private async Task RepairAssetTypeGeneric((PkgVersionProperties AssetIndex, IAss
157169
if (isUseSophonDownload)
158170
{
159171
ReadOnlySpan<char> splittedPath = asset.AssetIndex.remoteName.TrimStart('\\');
160-
if (!SophonAssetDictRefLookup.TryGetValue(splittedPath, out SophonAsset downloadAsSophon))
172+
if (!SophonAssetDictRefLookup.TryGetValue(splittedPath, out SophonAsset? downloadAsSophon))
161173
{
162174
throw new InvalidOperationException($"Asset {splittedPath} is marked as \"SophonGeneric\" but it wasn't included in the manifest");
163175
}

0 commit comments

Comments
 (0)