Skip to content

Commit 266cc59

Browse files
committed
✨ 更新拉取版本逻辑
1 parent 75e90ba commit 266cc59

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Extensions/YooAsset.CLI/Runtime/1.5.7/Handle/Action.UpdatePackages.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Reflection;
66
using System.Runtime.CompilerServices;
7+
using System.Text;
78
using System.Threading.Tasks;
89
using UnityEngine.Networking;
910

@@ -12,10 +13,7 @@ namespace AIO.UEngine.YooAsset
1213
partial class Proxy
1314
{
1415
/// <inheritdoc />
15-
public override IOperationAction<bool> UpdatePackagesTask(ASConfig config, Action<bool> completed = null)
16-
{
17-
return new ActionUpdatePackages(config, completed);
18-
}
16+
public override IOperationAction<bool> UpdatePackagesTask(ASConfig config, Action<bool> completed = null) { return new ActionUpdatePackages(config, completed); }
1917

2018
private static bool CheckPackages(string remote, string content, out AssetsPackageConfig[] packages)
2119
{
@@ -63,8 +61,7 @@ private static bool CheckPackages(string remote, string content, out AssetsPacka
6361
return true;
6462
}
6563

66-
private static string GetPackageManifestVersionUrl(ASConfig config, AssetsPackageConfig item) =>
67-
$"{config.URL}/{AssetSystem.PlatformNameStr}/{item.Name}/{item.Version}/PackageManifest_{item.Name}.version?t={DateTime.Now.Ticks}";
64+
private static string GetPackageManifestVersionUrl(ASConfig config, AssetsPackageConfig item) => $"{config.URL}/{AssetSystem.PlatformNameStr}/{item.Name}/{item.Version}/PackageManifest_{item.Name}.version?t={DateTime.Now.Ticks}";
6865

6966
/// <summary>
7067
/// 更新资源包列表
@@ -81,7 +78,7 @@ private static bool UpdatePackagesRemoteSync(ASConfig config)
8178
string content;
8279
try
8380
{
84-
content = AHelper.HTTP.Get(remote);
81+
content = AHelper.HTTP.Get(remote, Encoding.UTF8);
8582
}
8683
catch (Exception)
8784
{
@@ -96,7 +93,7 @@ private static bool UpdatePackagesRemoteSync(ASConfig config)
9693
item.IsLatest = item.Version == "Latest"; // 如果使用Latest则认为是最新版本 同时需要获取最新版本号
9794
if (!item.IsLatest) continue;
9895
var url = GetPackageManifestVersionUrl(config, item);
99-
var temp = AHelper.HTTP.Get(url);
96+
var temp = AHelper.HTTP.Get(url, Encoding.UTF8);
10097
if (string.IsNullOrEmpty(temp))
10198
{
10299
AssetSystem.LogError($"{url} Request failed");
@@ -127,7 +124,7 @@ private static async Task<bool> UpdatePackagesRemoteTask(ASConfig config)
127124
string content;
128125
try
129126
{
130-
content = await AHelper.HTTP.GetAsync(remote);
127+
content = await AHelper.HTTP.GetAsync(remote, Encoding.UTF8);
131128
}
132129
catch (Exception e)
133130
{
@@ -143,7 +140,7 @@ private static async Task<bool> UpdatePackagesRemoteTask(ASConfig config)
143140
item.IsLatest = item.Version == "Latest"; // 如果使用Latest则认为是最新版本 同时需要获取最新版本号
144141
if (!item.IsLatest) continue;
145142
var url = GetPackageManifestVersionUrl(config, item);
146-
var temp = await AHelper.HTTP.GetAsync(url);
143+
var temp = await AHelper.HTTP.GetAsync(url, Encoding.UTF8);
147144
if (string.IsNullOrEmpty(temp))
148145
{
149146
AssetSystem.LogError($"{url} Request failed");

0 commit comments

Comments
 (0)