他プラグインの存在確認方法
汎用的に行うならばアセンブリを列挙して探す。
AppDomain.CurrentDomain.GetAssemblies()
?????.plugin.dllはプラグイン用の属性持ちなのでそれを見ると名前とバージョンがわかる。
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), false); if (attributesName != null && attributesName.Count() != 0) { // プラグインっぽいのでバージョンも取る var attributesVertion = type.GetCustomAttributes(typeof(PluginVersionAttribute), false); } } }
連携用にインターフェースがあるものは、それを使えば・・・
コメント