Ejemplo n.º 1
0
        public void ChceckPluginState(Dictionary <PluginType, PluginProvider> providers)
        {
            // Check which plug-ins, applications are installed.
            Plugin.ForEach(plugin =>
            {
                PluginProvider provider = providers[plugin.Type];
                if (provider == null)
                {
                    return;
                }

                // Check if all ABC plug-ins are installed to indicate manager plug-in state.
                var installed = plugin.AbcPlugins.Where(abcPlugin => provider.IsInstalled(new Guid(abcPlugin.Guid))).ToList();
                plugin.AbcPlugins.ForEach(abcplugin => abcplugin.PluginPath = provider.GetPluginPath(new Guid(abcplugin.Guid)));
                plugin.IsConfigurable = provider.IsPluginConfigurable(new Guid(plugin.AbcPlugins.First().Guid));
                // All ABC plug-ins are installed.
                if (installed.Count() == plugin.AbcPlugins.Count())
                {
                    plugin.PluginState = PluginState.Installed;

                    //Check if any of ABC plug-ins is out of date.
                    if (plugin.AbcPlugins.Any(abcplugin => provider.CompareVersion(new Guid(abcplugin.Guid), new Version(abcplugin.Version)) != 0))
                    {
                        plugin.PluginState = PluginState.Updates;
                    }
                }
                // Not all ABC plug-ins are installed.
                else if (installed.Any())
                {
                    plugin.PluginState = PluginState.Updates;
                }
                // None of ABC plug-ins are installed.
                else
                {
                    plugin.PluginState = PluginState.Availible;
                }
            });
        }