private IEnumerable <StarterKit> GetStarterKits(IEnumerable <umbraco.NodeFactory.Node> umbracoNodes, string umbracoVersion) { System.Version version = null; if (umbracoVersion != null) { if (umbracoVersion.Contains("-")) { umbracoVersion = umbracoVersion.Substring(0, umbracoVersion.IndexOf("-", StringComparison.Ordinal)); } version = new System.Version(umbracoVersion); } var officialStarterKitGuidCollection = ConfigurationManager.AppSettings["UmbracoStarterKits"].Split(',').ToList(); var starterKits = new List <StarterKit>(); var versions = new UWikiFileVersion(); var allConfiguredVersions = versions.GetAllVersions(); // for 7.6.4+ we change behavior and only provide one starter kit if (version >= new System.Version(7, 6, 5)) { officialStarterKitGuidCollection = new List <string> { ConfigurationManager.AppSettings["UmbracoStarterKitDefault"] }; } foreach (var umbracoNode in umbracoNodes) { // If it's not in the official list, move on to the next package if (officialStarterKitGuidCollection.Contains(GetPropertyValue(umbracoNode, "packageGuid"), StringComparer.OrdinalIgnoreCase) == false) { continue; } // If the umbracoVersion is filled in then check if the kit is compatible the version requested if (umbracoVersion != null && VersionCompatible(umbracoNode, version, allConfiguredVersions) == false) { continue; } var starterKit = new StarterKit { Name = umbracoNode.Name, Thumbnail = GetPropertyValue(umbracoNode, "defaultScreenshotPath"), Id = GetPropertyValue(umbracoNode, "packageGuid"), Description = GetPropertyValue(umbracoNode, "description"), SortOrder = umbracoNode.SortOrder }; starterKits.Add(starterKit); } return(starterKits.OrderBy(s => s.SortOrder)); }
private IEnumerable<StarterKit> GetStarterKits(IEnumerable<umbraco.NodeFactory.Node> umbracoNodes, string umbracoVersion) { System.Version version = null; if (umbracoVersion != null) { if (umbracoVersion.Contains("-")) umbracoVersion = umbracoVersion.Substring(0, umbracoVersion.IndexOf("-", StringComparison.Ordinal)); version = new System.Version(umbracoVersion); } var officialStarterKitGuidCollection = ConfigurationManager.AppSettings["UmbracoStarterKits"].Split(',').ToList(); var starterKits = new List<StarterKit>(); var allConfiguredVersions = UWikiFileVersion.GetAllVersions(); foreach (var umbracoNode in umbracoNodes) { // If it's not in the official list, move on to the next package if (officialStarterKitGuidCollection.Contains(GetPropertyValue(umbracoNode, "packageGuid"), StringComparer.OrdinalIgnoreCase) == false) continue; // If the umbracoVersion is filled in then check if the kit is compatible the version requested if (umbracoVersion != null && VersionCompatible(umbracoNode, version, allConfiguredVersions) == false) continue; var starterKit = new StarterKit { Name = umbracoNode.Name, Thumbnail = GetPropertyValue(umbracoNode, "defaultScreenshotPath"), Id = GetPropertyValue(umbracoNode, "packageGuid"), Description = GetPropertyValue(umbracoNode, "description"), SortOrder = umbracoNode.SortOrder }; starterKits.Add(starterKit); } return starterKits.OrderBy(s => s.SortOrder); }