コード例 #1
0
ファイル: UIpp.cs プロジェクト: theznerd/GUIpp
        public XmlNode GenerateXML()
        {
            // Create XML Node and Attributes
            XmlDocument  d             = new XmlDocument();
            XmlNode      output        = d.CreateNode("element", "UIpp", null);
            XmlAttribute alwaysOnTop   = d.CreateAttribute("AlwaysOnTop");
            XmlAttribute color         = d.CreateAttribute("Color");
            XmlAttribute dialogSidebar = d.CreateAttribute("DialogSidebar");
            XmlAttribute flat          = d.CreateAttribute("Flat");
            XmlAttribute icon          = d.CreateAttribute("Icon");
            XmlAttribute title         = d.CreateAttribute("Title");
            XmlAttribute rootXMLPath   = d.CreateAttribute("RootXMLPath");

            // Assign attribute valutes
            alwaysOnTop.Value   = AlwaysOnTop.ToString();
            color.Value         = Color;
            dialogSidebar.Value = DialogSidebar.ToString();
            flat.Value          = Flat.ToString();
            icon.Value          = Icon;
            title.Value         = Title;
            rootXMLPath.Value   = RootXMLPath;

            // Append attributes
            if (null != AlwaysOnTop)
            {
                output.Attributes.Append(alwaysOnTop);
            }
            if (!string.IsNullOrEmpty(Color))
            {
                output.Attributes.Append(color);
            }
            if (null != DialogSidebar)
            {
                output.Attributes.Append(dialogSidebar);
            }
            if (null != Flat)
            {
                output.Attributes.Append(flat);
            }
            if (!string.IsNullOrEmpty(Icon))
            {
                output.Attributes.Append(icon);
            }
            if (!string.IsNullOrEmpty(Title))
            {
                output.Attributes.Append(title);
            }
            if (!string.IsNullOrEmpty(RootXMLPath))
            {
                output.Attributes.Append(rootXMLPath);
            }

            // Append Software
            if (Software.Softwares.Count != 0)
            {
                XmlNode importNode = d.ImportNode(Software.GenerateXML(), true);
                output.AppendChild(importNode);
            }

            // Append Messages
            if (Messages.MessageCollection.Count != 0)
            {
                XmlNode importNode = d.ImportNode(Messages.GenerateXML(), true);
                output.AppendChild(importNode);
            }

            // Append Actions
            if (Actions.actions.Count != 0)
            {
                XmlNode importNode = d.ImportNode(Actions.GenerateXML(), true);
                output.AppendChild(importNode);
            }

            return(output);
        }