Beispiel #1
0
        public static void UpdatePlugin(IPlugin plugin, bool reboot = false)
        {
            string location = plugin.Update();

            if (File.Exists(location))
            {
                if (Path.GetExtension(location) != ".dll")
                {
                    MessageBox.Show($"{plugin.PluginInfo.Name} did not download a .dll file. Updatefunction of the plugin might is broken.\nPlease contact {plugin.PluginInfo.Author} on {plugin.PluginInfo.Url} for further information.");
                    return;
                }

                string path = EnviromentManager.LBPluginsPath + plugin.PluginInfo.Name + ".dll";
                if (LBConfiguration.Config.plugins_toinstall == null)
                {
                    LBConfiguration.Config.plugins_toinstall = new List <string>();
                }
                LBConfiguration.Config.plugins_toinstall.Add(path + ";" + location);
                LBConfiguration.Save();
            }

            if (reboot)
            {
                EnviromentManager.Reboot();
            }
        }
Beispiel #2
0
        public static void UpdateAllPlugins()
        {
            bool updated = false;

            foreach (Plugin_Wrapper plugin in InstalledPlugins.Where(a => !a.Plugin.IsUpToDate))
            {
                updated = true;
                Action waitforlaunch = () => UpdatePlugin(plugin.Plugin);
                Helpers.BlockerInfo.Run("Plugin Update", $"Launchbuddy is automatically updating {plugin.Plugin.PluginInfo.Name}. To disable this feature visit the plugin section.", waitforlaunch);
            }
            if (updated)
            {
                EnviromentManager.Reboot();
            }
        }