com.alicizax.unity.tuyoogam.../Runtime/FileSystem/DefaultCacheFileSystem/Elements/RecordFileElement.cs

47 lines
1.3 KiB
C#
Raw Normal View History

2025-04-01 21:12:28 +08:00
using System;
using System.IO;
2025-01-09 11:31:04 +08:00
namespace YooAsset
{
internal class RecordFileElement
{
public string InfoFilePath { private set; get; }
public string DataFilePath { private set; get; }
2025-09-10 16:04:39 +08:00
public uint DataFileCRC { private set; get; }
2025-01-09 11:31:04 +08:00
public long DataFileSize { private set; get; }
2025-04-01 21:12:28 +08:00
2025-09-10 16:04:39 +08:00
public RecordFileElement(string infoFilePath, string dataFilePath, uint dataFileCRC, long dataFileSize)
2025-01-09 11:31:04 +08:00
{
InfoFilePath = infoFilePath;
DataFilePath = dataFilePath;
DataFileCRC = dataFileCRC;
DataFileSize = dataFileSize;
}
2025-04-01 21:12:28 +08:00
/// <summary>
/// 删除记录文件
/// </summary>
public bool DeleteFolder()
{
try
{
string directory = Path.GetDirectoryName(InfoFilePath);
DirectoryInfo directoryInfo = new DirectoryInfo(directory);
if (directoryInfo.Exists)
{
directoryInfo.Delete(true);
return true;
}
else
{
return false;
}
}
catch (Exception e)
{
YooLogger.Error($"Failed to delete cache file ! {e.Message}");
return false;
}
}
2025-01-09 11:31:04 +08:00
}
}