Example #1
0
        private static void FillInCandidates(Dictionary<string, UserInfo> candidates, XmlNodeList nodes, StreamWriter writer)
        {
            foreach (XmlNode userNode in nodes)
            {
                string userName = userNode.Attributes["name"].Value;
                int edits = int.Parse(userNode.Attributes["editcount"].Value);

                XmlNode editorNode = userNode.SelectSingleNode("//user[@name=" + EscapeXPathQuery(userName) + "]/groups[g='editor' or g='autoeditor' or g='sysop']/g");
                if (editorNode != null)
                {
                    writer.WriteLine(userName);
                }
                else if (edits > 500 && !candidates.ContainsKey(userName))
                {
                    UserInfo userInfo = new UserInfo();
                    userInfo.User = userName;
                    userInfo.Edits = edits;
                    if (!string.IsNullOrEmpty(userNode.Attributes["registration"].Value))
                    {
                        userInfo.Registration = DateTime.Parse(userNode.Attributes["registration"].Value,
                            null,
                            System.Globalization.DateTimeStyles.AssumeUniversal);
                    }
                    candidates.Add(userName, userInfo);
                }
            }
        }