コード例 #1
0
        /// <summary>
        /// 初期化
        /// </summary>
        private void Initialize()
        {
            var plugInApplicationAttribute = PcmHelper.GetAttribute <PlugInApplicationAttribute>(GetType());

            Name = plugInApplicationAttribute == null?GetType().Name : plugInApplicationAttribute.Name;

            PlugIns = new List <IMogamiPlugIn <TPlugIn> >();
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        protected PlugIn()
        {
            Application = new PlugInApplication <TApp>();

            //Get Name from PlugIn attribute.
            var thisPlugInType  = GetType();
            var plugInAttribute = PcmHelper.GetAttribute <PlugInAttribute>(thisPlugInType);

            Name    = plugInAttribute == null ? thisPlugInType.Name : plugInAttribute.Name;
            Version = plugInAttribute == null ? "" : plugInAttribute.Version;
        }
コード例 #3
0
        /// <summary>
        /// プラグイン格納ディレクトリから、プラグインを読み込みます。
        /// </summary>
        public void LoadPlugIns()
        {
            if (string.IsNullOrEmpty(PlugInFolder) || !Directory.Exists(PlugInFolder))
            {
                throw new ApplicationException("PlugInFoler must be a valid folder path");
            }

            var assemblyFiles = PcmHelper.FindAssemblyFiles(PlugInFolder);
            var plugInType    = typeof(TPlugIn);

            foreach (var assemblyFile in assemblyFiles)
            {
                var allTypes = Assembly.LoadFrom(assemblyFile).GetTypes();
                foreach (var type in allTypes)
                {
                    if (plugInType.IsAssignableFrom(type) && type.IsClass && !type.IsAbstract)
                    {
                        PlugIns.Add(new MogamiPlugIn <TPlugIn>(this, type));
                    }
                }
            }

            PlugInsLoaded = true;
        }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 public PlugInBasedApplication()
 {
     Initialize();
     PlugInFolder = PcmHelper.GetCurrentDirectory();
 }