public ItemInfo(CatalogInfo catalog, XElement node) { _catalog = catalog; string value; if (node.TryGetAttributeValue("id", out value)) { _id = int.Parse(value); } if (node.TryGetAttributeValue("categoryId", out value)) { _categoryId = int.Parse(value); } if (node.TryGetAttributeValue("creatorId", out value)) { _creatorId = value; } XElement n = node.Element("name"); if (n != null && n.TryGetValue(out value)) { _name = value; } n = node.Element("description"); if (n != null && n.TryGetValue(out value)) { _description = value; } n = node.Element("version"); if (n != null && n.TryGetValue(out value)) { _version = value; } n = node.Element("downloadUrl"); if (n != null && n.TryGetValue(out value)) { _downloadUrl = value; } n = node.Element("fileName"); if (n != null && n.TryGetValue(out value)) { _fileName = value; } n = node.Element("screenshotUrl"); if (n != null && n.TryGetValue(out value)) { _screenshotUrl = value; } n = node.Element("iconUrl"); if (n != null && n.TryGetValue(out value)) { _iconUrl = value; } n = node.Element("worksWithMajorVersion"); if (n != null && n.TryGetValue(out value)) { _worksWithMajorVersion = int.Parse(value); } n = node.Element("worksWithMinorVersion"); if (n != null && n.TryGetValue(out value)) { _worksWithMinorVersion = int.Parse(value); } n = node.Element("requiresManualIntervention"); if (n != null && n.TryGetValue(out value)) { _requiresManualIntervention = bool.Parse(value); } n = node.Element("dateAdded"); if (n != null && n.TryGetValue(out value)) { _dateAdded = DateTime.Parse(value); } n = node.Element("statisticsInfo"); if (n != null) { _statistics = new StatisticsInfo(n); } n = node.Element("purchaseInfo"); if (n != null) { _purchase = new PurchaseInfo(n); } n = node.Element("tags"); if (n != null) { foreach (XElement e in n.Elements("tag")) { string tag; if (e.TryGetValue(out tag)) { _tags.Add(tag); } } } }
public ItemInfo(CatalogInfo catalog, XElement node) { _catalog = catalog; string value; if (node.TryGetAttributeValue("id", out value)) _id = int.Parse(value); if (node.TryGetAttributeValue("categoryId", out value)) _categoryId = int.Parse(value); if (node.TryGetAttributeValue("creatorId", out value)) _creatorId = value; XElement n = node.Element("name"); if (n != null && n.TryGetValue(out value)) _name = value; n = node.Element("description"); if (n != null && n.TryGetValue(out value)) _description = value; n = node.Element("version"); if (n != null && n.TryGetValue(out value)) _version = value; n = node.Element("downloadUrl"); if (n != null && n.TryGetValue(out value)) _downloadUrl = value; n = node.Element("fileName"); if (n != null && n.TryGetValue(out value)) _fileName = value; n = node.Element("screenshotUrl"); if (n != null && n.TryGetValue(out value)) _screenshotUrl = value; n = node.Element("iconUrl"); if (n != null && n.TryGetValue(out value)) _iconUrl = value; n = node.Element("worksWithMajorVersion"); if (n != null && n.TryGetValue(out value)) _worksWithMajorVersion = int.Parse(value); n = node.Element("worksWithMinorVersion"); if (n != null && n.TryGetValue(out value)) _worksWithMinorVersion = int.Parse(value); n = node.Element("requiresManualIntervention"); if (n != null && n.TryGetValue(out value)) _requiresManualIntervention = bool.Parse(value); n = node.Element("dateAdded"); if (n != null && n.TryGetValue(out value)) _dateAdded = DateTime.Parse(value); n = node.Element("statisticsInfo"); if (n != null) _statistics = new StatisticsInfo(n); n = node.Element("purchaseInfo"); if (n != null) _purchase = new PurchaseInfo(n); n = node.Element("tags"); if (n != null) { foreach (XElement e in n.Elements("tag")) { string tag; if (e.TryGetValue(out tag)) _tags.Add(tag); } } }