public void ReloadPlugin(PluginAddress pluginAddress)
        {
            Plugin plugin = GetPlugin(pluginAddress);

            if (plugin != null)
            {
                PluginContainer pluginContainer = pluginEngine.ReloadPlugin(p => p.Tag != null && p.Tag is Plugin && ((Plugin)p.Tag).ID == plugin.ID, p => plugin.VirtualPath);

                if (pluginContainer.IsLoaded)
                {
                    plugin = repository.Save(plugin.ApplyProperties(pluginContainer.GetPropertiesUsingDefaultValues()));

                    pluginContainer.ApplyProperties(plugin.ExtendedProperties);
                }

                plugin.Container    = pluginContainer;
                pluginContainer.Tag = plugin;

                pluginTemplateRegistry.Reload(pluginEngine);
                context.Routes.Reload(modules, this, pluginEngine);
                pluginStyleRegistry.Reload(pluginEngine);
                pluginScriptRegistry.Reload(pluginEngine);
            }
        }
        public ValidationStateDictionary ValidatePlugin(PluginContainer pluginContainer)
        {
            IEnumerable <ExtendedProperty> extendedProperties = pluginContainer.GetPropertiesUsingDefaultValues();

            return(validatePluginPropertyValues(new PluginPropertiesInput(pluginContainer.Definitions, extendedProperties, name => pluginContainer.GetPropertyDefinitions(name), name => extendedProperties.First(ep => string.Compare(ep.Name, name, true) == 0).Value)));
        }
        public Plugin InstallPlugin(PluginInstallInput pluginInstallInput, bool?overrideEnabled)
        {
            PluginContainer pluginContainer = null;

            if (!string.IsNullOrEmpty(pluginInstallInput.VirtualPath))
            {
                pluginContainer = pluginEngine.GetPlugins(p => (p.Tag == null || !(p.Tag is Plugin)) && p.CompilationAssembly != null && string.Compare(p.VirtualPath, pluginInstallInput.VirtualPath, true) == 0).FirstOrDefault();
            }

            if (pluginContainer == null)
            {
                throw new InvalidOperationException("Could not find plugin to install");
            }

            ValidationStateDictionary validationState = ValidatePlugin(pluginContainer);
            Plugin plugin = repository.Save(new Plugin(context.Site.ID, pluginInstallInput.VirtualPath, validationState.IsValid && overrideEnabled.HasValue ? overrideEnabled.Value : validationState.IsValid, pluginContainer.GetPropertiesUsingDefaultValues()));

            plugin.Container        = pluginContainer;
            pluginContainer.Tag     = plugin;
            pluginContainer.IsValid = validationState.IsValid;

            pluginTemplateRegistry.Reload(pluginEngine);
            context.Routes.Reload(modules, this, pluginEngine);
            pluginStyleRegistry.Reload(pluginEngine);
            pluginScriptRegistry.Reload(pluginEngine);

            return(plugin);
        }