1.4.5报错版本修改
All checks were successful
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 3s
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 3s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 19s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 5s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 32s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 4s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 16s
Plugin Library CI / publish (07.RKTools) (push) Successful in 3s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 3s
All checks were successful
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 3s
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 3s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 19s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 5s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 32s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 4s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 16s
Plugin Library CI / publish (07.RKTools) (push) Successful in 3s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 3s
This commit is contained in:
@@ -5,6 +5,7 @@ using Cysharp.Threading.Tasks;
|
|||||||
|
|
||||||
#if WECHAT_MINIGAME
|
#if WECHAT_MINIGAME
|
||||||
using WeChatWASM;
|
using WeChatWASM;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
using System.IO; // 仅在非微信平台使用
|
using System.IO; // 仅在非微信平台使用
|
||||||
using ICSharpCode.SharpZipLib.Zip;
|
using ICSharpCode.SharpZipLib.Zip;
|
||||||
@@ -14,7 +15,7 @@ namespace Stary.Evo.Unzip
|
|||||||
{
|
{
|
||||||
public static class CrossPlatformUnzip
|
public static class CrossPlatformUnzip
|
||||||
{
|
{
|
||||||
public static async UniTask UnzipAsync(string zipPath, string extractPath,
|
public static async UniTask UnzipAsync(string zipPath, string extractPath,
|
||||||
Action<float> progressCallback = null, bool deleteAfterExtract = true)
|
Action<float> progressCallback = null, bool deleteAfterExtract = true)
|
||||||
{
|
{
|
||||||
#if WECHAT_MINIGAME && UNITY_WEBGL
|
#if WECHAT_MINIGAME && UNITY_WEBGL
|
||||||
@@ -32,7 +33,7 @@ namespace Stary.Evo.Unzip
|
|||||||
#region 1. 微信小程序实现(零 System.IO)
|
#region 1. 微信小程序实现(零 System.IO)
|
||||||
|
|
||||||
#if WECHAT_MINIGAME
|
#if WECHAT_MINIGAME
|
||||||
private static async UniTask UnzipWeChatNativeAsync(string zipPath, string extractPath,
|
private static async UniTask UnzipWeChatNativeAsync(string zipPath, string extractPath,
|
||||||
Action<float> progressCallback, bool deleteAfterExtract)
|
Action<float> progressCallback, bool deleteAfterExtract)
|
||||||
{
|
{
|
||||||
var tcs = new UniTaskCompletionSource();
|
var tcs = new UniTaskCompletionSource();
|
||||||
@@ -40,24 +41,24 @@ namespace Stary.Evo.Unzip
|
|||||||
|
|
||||||
// 检查 ZIP 存在(使用微信 API)
|
// 检查 ZIP 存在(使用微信 API)
|
||||||
bool fileExists = false;
|
bool fileExists = false;
|
||||||
fs.Access(new AccessOption()
|
fs.Access(new AccessParam()
|
||||||
{
|
{
|
||||||
path = zipPath,
|
path = zipPath,
|
||||||
success = (res) => fileExists = true,
|
success = (res) => fileExists = true,
|
||||||
fail = (err) => { }
|
fail = (err) => { }
|
||||||
});
|
});
|
||||||
|
|
||||||
await UniTask.Delay(50); // 等待异步结果
|
await UniTask.Delay(50); // 等待异步结果
|
||||||
if (!fileExists)
|
if (!fileExists)
|
||||||
throw new Exception($"ZIP 不存在: {zipPath}");
|
throw new Exception($"ZIP 不存在: {zipPath}");
|
||||||
|
|
||||||
// 清理目标目录(递归删除)
|
// 清理目标目录(递归删除)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fs.RmdirSync(extractPath, true);
|
fs.RmdirSync(extractPath, true);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// 目录不存在或已删除
|
// 目录不存在或已删除
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ namespace Stary.Evo.Unzip
|
|||||||
var progressTask = SimulateProgressAsync(progressCallback, () => reportedProgress >= 1f);
|
var progressTask = SimulateProgressAsync(progressCallback, () => reportedProgress >= 1f);
|
||||||
|
|
||||||
// 微信原生解压(性能最佳,C++ 实现)
|
// 微信原生解压(性能最佳,C++ 实现)
|
||||||
WX.Unzip(new UnzipOption()
|
WX.GetFileSystemManager().Unzip(new UnzipOption()
|
||||||
{
|
{
|
||||||
zipFilePath = zipPath,
|
zipFilePath = zipPath,
|
||||||
targetPath = extractPath,
|
targetPath = extractPath,
|
||||||
@@ -79,10 +80,7 @@ namespace Stary.Evo.Unzip
|
|||||||
progressCallback?.Invoke(1f);
|
progressCallback?.Invoke(1f);
|
||||||
tcs.TrySetResult();
|
tcs.TrySetResult();
|
||||||
},
|
},
|
||||||
fail = (err) =>
|
fail = (err) => { tcs.TrySetException(new Exception($"微信解压失败: {err.errMsg}")); }
|
||||||
{
|
|
||||||
tcs.TrySetException(new Exception($"微信解压失败: {err.errMsg}"));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await tcs.Task;
|
await tcs.Task;
|
||||||
@@ -98,7 +96,7 @@ namespace Stary.Evo.Unzip
|
|||||||
private static async UniTask SimulateProgressAsync(Action<float> callback, Func<bool> isCompleted)
|
private static async UniTask SimulateProgressAsync(Action<float> callback, Func<bool> isCompleted)
|
||||||
{
|
{
|
||||||
if (callback == null) return;
|
if (callback == null) return;
|
||||||
|
|
||||||
float progress = 0f;
|
float progress = 0f;
|
||||||
while (!isCompleted())
|
while (!isCompleted())
|
||||||
{
|
{
|
||||||
@@ -108,16 +106,16 @@ namespace Stary.Evo.Unzip
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DeleteWeChatFileSafe(FileSystemManager fs, string path)
|
private static void DeleteWeChatFileSafe(WXFileSystemManager fs, string path)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fs.UnlinkSync(path);
|
fs.UnlinkSync(path);
|
||||||
Debug.Log($"[微信] 已删除 ZIP");
|
Debug.Log($"[微信] 已删除 ZIP");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"[微信] 删除失败: {ex.Message}");
|
Debug.LogWarning($"[微信] 删除失败: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,8 +220,8 @@ namespace Stary.Evo.Unzip
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 3. PC/移动端实现(标准 System.IO)
|
#region 3. PC/移动端实现(标准 System.IO)
|
||||||
|
#if !UNITY_WEBGL && !WECHAT_MINIGAME
|
||||||
private static async UniTask UnzipStandardAsync(string zipPath, string extractPath,
|
private static async UniTask UnzipStandardAsync(string zipPath, string extractPath,
|
||||||
Action<float> progressCallback, bool deleteAfterExtract)
|
Action<float> progressCallback, bool deleteAfterExtract)
|
||||||
{
|
{
|
||||||
await UniTask.SwitchToThreadPool();
|
await UniTask.SwitchToThreadPool();
|
||||||
@@ -234,7 +232,7 @@ namespace Stary.Evo.Unzip
|
|||||||
throw new FileNotFoundException($"ZIP 不存在: {zipPath}");
|
throw new FileNotFoundException($"ZIP 不存在: {zipPath}");
|
||||||
|
|
||||||
string fullExtractPath = Path.GetFullPath(extractPath);
|
string fullExtractPath = Path.GetFullPath(extractPath);
|
||||||
|
|
||||||
if (Directory.Exists(extractPath))
|
if (Directory.Exists(extractPath))
|
||||||
Directory.Delete(extractPath, true);
|
Directory.Delete(extractPath, true);
|
||||||
Directory.CreateDirectory(extractPath);
|
Directory.CreateDirectory(extractPath);
|
||||||
@@ -244,7 +242,8 @@ namespace Stary.Evo.Unzip
|
|||||||
{
|
{
|
||||||
int total = 0;
|
int total = 0;
|
||||||
foreach (ZipEntry entry in zipFile)
|
foreach (ZipEntry entry in zipFile)
|
||||||
if (entry.IsFile) total++;
|
if (entry.IsFile)
|
||||||
|
total++;
|
||||||
|
|
||||||
int processed = 0;
|
int processed = 0;
|
||||||
foreach (ZipEntry entry in zipFile)
|
foreach (ZipEntry entry in zipFile)
|
||||||
@@ -263,7 +262,7 @@ namespace Stary.Evo.Unzip
|
|||||||
}
|
}
|
||||||
|
|
||||||
processed++;
|
processed++;
|
||||||
|
|
||||||
await UniTask.SwitchToMainThread();
|
await UniTask.SwitchToMainThread();
|
||||||
progressCallback?.Invoke((float)processed / total);
|
progressCallback?.Invoke((float)processed / total);
|
||||||
await UniTask.SwitchToThreadPool();
|
await UniTask.SwitchToThreadPool();
|
||||||
@@ -277,7 +276,7 @@ namespace Stary.Evo.Unzip
|
|||||||
File.Delete(zipPath);
|
File.Delete(zipPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 4. 公共工具(平台特定)
|
#region 4. 公共工具(平台特定)
|
||||||
@@ -301,7 +300,7 @@ namespace Stary.Evo.Unzip
|
|||||||
{
|
{
|
||||||
#if WECHAT_MINIGAME
|
#if WECHAT_MINIGAME
|
||||||
bool exists = false;
|
bool exists = false;
|
||||||
WX.GetFileSystemManager().Access(new AccessOption()
|
WX.GetFileSystemManager().Access(new AccessParam()
|
||||||
{
|
{
|
||||||
path = path,
|
path = path,
|
||||||
success = (res) => exists = true,
|
success = (res) => exists = true,
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ using Cysharp.Threading.Tasks;
|
|||||||
using Stary.Evo.Unzip;
|
using Stary.Evo.Unzip;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
|
#if WEIXINMINIGAME
|
||||||
using WeChatWASM;
|
using WeChatWASM;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Stary.Evo
|
namespace Stary.Evo
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
"com.audiocore.runtime",
|
"com.audiocore.runtime",
|
||||||
"com.stary.evo.runtime",
|
"com.stary.evo.runtime",
|
||||||
"HybridCLR.Runtime",
|
"HybridCLR.Runtime",
|
||||||
"ImmersalSDK",
|
|
||||||
"Informationsave.runtime",
|
"Informationsave.runtime",
|
||||||
"DOTween.Modules",
|
"DOTween.Modules",
|
||||||
"com.stary.buildoriginality.runtime",
|
"com.stary.buildoriginality.runtime",
|
||||||
|
|||||||
Reference in New Issue
Block a user