public UVersion(string name) { var xmlNode = UVersionConfig.GetKeyAsNode("/configuration/versions/version [@voteName = '" + name + "']"); if (xmlNode?.Attributes != null) { Name = name; Key = xmlNode.Attributes.GetNamedItem("key").Value; Description = xmlNode.Attributes.GetNamedItem("voteDescription").Value; Exists = true; } else { Exists = false; } }
public static List <UVersion> GetAllVersions() { XmlNode x = UVersionConfig.GetKeyAsNode("/configuration/versions"); var l = new List <UVersion>(); foreach (XmlNode cx in x.ChildNodes) { if (cx.Attributes != null && cx.Attributes.GetNamedItem("vote") != null && cx.Attributes.GetNamedItem("vote").Value == "true") { if (cx.Attributes.GetNamedItem("voteName") != null) { l.Add(new UVersion(cx.Attributes.GetNamedItem("voteName").Value)); } } } return(l); }