using System.Collections.Generic; using System.Linq; using Umbraco.Cms.Core.Install.InstallSteps; using Umbraco.Cms.Core.Install.Models; using Umbraco.Web.Install.InstallSteps; namespace Umbraco.Web.Install { public sealed class InstallStepCollection { private readonly InstallHelper _installHelper; private readonly IEnumerable _orderedInstallerSteps; public InstallStepCollection(InstallHelper installHelper, IEnumerable installerSteps) { _installHelper = installHelper; // TODO: this is ugly but I have a branch where it's nicely refactored - for now we just want to manage ordering var a = installerSteps.ToArray(); _orderedInstallerSteps = new InstallSetupStep[] { a.OfType().First(), a.OfType().First(), a.OfType().First(), a.OfType().First(), a.OfType().First(), a.OfType().First(), a.OfType().First(), // TODO: Add these back once we have a compatible Starter kit // a.OfType().First(), // a.OfType().First(), // a.OfType().First(), a.OfType().First(), }; } /// /// Get the installer steps /// /// /// /// The step order returned here is how they will appear on the front-end if they have views assigned /// public IEnumerable GetAllSteps() { return _orderedInstallerSteps; } /// /// Returns the steps that are used only for the current installation type /// /// public IEnumerable GetStepsForCurrentInstallType() { return GetAllSteps().Where(x => x.InstallTypeTarget.HasFlag(_installHelper.GetInstallationType())); } } }