ユーザ用ツール

サイト用ツール


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/他プラグイン.1646453485.txt.gz · 最終更新: 2022/03/05 13:11 by fumble