Пример #1
0
        protected override void ProcessRecord()
        {
            XDocument feed = GetFeed();

            if (feed == null)
            {
                return;
            }
            var items = feed.Descendants("item");

            foreach (var item in items)
            {
                var report = SnowReport.Create(item);
                WriteObject(report);
            }
        }
Пример #2
0
        public static SnowReport Create(XElement item)
        {
            SnowReport report = new SnowReport();

            report.Resort  = item.Element("title").Value;
            report.Country = item.Element("{http://www.onthesnow.co.uk/ots_rss_namespace/}region_name").Value;
            report.IsOpen  = item.Element("{http://www.onthesnow.co.uk/ots_rss_namespace/}open_staus").Value == "Open";
            int depth = 0;

            int.TryParse(item.Element("{http://www.onthesnow.co.uk/ots_rss_namespace/}base_depth").Value, out depth);
            report.SnowDepth = depth;
            depth            = 0;
            int.TryParse(item.Element("{http://www.onthesnow.co.uk/ots_rss_namespace/}snowfall_48hr").Value, out depth);
            report.ExpectedSnow = depth;
            return(report);
        }