Update runtime code
parent
bdc8285255
commit
b5f2174ed0
|
@ -146,7 +146,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = e.ToString();
|
||||
Error = e.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = e.ToString();
|
||||
Error = e.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ namespace YooAsset
|
|||
{
|
||||
_steps = ESteps.Done;
|
||||
Status = EOperationStatus.Failed;
|
||||
Error = e.ToString();
|
||||
Error = e.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace YooAsset
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
YooLogger.Warning($"Failed delete cache file : {filePath} Exception : {e}");
|
||||
YooLogger.Warning($"Failed delete cache file : {filePath} ! {e.Message}");
|
||||
}
|
||||
}
|
||||
_unusedCacheFilePaths.RemoveAt(i);
|
||||
|
|
|
@ -125,31 +125,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public void ParseFileName(int nameStype)
|
||||
{
|
||||
if (nameStype == 1)
|
||||
{
|
||||
FileName = FileHash;
|
||||
}
|
||||
else if (nameStype == 2)
|
||||
{
|
||||
string tempFileExtension = System.IO.Path.GetExtension(BundleName);
|
||||
FileName = $"{FileHash}{tempFileExtension}";
|
||||
}
|
||||
else if (nameStype == 3)
|
||||
{
|
||||
string tempFileExtension = System.IO.Path.GetExtension(BundleName);
|
||||
string tempBundleName = BundleName.Replace('/', '_').Replace(tempFileExtension, "");
|
||||
FileName = $"{tempBundleName}_{FileHash}";
|
||||
}
|
||||
else if (nameStype == 4)
|
||||
{
|
||||
string tempFileExtension = System.IO.Path.GetExtension(BundleName);
|
||||
string tempBundleName = BundleName.Replace('/', '_').Replace(tempFileExtension, "");
|
||||
FileName = $"{tempBundleName}_{FileHash}{tempFileExtension}";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
FileName = PatchManifest.CreateBundleFileName(nameStype, BundleName, FileHash);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -308,5 +308,37 @@ namespace YooAsset
|
|||
|
||||
return patchManifest;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成Bundle文件的正式名称
|
||||
/// </summary>
|
||||
public static string CreateBundleFileName(int nameStype, string bundleName, string fileHash)
|
||||
{
|
||||
if (nameStype == 1)
|
||||
{
|
||||
return fileHash;
|
||||
}
|
||||
else if (nameStype == 2)
|
||||
{
|
||||
string tempFileExtension = System.IO.Path.GetExtension(bundleName);
|
||||
return $"{fileHash}{tempFileExtension}";
|
||||
}
|
||||
else if (nameStype == 3)
|
||||
{
|
||||
string tempFileExtension = System.IO.Path.GetExtension(bundleName);
|
||||
string tempBundleName = bundleName.Replace('/', '_').Replace(tempFileExtension, "");
|
||||
return $"{tempBundleName}_{fileHash}";
|
||||
}
|
||||
else if (nameStype == 4)
|
||||
{
|
||||
string tempFileExtension = System.IO.Path.GetExtension(bundleName);
|
||||
string tempBundleName = bundleName.Replace('/', '_').Replace(tempFileExtension, "");
|
||||
return $"{tempBundleName}_{fileHash}{tempFileExtension}";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -148,6 +148,27 @@ namespace YooAsset
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建文件(如果已经存在则删除旧文件)
|
||||
/// </summary>
|
||||
public static void CreateFile(string filePath, byte[] data)
|
||||
{
|
||||
// 删除旧文件
|
||||
if (File.Exists(filePath))
|
||||
File.Delete(filePath);
|
||||
|
||||
// 创建文件夹路径
|
||||
CreateFileDirectory(filePath);
|
||||
|
||||
// 创建新文件
|
||||
using (FileStream fs = File.Create(filePath))
|
||||
{
|
||||
fs.Write(data, 0, data.Length);
|
||||
fs.Flush();
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建文件的文件夹路径
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue