mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-26 10:40:14 +00:00
优化打包速度,提示编辑器启动速度,md5替换xxhash,速度提升一倍以上
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using Standart.Hash.xxHash;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
@@ -280,6 +281,28 @@ namespace YooAsset
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件的XXXhash32
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
public static string FileXXhash(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
{
|
||||
return xxHash32.ComputeHash(fs).ToString("x8");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
YooLogger.Exception(e);
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取数据流的MD5
|
||||
|
||||
Reference in New Issue
Block a user