Пример #1
0
        /// <summary>
        /// Initialises this instance.
        /// </summary>
        public void Initialise()
        {
            var xml = WebHelper.GetXml(NanoURL.SITE_WORDCOUNT);

            WordCount = new SiteWordCount(
                Convert.ToInt64(xml.Descendants("site_wordcount").Single().Value),
                Convert.ToInt64(xml.Descendants("min").Single().Value),
                Convert.ToInt64(xml.Descendants("max").Single().Value),
                Convert.ToDouble(xml.Descendants("average").Single().Value),
                Convert.ToDouble(xml.Descendants("stddev").Single().Value),
                Convert.ToInt64(xml.Descendants("count").Single().Value));

            xml = WebHelper.GetXml(NanoURL.SITE_WORDCOUNT_HISTORY);

            NumberOfParticipants = Convert.ToInt64(xml.Descendants("numparticipants").Single().Value);

            var entries = xml.Descendants("wordcounts").Single().Descendants("wcentry");

            History = new List <SiteWordCountEntry>(entries.Count());

            foreach (var entry in entries)
            {
                History.Add(new SiteWordCountEntry(
                                Convert.ToInt64(StripZero(entry.Descendants("wc").Single().Value)),
                                Convert.ToDateTime(entry.Descendants("wcdate").Single().Value),
                                Convert.ToInt64(entry.Descendants("min").Single().Value),
                                Convert.ToInt64(entry.Descendants("max").Single().Value),
                                Convert.ToDouble(entry.Descendants("average").Single().Value),
                                Convert.ToDouble(entry.Descendants("stddev").Single().Value),
                                Convert.ToInt64(StripZero(entry.Descendants("count").Single().Value))));
            }

            LastUpdated = DateTime.Now;
        }
Пример #2
0
        /// <summary>
        /// Initialises this instance.
        /// </summary>
        public void Initialise()
        {
            var xml = WebHelper.GetXml(NanoURL.SITE_WORDCOUNT);

            WordCount = new SiteWordCount(
                Convert.ToInt64(xml.Descendants("site_wordcount").Single().Value),
                Convert.ToInt64(xml.Descendants("min").Single().Value),
                Convert.ToInt64(xml.Descendants("max").Single().Value),
                Convert.ToDouble(xml.Descendants("average").Single().Value),
                Convert.ToDouble(xml.Descendants("stddev").Single().Value),
                Convert.ToInt64(xml.Descendants("count").Single().Value));

            xml = WebHelper.GetXml(NanoURL.SITE_WORDCOUNT_HISTORY);

            NumberOfParticipants = Convert.ToInt64(xml.Descendants("numparticipants").Single().Value);

            var entries = xml.Descendants("wordcounts").Single().Descendants("wcentry");
            History = new List<SiteWordCountEntry>(entries.Count());

            foreach (var entry in entries)
            {
                History.Add(new SiteWordCountEntry(
                    Convert.ToInt64(StripZero(entry.Descendants("wc").Single().Value)),
                    Convert.ToDateTime(entry.Descendants("wcdate").Single().Value),
                    Convert.ToInt64(entry.Descendants("min").Single().Value),
                    Convert.ToInt64(entry.Descendants("max").Single().Value),
                    Convert.ToDouble(entry.Descendants("average").Single().Value),
                    Convert.ToDouble(entry.Descendants("stddev").Single().Value),
                    Convert.ToInt64(StripZero(entry.Descendants("count").Single().Value))));
            }

            LastUpdated = DateTime.Now;
        }