/// <summary> /// Removes the group. /// </summary> /// <param name = "groups">The groups.</param> /// <returns></returns> public PBXGroup RemoveGroup(String groups) { lock (this.syncRoot) { // Only keep the n-1 groups List <String> parts = groups.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).ToList(); String last = parts.Last(); parts.RemoveAt(parts.Count - 1); // Go to the parent group PBXGroup g, group = this.Document.Project.MainGroup; foreach (String part in parts) { g = group.FindGroup(part); if (g == null) { // For each group not found, create it g = new PBXGroup(part); group.AddChild(g); } group = g; } // If the group to delete exists, remove it g = group.FindGroup(last); if (g != null) { group.RemoveChild(g); } return(g); } }
/// <summary> /// Adds the group. /// </summary> /// <param name = "groups">The group path.</param> /// <returns></returns> public PBXGroup AddGroup(String groups) { lock (this.syncRoot) { // Split the group paths List <string> parts = groups.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).ToList(); PBXGroup group = this.Document.Project.MainGroup; foreach (String part in parts) { PBXGroup g = group.FindGroup(part); if (g == null) { // For each group not found, create it g = new PBXGroup(part); group.AddChild(g); } group = g; } return(group); } }