差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
appendix:他プラグイン [2022/01/17 16:01] fumble |
appendix:他プラグイン [2022/03/05 16:07] (現在) fumble |
||
---|---|---|---|
行 1: | 行 1: | ||
- | =====シーン判定方法===== | + | =====他プラグインの存在確認方法===== |
+ | 汎用的に行うならばアセンブリを列挙して探す。 | ||
+ | <code csharp> | ||
AppDomain.CurrentDomain.GetAssemblies() | AppDomain.CurrentDomain.GetAssemblies() | ||
+ | </ | ||
+ | |||
+ | ????? | ||
+ | <code csharp> | ||
+ | foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) | ||
+ | { | ||
+ | if (String.IsNullOrEmpty(assembly.Location)) | ||
+ | continue; | ||
+ | foreach (var type in assembly.GetTypes()) | ||
+ | { | ||
+ | // プラグイン名を取る | ||
+ | var attributesName = type.GetCustomAttributes(typeof(PluginNameAttribute), | ||
+ | if (attributesName != null && attributesName.Count() != 0) | ||
+ | { | ||
+ | // プラグインっぽいのでバージョンも取る | ||
+ | var attributesVertion = type.GetCustomAttributes(typeof(PluginVersionAttribute), | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | 連携用にインターフェースがあるものは、それを使えば・・・\\ |