pvfUtility 支持通过插件扩展工具栏与脚本能力。以下是最小可用的接入方式,服务端只负责把文档发出来,接口本身由客户端调用。
插件放在 pvfUtility 目录下的 Plugins/<插件名>/,入口文件固定为 plugin.json 与 main.dll。
Plugins/
my-plugin/
plugin.json
main.dll
name 唯一标识;entry 指向程序集;commands 声明暴露到工具栏的菜单项。
{
"name": "my-plugin",
"version": "1.0.0",
"entry": "main.dll",
"commands": [
{ "id": "hello", "title": "示例命令" }
]
}
插件通过宿主注入的 IPvfHost 访问当前打开的 PVF,读写都走同一个上下文,不要自己打开文件句柄。
public void Run(IPvfHost host)
{
var text = host.ReadText("equipment/character/common/amulet/100300001.equ");
host.SetText("equipment/character/common/amulet/100300001.equ",
text.Replace("旧名字", "新名字"));
}