예제 #1
0
        /// <summary>
        /// Initialises this instance.
        /// </summary>
        public void Initialise()
        {
            var xml = WebHelper.GetXml(NanoURL.USER_WORDCOUNT + Username);

            WordCount = new UserWordCount(
                xml.Descendants("uid").Single().Value,
                xml.Descendants("uname").Single().Value,
                Convert.ToInt64(xml.Descendants("user_wordcount").Single().Value),
                Convert.ToBoolean(xml.Descendants("winner").Single().Value));

            xml = WebHelper.GetXml(NanoURL.USER_WORDCOUNT_HISTORY + Username);

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

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

            foreach (var entry in entries)
            {
                History.Add(new UserWordCountEntry(
                                Convert.ToInt64(entry.Descendants("wc").Single().Value),
                                Convert.ToDateTime(entry.Descendants("wcdate").Single().Value)));
            }

            LastUpdated = DateTime.Now;
        }
예제 #2
0
        /// <summary>
        /// Initialises this instance.
        /// </summary>
        public void Initialise()
        {
            var xml = WebHelper.GetXml(NanoURL.USER_WORDCOUNT + Username);

            WordCount = new UserWordCount(
                xml.Descendants("uid").Single().Value,
                xml.Descendants("uname").Single().Value,
                Convert.ToInt64(xml.Descendants("user_wordcount").Single().Value),
                Convert.ToBoolean(xml.Descendants("winner").Single().Value));

            xml = WebHelper.GetXml(NanoURL.USER_WORDCOUNT_HISTORY + Username);

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

            foreach (var entry in entries)
            {
                History.Add(new UserWordCountEntry(
                    Convert.ToInt64(entry.Descendants("wc").Single().Value),
                    Convert.ToDateTime(entry.Descendants("wcdate").Single().Value)));
            }

            LastUpdated = DateTime.Now;
        }