2024-11-29 21:37:01 +08:00

36 lines
1007 B
C#

namespace YooAsset
{
internal class RawBundle
{
private readonly IFileSystem _fileSystem;
private readonly PackageBundle _packageBundle;
private readonly string _filePath;
internal RawBundle(IFileSystem fileSystem, PackageBundle packageBundle, string filePath)
{
_fileSystem = fileSystem;
_packageBundle = packageBundle;
_filePath = filePath;
}
public string GetFilePath()
{
return _filePath;
}
public byte[] ReadFileData()
{
if (_fileSystem != null)
return _fileSystem.ReadFileData(_packageBundle);
else
return FileUtility.ReadAllBytes(_filePath);
}
public string ReadFileText()
{
if (_fileSystem != null)
return _fileSystem.ReadFileText(_packageBundle);
else
return FileUtility.ReadAllText(_filePath);
}
}
}