public WikiFile(int id) { umbraco.DataLayer.IRecordsReader dr = Data.SqlHelper.ExecuteReader("SELECT * FROM wikiFiles WHERE id = " + id.ToString()); if (dr.Read()) { Id = dr.GetInt("id"); Path = dr.GetString("path"); Name = dr.GetString("name"); FileType = dr.GetString("type"); RemovedBy = dr.GetInt("removedBy"); CreatedBy = dr.GetInt("createdBy"); NodeVersion = dr.GetGuid("version"); NodeId = dr.GetInt("nodeId"); CreateDate = dr.GetDateTime("createDate"); Current = dr.GetBoolean("current"); Downloads = dr.GetInt("downloads"); Archived = dr.GetBoolean("archived"); Verified = dr.GetBoolean("verified"); Versions = GetVersionsFromString(dr.GetString("umbracoVersion")); Version = Versions.Any() ? GetVersionsFromString(dr.GetString("umbracoVersion"))[0] : UmbracoVersion.DefaultVersion(); } else { throw new ArgumentException(string.Format("No node exists with id '{0}'", Id)); } dr.Close(); }
public static List <UmbracoVersion> GetVersionsFromString(string p) { var verArray = p.Split(','); var verList = new List <UmbracoVersion>(); foreach (var ver in verArray) { if (UmbracoVersion.AvailableVersions().ContainsKey(ver)) { verList.Add(UmbracoVersion.AvailableVersions()[ver]); } } return(verList); }