ユーザ用ツール

サイト用ツール


appendix:他プラグイン

他プラグインの存在確認方法

汎用的に行うならばアセンブリを列挙して探す。

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);
        }
    }
}

連携用にインターフェースがあるものは、それを使えば・・・

コメント

コメントを入力:
 
appendix/他プラグイン.txt · 最終更新: 2022/03/05 16:07 by fumble