WebGL 용 코드 추가

This commit is contained in:
logonkhi
2025-11-10 16:38:43 +09:00
parent f3d950fce7
commit 9277bab6dd
14 changed files with 433 additions and 35 deletions

View File

@@ -108,12 +108,23 @@ namespace UVC.Util
{
//getFileInfo zip 내의 콘텐츠의 총 압축되지 않은 바이트를 반환한다.
ulong totalBytes = lzip.getFileInfo(zipFilePath);
#if UNITY_WEBGL && !UNITY_EDITOR
// WebGL: ThreadPool 사용 불가 → 동기 처리
OnProgress?.Invoke(0, (long)totalBytes, 0f);
int result = lzip.decompress_File(zipFilePath, decompressFolderPath, progress, null, progress2);
isComplete = true;
percent = 1f;
OnProgress?.Invoke((long)totalBytes, (long)totalBytes, 1f);
#else
CountPercentZipAsync(totalBytes).Forget();
int result = await UniTask.RunOnThreadPool(() =>
{
return lzip.decompress_File(zipFilePath, decompressFolderPath, progress, null, progress2);
});
isComplete = true;
#endif
if (result == 1) //success
{
return null;
@@ -193,12 +204,23 @@ namespace UVC.Util
//fsecurity.AddAccessRule(new FileSystemAccessRule(new NTAccount(name[1]), FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow));
//fileInfo.SetAccessControl(fsecurity);
long totalBytes = lzma.getFileSize(zipFilePath);
#if UNITY_WEBGL && !UNITY_EDITOR
// WebGL: ThreadPool 미사용, 동기 처리
OnProgress?.Invoke(0, totalBytes, 0f);
int result = lzma.doDecompress7zip(zipFilePath, decompressFolderPath, progress, true, true);
isComplete = true;
percent = 1f;
OnProgress?.Invoke(totalBytes, totalBytes, 1f);
#else
CountPercent7ZipAsync(totalBytes, true).Forget();
int result = await UniTask.RunOnThreadPool(() =>
{
return lzma.doDecompress7zip(zipFilePath, decompressFolderPath, progress, true, true);
});
isComplete = true;
#endif
if (result == 1) //success
{
return null;