diff --git a/README.md b/README.md index ee611b2..c5e1075 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,33 @@ The RID-first native library probe uses the McMaster fork; check that out as a s - **This repository alone** (CI, and any external consumer) → `PackageReference`, pinned to an exact version. +## Options and status + +The constructor overload accepts `PluginManagerOptions`. `UnloadVerificationTimeout` defaults to +30 seconds; a finite value must be positive and no more than about 49.7 days, and +`Timeout.InfiniteTimeSpan` disables the timer. A timeout is a failed unload: the report says so, +and the slot stays `Detached`, so `Plugins` keeps returning it. + +```csharp +var options = new PluginManagerOptions +{ + UnloadVerificationTimeout = TimeSpan.FromSeconds(60), +}; + +var manager = new PluginManager( + pluginsRoot, dataRoot, configRoot, reportFault, + carrierServices, onRemoved, options); +``` + +`Plugins` returns a read-only snapshot of every slot, including `Detached` ones; +`TryGetPlugin(name, out var info)` reads one by name. `PluginInfo` carries `Name`, `Version`, +`Loader`, `State`, `Enabled`, `IsLoader`, and `Dependencies`. + +```csharp +foreach (var info in manager.Plugins) + Console.WriteLine($"{info.Name}: {info.State}, enabled={info.Enabled}"); +``` + ## As a lip package A `v*` tag builds `hosihikari-core-.zip` and publishes it as diff --git a/README.zh_hans.md b/README.zh_hans.md index d359154..9bf0fc8 100644 --- a/README.zh_hans.md +++ b/README.zh_hans.md @@ -34,6 +34,31 @@ CI 跑的就是这一条命令,走的也是外部插件作者拿到契约的 本机库的 RID 优先解析走 McMaster 的 fork;它也必须作为兄弟目录检出(CI 就是这么摆的)。 +## 配置与状态 + +构造函数重载接受 `PluginManagerOptions`。`UnloadVerificationTimeout` 默认 30 秒;有限值必须为正且 +不超过约 49.7 天,`Timeout.InfiniteTimeSpan` 关闭计时器。超时按卸载失败记录,报告会如实写明; +槽位保持 `Detached`,因此 `Plugins` 仍会返回它。 + +```csharp +var options = new PluginManagerOptions +{ + UnloadVerificationTimeout = TimeSpan.FromSeconds(60), +}; + +var manager = new PluginManager( + pluginsRoot, dataRoot, configRoot, reportFault, + carrierServices, onRemoved, options); +``` + +`Plugins` 返回所有槽位的只读快照,包含 `Detached`;`TryGetPlugin(name, out var info)` 按名字读取 +一个。`PluginInfo` 带 `Name`、`Version`、`Loader`、`State`、`Enabled`、`IsLoader` 与 `Dependencies`。 + +```csharp +foreach (var info in manager.Plugins) + Console.WriteLine($"{info.Name}: {info.State}, enabled={info.Enabled}"); +``` + ## 作为 lip 包 打 `v*` 标签会构建 `hosihikari-core-<版本>.zip`,发布为