private void ReadRoleDataStore()
{
lock (this)
{
if (!roles.ContainsKey(Blog.CurrentInstance.Id))
{
roles[Blog.CurrentInstance.Id] = new List<Role>();
var doc = new XmlDocument();
try
{
doc.Load(this.XmlFullyQualifiedPath);
var nodes = doc.GetElementsByTagName("role");
foreach (XmlNode roleNode in nodes)
{
var name = roleNode.SelectSingleNode("name");
if (name == null)
{
continue;
}
var tempRole = new Role(name.InnerText);
var user = roleNode.SelectNodes("users/user");
if (user != null)
{
foreach (XmlNode userNode in user)
{
tempRole.Users.Add(userNode.InnerText);
}
}
this.roles[Blog.CurrentInstance.Id].Add(tempRole);
}
}
catch (XmlException)
{
this.AddUsersToRoles(this.userNames.ToArray(), this.defaultRolesToAdd);
}
}
}
}