public static void ReCreateRegistryAccounts(string path) { RegisteredUsers Registry = new RegisteredUsers(); Account toetag = new Account() { Email = "*****@*****.**", Administrator = true }; toetag.SetName("Toetag"); toetag.SetPassword("toetag"); Registry.List.Add(toetag); Account haystack = new Account() { Email = "*****@*****.**", Administrator = true }; haystack.SetName("Haystack"); haystack.SetPassword("haystack"); Registry.List.Add(haystack); Account bucky = new Account() { Email = "*****@*****.**", Administrator = false }; bucky.SetName("Bucky"); bucky.SetPassword("bucky"); Registry.List.Add(bucky); XML.ObjectToXml(Registry, path); }
private void LoadRegistryAccounts() { var doc = XDocument.Load(BaseDirectory + "\\" + RegisteredUsersAccounts); var users = from item in doc.Descendants("Account") select new { name = item.Element("Name").Value, password = item.Element("Password").Value, email = item.Element("Email").Value, administrator = item.Element("Administrator").Value }; foreach (var user in users) { Account account = new Account() { Name = user.name, Password = user.password, Email = user.email, Administrator = Convert.ToBoolean(user.administrator) }; RegisteredUsers.Add(account); } }