Esempio n. 1
0
        public static void PluginShutdown <T>(IPluginStateValue <T> plugin) where T : IPlugin
        {
            if (plugin.Startup)
            {
                int pluginStatusResponse = 0;
                try
                {
                    pluginStatusResponse = plugin.Plugin.Shutdown();

                    if (pluginStatusResponse == 0)
                    {
                        Console.WriteLine("[{0}] successfully shutdown.", plugin.Plugin.Info.Name);
                    }
                    else
                    {
                        Console.WriteLine("[{0}] failed to shutdown properly with status {1}.", plugin.Plugin.Info.Name, pluginStatusResponse);
                    }
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
                plugin.Startup = false;
            }
        }
Esempio n. 2
0
        public static void PluginStartup <T>(IPluginStateValue <T> plugin) where T : IPlugin
        {
            if (!plugin.Startup)
            {
                int pluginStatusResponse = 0;
                try
                {
                    pluginStatusResponse = plugin.Plugin.Startup(hostDelegates);

                    if (pluginStatusResponse == 0)
                    {
                        Console.WriteLine("[{0}] successfully started.", plugin.Plugin.Info.Name);
                    }
                    else
                    {
                        Console.WriteLine("[{0}] failed to startup properly with status {1}.", plugin.Plugin.Info.Name, pluginStatusResponse);
                    }
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
                plugin.Startup = true;
            }
        }
Esempio n. 3
0
        public static void PluginReceiveData <T>(IPluginStateValue <T> plugin, object gameMemory) where T : IPluginUI
        {
            // If the UI plugin isn't started, start it now.
            if (!plugin.Startup)
            {
                PluginStartup(plugin);
            }

            if (gameMemory != null)
            {
                int uiPluginReceiveDataStatus = 0;
                try
                {
                    uiPluginReceiveDataStatus = plugin.Plugin.ReceiveData(gameMemory);
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }
        }