Exemplo n.º 1
0
 public void Add(GroupUpdateRuleCollection add)
 {
     // Add all the update rules provided
     foreach (GroupUpdateRule ur in add)
     {
         this.List.Add(ur);
     }
 }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
            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);
            }
Exemplo n.º 5
0
 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);
     }
 }
Exemplo n.º 6
0
        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;
            }
        }
Exemplo n.º 7
0
            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;
            }
Exemplo n.º 8
0
 public void Add(GroupUpdateRuleCollection add)
 {
     // Add all the update rules provided
     foreach (GroupUpdateRule ur in add)
         this.List.Add(ur);
 }
Exemplo n.º 9
0
 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;
     }
 }