Esempio n. 1
0
        private static async Task InitPluginsAsync(IPluginManager pluginManager)
        {
            await Task.Yield();

            bool arePluginsLoaded = false;

            while (!arePluginsLoaded)
            {
                try
                {
                    pluginManager.GetPluginByType <PluginScheduler>();
                    arePluginsLoaded = true;
                }
                catch (Exception)
                {
                    //Console.WriteLine("Darkrift hasn't finished to load plugins");
                }
            }
            Console.WriteLine("The plugins are being Initialized ");

            //Insert plugins to be initialized here
            LoadPlugin <SessionManager>(pluginManager);
            LoadPlugin <NetworkEntityManager>(pluginManager);

            Console.WriteLine("Completed Initializing the plugins");
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize plugins
        /// </summary>
        /// <param name="pPluginManager"></param>
        /// <returns></returns>
        private static async Task InitPluginsAsync(IPluginManager pPluginManager)
        {
            //Free execution
            await Task.Yield();

            bool arePluginsLoaded = false;

            while (!arePluginsLoaded)
            {
                try
                {
                    pPluginManager.GetPluginByType <Scheduler>();
                    arePluginsLoaded = true;
                }
                catch (Exception)
                {
                    //Console.WriteLine("Darkrift hasn't finished to load plugins");
                }
            }

            //Initialize plugins
            Console.WriteLine("Scheduler initialization start");
            ((FirstPlugin)pPluginManager.GetPluginByType <FirstPlugin>()).Init();
            ((SecondPlugin)pPluginManager.GetPluginByType <SecondPlugin>()).Init();
            ((ThirdPlugin)pPluginManager.GetPluginByType <ThirdPlugin>()).Init();
            ((FourthPlugin)pPluginManager.GetPluginByType <FourthPlugin>()).Init();
            ((FifthPlugin)pPluginManager.GetPluginByType <FifthPlugin>()).Init();
            Console.WriteLine("Scheduler initialization finished");
        }
Esempio n. 3
0
 private static void LoadPlugin <T>(IPluginManager pluginManager) where T : Plugin, ISchedulable
 {
     pluginManager.GetPluginByType <T>().Init();
     Console.WriteLine("Loaded " + typeof(T).Name);
 }