public DscRoleNode(string path, DscRoleGroup parent) { Parent = parent; FilePath = path; string fileName = Path.GetFileName(path); if (fileName != null) { Name = fileName.Replace(".json", ""); } Role = DscRole.Load(path); }
// Create new role public DscRoleNode NewRoleNode(string name, DscRoleGroup parent) { if (parent == null || string.IsNullOrWhiteSpace(name)) { return(null); } string fileName = Path.Combine(parent.DirectoryPath, name + ".json"); DscRole role = new DscRole(); role.Save(fileName); DscRoleNode roleNode = new DscRoleNode(fileName, parent); parent.Nodes.Add(roleNode); return(roleNode); }