/// <summary> /// Returns the current set of groups. /// </summary> /// <returns>The list of groups.</returns> public ComDaGroup[] GetGroups() { lock (Lock) { ComDaGroup[] groups = new ComDaGroup[m_groups.Count]; for (int ii = 0; ii < m_groups.Count; ii++) { groups[ii] = m_groups[ii]; } return(groups); } }
/// <summary> /// Removes the group. /// </summary> /// <param name="group">The group.</param> public void RemoveGroup(ComDaGroup group) { lock (Lock) { for (int ii = 0; ii < m_groups.Count; ii++) { if (Object.ReferenceEquals(group, m_groups[ii])) { m_groups.RemoveAt(ii); group.Dispose(); } } } }
/// <summary> /// Adds a group to the server. /// </summary> /// <param name="groupName">Name of the group.</param> /// <returns>The new group.</returns> public ComDaGroup AddGroup(string groupName) { lock (Lock) { // assign a unique name. if (String.IsNullOrEmpty(groupName)) { groupName = Guid.NewGuid().ToString(); } // create the group. ComDaGroup group = new ComDaGroup(groupName, ++m_groupCounter); m_groups.Add(group); return(group); } }
/// <summary> /// Gets the group by handle. /// </summary> /// <param name="serverHandle">The server handle.</param> /// <returns>The group.</returns> public ComDaGroup GetGroupByHandle(int serverHandle) { lock (Lock) { for (int ii = 0; ii < m_groups.Count; ii++) { ComDaGroup group = m_groups[ii]; if (group.ServerHandle == serverHandle) { return(group); } } return(null); } }
/// <summary> /// Gets the group with the specified name. /// </summary> /// <param name="groupName">Name of the group.</param> /// <returns>The group. Null if it does not exist.</returns> public ComDaGroup GetGroupByName(string groupName) { lock (Lock) { for (int ii = 0; ii < m_groups.Count; ii++) { ComDaGroup group = m_groups[ii]; if (group.Name == groupName) { return(group); } } return(null); } }
/// <summary> /// Returns the current set of groups. /// </summary> /// <returns>The list of groups.</returns> public ComDaGroup[] GetGroups() { lock (Lock) { ComDaGroup[] groups = new ComDaGroup[m_groups.Count]; for (int ii = 0; ii < m_groups.Count; ii++) { groups[ii] = m_groups[ii]; } return groups; } }
/// <summary> /// Adds a group to the server. /// </summary> /// <param name="groupName">Name of the group.</param> /// <returns>The new group.</returns> public ComDaGroup AddGroup(string groupName) { lock (Lock) { // assign a unique name. if (String.IsNullOrEmpty(groupName)) { groupName = Guid.NewGuid().ToString(); } // create the group. ComDaGroup group = new ComDaGroup(groupName, ++m_groupCounter); m_groups.Add(group); return group; } }