Esempio n. 1
0
        /// <summary>
        /// Activated plugin and register.
        /// If you add plug-in type is not registered in ULIB - you need to add plug-in processor (RegisterPluginHandler) before adding the plug-in.
        /// Registered in ULIB type of plugin is:
        /// - "UPlugin"
        /// - "USerialize"
        /// - "ULanguage";
        ///
        /// </summary>
        /// <param name="plugin"></param>
        /// <exception cref="PluginManagerException"></exception>
        public static void AddPlugin(IUlibPlugin plugin)
        {
            plugin.Activate();
            switch (plugin.PluginType)
            {
            case UPluginType.Plugin:
            {
                break;
            }

            case UPluginType.Serialize:
            {
                Serializer.PluginHandler(plugin);
                break;
            }

            case UPluginType.Language:
            {
                LanguageManager.PluginHandler(plugin);
                break;
            }

            case UPluginType.Gateway:
            {
                Gateway.PluginHandler(plugin);
                break;
            }

            case UPluginType.File:
            {
                FileManager.PluginHandler(plugin);
                break;
            }

            case UPluginType.Quality:
            {
                QualityManager.PluginHandler(plugin);
                break;
            }

            default:
            {
                if (Handlers.ContainsKey(plugin.PluginType))
                {
                    Handlers[plugin.PluginType](plugin);
                }
                else
                {
                    throw new PluginManagerException(string.Format("Not find PluginHandler for type '{0}'. \nPlease use PluginManager.RegisterPluginHandler before. ", plugin.PluginType));
                }
                break;
            }
            }

            if (!Plugins.Contains(plugin))
            {
                Plugins.Add(plugin);
            }
            plugin.Added();
        }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static QualityManager GetInctance()
 {
     return(_instance ?? (_instance = new QualityManager()));
 }