概述
CfbWriter 将 CfbDocument 序列化为有效的 Compound File Binary 文件。调用 ToBytes 以获取序列化内容的字节数组,或调用 WriteFile 直接写入磁盘。内部的 Serialize 方法根据 MS-CFB 规范构建 FAT、DIFAT、mini-FAT 和目录扇区。构造函数在写入器内部用于表示条目记录和扇区链。
构造函数
| 签名 | 描述 |
|---|
Serializer(document: CfbDocument) | 使用指定的参数创建一个新的 CfbWriter。 |
EntryRecord(streamId: uint, name: string, objectType: DirectoryObjectType, clsid: byte[], stateBits: uint, creationTime: ulong, modifiedTime: ulong) | 使用指定的参数创建一个新的 CfbWriter。 |
Chain(payload: byte[]) | 使用指定的参数创建一个新的 CfbWriter。 |
方法
| 签名 | 描述 |
|---|
ToBytes(document: CfbDocument) | 将 document 序列化为符合 CFB 标准的字节数组。 |
WriteFile(document: CfbDocument, path: string) | 序列化 document 并将其写入位于 path 的文件。 |
Serialize() | 执行内部 CFB 布局:分配 FAT 扇区,构建目录条目,并返回完整的二进制。 |
属性
| 名称 | 类型 | 访问 | 描述 |
|---|
StreamId | uint | 读取 | 分配给此条目记录的零基目录索引。 |
Name | string | 读取 | UTF-16LE 条目名称,将显示在 CFB 目录中。 |
ObjectType | DirectoryObjectType | 读取 | 此条目对象类型字节中编码的 DirectoryObjectType 值。 |
Clsid | byte[] | 读取 | 写入此条目 CLSID 字段的 16 字节 CLSID。 |
StateBits | uint | 读取 | 写入此条目的应用程序定义的状态位。 |
CreationTime | ulong | 读取 | 写入此条目的创建时间戳(FILETIME)。 |
ModifiedTime | ulong | 读取 | 修改时间戳(FILETIME)已写入此条目。 |
StreamData | byte[] | 读取 | 流类型条目的有效负载字节(存储类型条目为空)。 |
Children | List<EntryRecord> | 读取 | 存储类型节点的子 EntryRecord 条目的有序列表。 |
ColorFlag | DirectoryColorFlag | 读取 | 写入此条目目录记录的红黑树颜色。 |
LeftSiblingId | uint | 读取 | 红黑树中左兄弟的流 ID。 |
RightSiblingId | uint | 读取 | 红黑树中右兄弟的流 ID。 |
ChildId | uint | 读取 | 第一个子条目的 Stream ID(用于 storage-type 节点)。 |
StartingSectorLocation | uint | 读取 | 此流数据的第一个 FAT 扇区索引。 |
StreamSize | ulong | 读取 | 流数据负载的字节大小。 |
IsRoot | bool | 读取 | 如果此条目是根存储条目(流 ID 0),则为 True。 |
IsStorage | bool | 读取 | 如果此条目是存储容器,则为 True。 |
IsStream | bool | 读取 | 如果此条目是数据流,则为 True。 |
Payload | byte[] | 读取 | 此条目的完整序列化字节(在链构建器内部使用)。 |
Sectors | List<uint> | 读取 | 分配给此条目数据的 FAT 扇区索引的有序列表。 |
FirstSector | uint | 读取 | 分配给此条目数据的第一个 FAT 扇区的索引。 |
另请参阅