|
1 | 1 | using CollapseLauncher.Helper.StreamUtility; |
2 | 2 | using Hi3Helper; |
3 | 3 | using Hi3Helper.Data; |
| 4 | +using Hi3Helper.EncTool; |
4 | 5 | using Hi3Helper.EncTool.Parser.AssetIndex; |
5 | 6 | using Hi3Helper.EncTool.Parser.Sleepy; |
6 | 7 | using Hi3Helper.Shared.ClassStruct; |
@@ -55,12 +56,10 @@ internal static async IAsyncEnumerable<PkgVersionProperties> RegisterSleepyFileI |
55 | 56 | string persistentPath, |
56 | 57 | [EnumeratorCancellation] CancellationToken token = default) |
57 | 58 | { |
58 | | - string manifestFileUrl = ConverterTool.CombineURLFromString(fileInfo.BaseUrl, fileInfo.ReferenceFileInfo.FileName); |
59 | | - using HttpResponseMessage responseMessage = await httpClient.GetAsync(manifestFileUrl, HttpCompletionOption.ResponseHeadersRead, token); |
| 59 | + string manifestFileUrl = fileInfo.BaseUrl.CombineURLFromString(fileInfo.ReferenceFileInfo.FileName); |
| 60 | + string filePath = Path.Combine(persistentPath, fileInfo.ReferenceFileInfo.FileName + "_persist"); |
60 | 61 |
|
61 | | - string filePath = Path.Combine(persistentPath, fileInfo.ReferenceFileInfo.FileName + "_persist"); |
62 | | - |
63 | | - await using Stream responseStream = await responseMessage.Content.ReadAsStreamAsync(token); |
| 62 | + await using Stream responseStream = (await httpClient.TryGetCachedStreamFrom(manifestFileUrl, null, token)).Stream; |
64 | 63 | await using Stream responseInterceptedStream = new JsonFieldToEnumerableStream(needWriteToLocal ? filePath : null, responseStream); |
65 | 64 |
|
66 | 65 | IAsyncEnumerable<ZenlessResManifestAsset?> enumerable = JsonSerializer |
@@ -196,7 +195,7 @@ private static FilePropertiesRemote GetNormalizedFilePropertyTypeBased(string re |
196 | 195 | { |
197 | 196 | string remoteAbsolutePath = type switch |
198 | 197 | { |
199 | | - FileType.Generic => ConverterTool.CombineURLFromString(remoteParentURL, remoteRelativePath), |
| 198 | + FileType.Generic => remoteParentURL.CombineURLFromString(remoteRelativePath), |
200 | 199 | _ => remoteParentURL |
201 | 200 | }; |
202 | 201 | string localAbsolutePath = Path.Combine(baseLocalPath, ConverterTool.NormalizePath(remoteRelativePath)); |
|
0 commit comments