示例#1
0
        private static List <ClassMarkerUser> GetUsers(string xmlPath)
        {
            var users = new List <ClassMarkerUser>();

            using (var fileStream = new FileStream(xmlPath, FileMode.Open))
            {
                fileStream.Flush();
                var reader = new XmlTextReader(fileStream);
                while (reader.Read() && reader.Name != "users")
                {
                }

                while (reader.Read())
                {
                    var user = new ClassMarkerUser();
                    user.Login         = reader.MoveToElementWithName("login").ReadInnerXml();
                    user.Password      = reader.MoveToElementWithName("password").ReadInnerXml();
                    user.Email         = reader.MoveToElementWithName("email").ReadInnerXml();
                    user.EmailPassword = reader.MoveToElementWithName("emailpassword").ReadInnerXml();
                    users.Add(user);
                    reader.Read();
                }
            }

            return(users);
        }