mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
更新demo
更新demo
This commit is contained in:
@@ -1,36 +1,19 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class CacheFileInfo
|
||||
{
|
||||
private static readonly BufferWriter SharedBuffer = new BufferWriter(1024);
|
||||
public class CacheFileInfo
|
||||
{
|
||||
public string RemoteFileName { private set; get; }
|
||||
public string FilePath { private set; get; }
|
||||
public string FileCRC { private set; get; }
|
||||
public long FileSize { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 写入资源包信息
|
||||
/// </summary>
|
||||
public static void WriteInfoToFile(string filePath, string dataFileCRC, long dataFileSize)
|
||||
{
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
{
|
||||
SharedBuffer.Clear();
|
||||
SharedBuffer.WriteUTF8(dataFileCRC);
|
||||
SharedBuffer.WriteInt64(dataFileSize);
|
||||
SharedBuffer.WriteToStream(fs);
|
||||
fs.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取资源包信息
|
||||
/// </summary>
|
||||
public static void ReadInfoFromFile(string filePath, out string dataFileCRC, out long dataFileSize)
|
||||
{
|
||||
byte[] binaryData = FileUtility.ReadAllBytes(filePath);
|
||||
BufferReader buffer = new BufferReader(binaryData);
|
||||
dataFileCRC = buffer.ReadUTF8();
|
||||
dataFileSize = buffer.ReadInt64();
|
||||
}
|
||||
}
|
||||
public CacheFileInfo(string remoteFileName, string filePath, string fileCRC, long fileSize)
|
||||
{
|
||||
RemoteFileName = remoteFileName;
|
||||
FilePath = filePath;
|
||||
FileCRC = fileCRC;
|
||||
FileSize = fileSize;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user