public List<StarterKit> Get(string umbracoVersion = null) { var projects = new Packages(); var starterKitsIterator = projects.GetProjects(); var umbracoNodes = GetUmbracoNodes(starterKitsIterator); var starterKits = GetStarterKits(umbracoNodes, umbracoVersion); return starterKits.ToList(); }
//used by the repo webservice public static SubmitStatus SubmitPackageAsProject(string authorGuid, string packageGuid, byte[] packageFile, byte[] packageDoc, byte[] packageThumbnail, string name, string description) { try { if (packageFile.Length == 0) { return(SubmitStatus.Error); } umbraco.cms.businesslogic.member.Member mem = new umbraco.cms.businesslogic.member.Member(new Guid(authorGuid)); Package packageNode = Packages.GetPackageByGuid(new Guid(packageGuid)); if (mem != null) { //existing package... if (packageNode != null) { return(SubmitStatus.Exists); } else { Document d = Document.MakeNew(name, DocumentType.GetByAlias(_projectAlias), new umbraco.BusinessLogic.User(0), _projectsRoot); d.getProperty("version").Value = "1.0"; d.getProperty("description").Value = description; d.getProperty("stable").Value = false; d.getProperty("demoUrl").Value = ""; d.getProperty("sourceUrl").Value = ""; d.getProperty("websiteUrl").Value = ""; d.getProperty("licenseUrl").Value = ""; d.getProperty("licenseName").Value = ""; d.getProperty("vendorUrl").Value = ""; d.getProperty("owner").Value = mem.Id; d.getProperty("packageGuid").Value = packageGuid; WikiFile wf = WikiFile.Create(name, "zip", d.UniqueId, mem.UniqueId, packageFile, "package", new List <UmbracoVersion>() { UmbracoVersion.DefaultVersion() }); d.getProperty("file").Value = wf.Id; //Create Documentation if (packageDoc.Length > 0) { WikiFile doc = WikiFile.Create("documentation", "pdf", d.UniqueId, mem.UniqueId, packageDoc, "docs", new List <UmbracoVersion>() { UmbracoVersion.DefaultVersion() }); d.getProperty("documentation").Value = doc.Id; } d.XmlGenerate(new XmlDocument()); d.Save(); d.Publish(new umbraco.BusinessLogic.User(0)); umbraco.library.UpdateDocumentCache(d.Id); return(SubmitStatus.Complete); } } else { return(SubmitStatus.NoAccess); } } catch (Exception ex) { umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString()); return(SubmitStatus.Error); } }