Пример #1
0
        public static void DeserializeHostInfo(XmlNode node, ref LACTreeNode pluginNode, string nodepath, ref Hostinfo hn, bool bIsGPOPlugin)
        {
            XmlNode hostnode = node.SelectSingleNode("HostInfo");

            if (hostnode == null) return;

            if (hn == null)
                hn = new Hostinfo();

            foreach (XmlNode child in hostnode.ChildNodes)
            {
                if (child.Name.Trim().Equals("DomainFQDN"))
                {
                    hn.domainName = child.InnerXml;
                    hn.domainControllerName = child.InnerXml;
                    // split the provided name into parts
                    string[] aparts = child.InnerXml.Split(new char[] { '.' });
                    hn.creds.Domain = aparts[0];
                }
                else if (child.Name.Trim().Equals("DomainShort"))
                {
                    hn.shortName = child.InnerXml;
                }
                else if (child.Name.Trim().Equals("HostName"))
                {
                    hn.hostName = child.InnerXml;
                }
                else if (child.Name.Trim().Equals("UserName"))
                {
                    hn.creds.UserName = child.InnerXml;
                }
                else if (bIsGPOPlugin && child.Name.Trim().Equals("GPOInfo"))
                {
                    string sDN = null;
                    string sDisplayname = null;
                    foreach (XmlNode gpoNode in child.ChildNodes)
                    {
                        if (gpoNode.Name.Trim().Equals("GPODistinguishedName"))
                        {
                            sDN = gpoNode.InnerXml;
                        }
                        else if (gpoNode.Name.Trim().Equals("GPODisplayName"))
                        {
                            sDisplayname = gpoNode.InnerXml;
                        }
                    }
                    GPObjectInfo gpoInfo = new GPObjectInfo(null, sDN, sDisplayname);
                    hn.Tag = gpoInfo;
                }
            }
            pluginNode.Tag = hn;
        }
Пример #2
0
        public static void CreateAppendGPOInfoElement(GPObjectInfo gpoInfo, ref XmlElement parentElement, out XmlElement gpoInfoElement)
        {
            gpoInfoElement = parentElement.OwnerDocument.CreateElement("GPOInfo");

            if (gpoInfo == null)
                return;

            XmlElement gpoEle;

            gpoEle = gpoInfoElement.OwnerDocument.CreateElement("GPODistinguishedName");
            gpoEle.InnerXml = gpoInfo.DistinguishedName;
            gpoInfoElement.AppendChild(gpoEle);

            gpoEle = gpoInfoElement.OwnerDocument.CreateElement("GPODisplayName");
            gpoEle.InnerXml = gpoInfo.DisplayName;
            gpoInfoElement.AppendChild(gpoEle);
        }