- add: unpack think

This commit is contained in:
2025-04-20 15:43:57 +03:00
parent 51741595c6
commit 11eb3eb865
6 changed files with 53 additions and 40 deletions

View File

@@ -64,11 +64,9 @@ public partial class ContentService
return await EnsureItems(manifestReader, info.DownloadUri, loadingHandler, cancellationToken);
}
public async Task Unpack(RobustManifestInfo info, IWriteFileApi otherApi, ILoadingHandler loadingHandler,
CancellationToken cancellationToken)
public void Unpack(HashApi hashApi, IWriteFileApi otherApi, ILoadingHandler loadingHandler)
{
debugService.Log("Unpack manifest files");
var hashApi = await EnsureItems(info, loadingHandler, cancellationToken);
var items = hashApi.Manifest.Values.ToList();
loadingHandler.AppendJob(items.Count);
foreach (var item in items)
@@ -86,6 +84,11 @@ public partial class ContentService
loadingHandler.AppendResolvedJob();
}
if (loadingHandler is IDisposable disposable)
{
disposable.Dispose();
}
}
public async Task Download(Uri contentCdn, List<RobustManifestItem> toDownload, HashApi hashApi, ILoadingHandler loadingHandler,

View File

@@ -74,6 +74,13 @@ public class FileService
{
return new FileApi(Path.Join(RootPath, path));
}
public IReadWriteFileApi EnsureTempDir(out string path)
{
path = Path.Combine(Path.GetTempPath(), "tempThink"+Path.GetRandomFileName());
Directory.CreateDirectory(path);
return new FileApi(path);
}
public ZipFileApi? OpenZip(string path, IFileApi fileApi)
{