public void Add(GroupUpdateRuleCollection add) { // Add all the update rules provided foreach (GroupUpdateRule ur in add) { this.List.Add(ur); } }
private void WriteComputerGroupUpdateRulesXML(GroupUpdateRuleCollection c, string file) { // Create XML file (overwriting it if it already exists) using (FileStream fs = new FileStream(file, FileMode.Create)) { XmlSerializer xs = new XmlSerializer(typeof(GroupUpdateRuleCollection)); xs.Serialize(fs, c); } }
private GroupUpdateRuleCollection ReadComputerGroupRuleXML(string file) { // Open the XML file and read the config. Let the exceptions fly for other procedures to handle using (FileStream fs = new FileStream(file, FileMode.Open)) { GroupUpdateRuleCollection c = new GroupUpdateRuleCollection(); XmlSerializer xs = new XmlSerializer(typeof(GroupUpdateRuleCollection)); c = (GroupUpdateRuleCollection)xs.Deserialize(fs); return(c); } }
private GroupUpdateRuleCollection AddChildrenOf(GroupUpdateRule rule, bool recursive) { GroupUpdateRuleCollection uc = new GroupUpdateRuleCollection(); // Loop through the collection and determine if the current rule is a child of the current rule foreach (GroupUpdateRule ur in this.List) { if (ur.parentcomputergroup != null && rule.computergroup.Id == ur.parentcomputergroup.Id) { // Found one - add it to the collection. uc.Add(ur); // Are we recursively adding children? if (recursive) { // Yes, also add all the children of this child node uc.Add(AddChildrenOf(ur, true)); } } } return(uc); }
private GroupUpdateRuleCollection ReadComputerGroupRuleXML(string file) { // Open the XML file and read the config. Let the exceptions fly for other procedures to handle using (FileStream fs = new FileStream(file, FileMode.Open)) { GroupUpdateRuleCollection c = new GroupUpdateRuleCollection(); XmlSerializer xs = new XmlSerializer(typeof(GroupUpdateRuleCollection)); c = (GroupUpdateRuleCollection)xs.Deserialize(fs); // Apply appropriate defaults to any field that had no value in the XML file and apply WSUS object so group details can be loaded foreach (GroupUpdateRule ur in c) { ur.SetWSUSObject(wsus); if (ur.sortweight == -1) ur.sortweight = ur.displayorder; if (ur.shortname == null) ur.shortname = ur.computergroup.Name; } return c; } }
private GroupUpdateRuleCollection AddChildrenOf(GroupUpdateRule rule, bool recursive) { GroupUpdateRuleCollection uc = new GroupUpdateRuleCollection(); // Loop through the collection and determine if the current rule is a child of the current rule foreach (GroupUpdateRule ur in this.List) { if (ur.parentcomputergroup != null && rule.computergroup.Id == ur.parentcomputergroup.Id) { // Found one - add it to the collection. uc.Add(ur); // Are we recursively adding children? if (recursive) // Yes, also add all the children of this child node uc.Add(AddChildrenOf(ur, true)); } } return uc; }
public void Add(GroupUpdateRuleCollection add) { // Add all the update rules provided foreach (GroupUpdateRule ur in add) this.List.Add(ur); }
private GroupUpdateRuleCollection ReadComputerGroupRuleXML(string file) { // Open the XML file and read the config. Let the exceptions fly for other procedures to handle using (FileStream fs = new FileStream(file, FileMode.Open)) { GroupUpdateRuleCollection c = new GroupUpdateRuleCollection(); XmlSerializer xs = new XmlSerializer(typeof(GroupUpdateRuleCollection)); c = (GroupUpdateRuleCollection)xs.Deserialize(fs); return c; } }