public byte[] fetchPackageByVersion(string packageGuid, string repoVersion) { //first, translate repo version enum to our.umb version strings //version3 = v31 //version4 = v4 //version41 = v45 //if v45, check if default package is v47 as well, as 4.7 install use v45 when calling the repo (thank god we are moving to nuget) //everything else = v4 string version = "v4"; switch (repoVersion.ToLower()) { case "version3": version = "v31"; break; case "version4": version = "v4"; break; case "version41": version = "v45"; break; case "version41legacy": version = "v45l"; break; default: version = "v4"; break; } uWiki.Businesslogic.WikiFile wf = uRepo.Packages.PackageFileByGuid(new Guid(packageGuid)); if (wf != null) { //if the package doesn't care about the umbraco version needed... if (wf.Version.Version == "nan") { return(wf.ToByteArray()); } //if v45 if (version == "v45") { int v = 0; if (int.TryParse(wf.Version.Version.Replace("v", ""), out v)) { if (v >= 45) { return(wf.ToByteArray()); } } if (wf.Version.Version == "v47" || wf.Version.Version == "v45") { return(wf.ToByteArray()); } else if (wf.Version.Version != version && wf.Version.Version != "nan") { wf = uWiki.Businesslogic.WikiFile.FindPackageForUmbracoVersion(wf.NodeId, version); return(wf.ToByteArray()); } } } return(new byte[0]); /* * if (wf.Version.Version != version && wf.Version.Version != "nan") * wf = uWiki.Businesslogic.WikiFile.FindPackageForUmbracoVersion(wf.NodeId, version); * * * if(wf != null) * return wf.ToByteArray(); * else * return new byte[0];*/ }