public AlogItem(RssItem item, Match M, string Type) { this.Amount = 1; this.Date = item.Date; this.Title = item.Title; this.Description = item.Description; this.Link = item.Link; this.Type = Type; if (M == null) { this.Info = new string[1]; this.Info[0] = item.Title; } else { var groups = new string[2]; for (int i = 1; i < M.Groups.Count; i++) { groups[i - 1] = M.Groups[i].Value.Trim(); } this.Info = groups; } if (this.Type == "I killed") { string npc = this.Info[0]; if (npc.Length == 0) { npc = this.Info[1]; } Match N = Regex.Match(npc, @"^(\d+) (.+?)$"); if (N.Success) { this.Amount = N.Groups[1].Value.ToInt32(); this.Info[0] = N.Groups[2].Value.EndsWith("s") ? N.Groups[2].Value.Substring(0, N.Groups[2].Value.Length - 1) : N.Groups[2].Value; } else { this.Info[0] = npc.EndsWith("s") ? npc.Substring(0, npc.Length - 1) : npc; } } }
/// <summary> /// Parses the xml document in order to retrieve the RSS items. /// </summary> private void ParseRssItems(XmlDocument xmlDoc) { this._rssItems.Clear(); XmlNodeList nodes = xmlDoc.SelectNodes("rss/channel/item"); foreach (XmlNode node in nodes) { var item = new RssItem(); ParseDocElements(node, "title", ref item.Title); ParseDocElements(node, "description", ref item.Description); ParseDocElements(node, "link", ref item.Link); string date = null; ParseDocElements(node, "pubDate", ref date); DateTime.TryParse(date, out item.Date); this._rssItems.Add(item); } }