docs: update resources API docs

This commit is contained in:
2026-03-20 02:35:35 +08:00
parent fd792b7df1
commit ea756c0177
314 changed files with 9439 additions and 1360 deletions

View File

@@ -0,0 +1,42 @@
# FileArchive::Read
读取文件数据。
## 方法签名
```cpp
bool Read(const Containers::String& fileName, void* buffer, size_t size, size_t offset) const override;
```
## 详细描述
从归档中读取指定文件的全部或部分内容。文件路径是相对于归档目录的路径。
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `fileName` | `const Containers::String&` | 要读取的文件名(相对于归档路径) |
| `buffer` | `void*` | 读取数据的目标缓冲区 |
| `size` | `size_t` | 要读取的字节数 |
| `offset` | `size_t` | 文件内起始偏移位置 |
## 返回值
| 类型 | 描述 |
|------|------|
| `bool` | 读取成功返回 `true`,失败返回 `false` |
## 示例
```cpp
FileArchive archive;
archive.Open("resources/");
size_t fileSize = archive.GetSize("textures/player.png");
Containers::Array<Core::uint8> buffer(fileSize);
if (archive.Read("textures/player.png", buffer.Data(), fileSize, 0)) {
// 文件读取成功
}
```