示例#1
0
        public static Dictionary <string, UmbracoVersion> AvailableVersions()
        {
            Dictionary <string, UmbracoVersion> Versions = new Dictionary <string, UmbracoVersion>();

            //load the wikiFileVersions from the wikiFileVersions.config file
            var wikiFileVersions = UWikiFileVersion.GetAllVersions();

            foreach (var v in wikiFileVersions)
            {
                Versions.Add(v.Key, new UmbracoVersion(v.Key, v.Name, v.Description));
            }
            //Versions.Add("v5", new UmbracoVersion("v5", "Version 5.0.x", "Compatible with version 5.0.x"));
            //Versions.Add("v491", new UmbracoVersion("v491", "Version 4.9.1", "Compatible with version 4.9.1"));
            //Versions.Add("v49", new UmbracoVersion("v49", "Version 4.9.x", "Compatible with version 4.9.x"));
            //Versions.Add("v48", new UmbracoVersion("v48", "Version 4.8.x", "Compatible with version 4.8.x"));
            //Versions.Add("v47", new UmbracoVersion("v47", "Version 4.7.x", "Compatible with version 4.7.x"));
            //Versions.Add("v46", new UmbracoVersion("v46", "Version 4.6.x", "Compatible with version 4.6.x"));
            //Versions.Add("v45", new UmbracoVersion("v45", "Version 4.5.x", "Compatible with version 4.5 using the new XML schema"));
            //Versions.Add("v45l", new UmbracoVersion("v45l", "Version 4.5.x - Legacy Schema Only", "Compatible with version 4.5 but only using the old XML schema"));
            //Versions.Add("v4", new UmbracoVersion("v4", "Version 4.0.x", "Compatible with version 4.0.x or 4.5 using the legacy schema"));
            //Versions.Add("v31", new UmbracoVersion("v31", "Version 3.x", "Only compatible with Umbraco version 3.x and incompatible with the version 4 API"));
            //Versions.Add("nan", new UmbracoVersion("nan", "Not version dependant", "Works with all versions of umbraco, as it does not contain any version dependencies"));

            return(Versions);
        }
示例#2
0
        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));
        }
示例#3
0
 public static UmbracoVersion DefaultVersion()
 {
     return(AvailableVersions()[UWikiFileVersion.DefaultKey()]);
 }
示例#4
0
        public static UmbracoVersion DefaultVersion()
        {
            var versions = new UWikiFileVersion();

            return(AvailableVersions()[versions.DefaultKey()]);
        }