Ejemplo n.º 1
0
        /// <summary>
        /// Loads the settings from the XML node.
        /// </summary>
        public void LoadFromXml(XmlNode xmlNode)
        {
            if (xmlNode == null)
            {
                throw new ArgumentNullException(nameof(xmlNode));
            }

            InstanceID   = xmlNode.GetChildAsInt("InstanceID");
            Name         = xmlNode.GetChildAsString("Name");
            Extension    = xmlNode.GetChildAsString("Extension");
            WebUrl       = xmlNode.GetChildAsString("WebUrl");
            AgentEnabled = xmlNode.GetChildAsBool("AgentEnabled");
            DbEnabled    = xmlNode.GetChildAsBool("DbEnabled");

            if (xmlNode.SelectSingleNode("AgentConnectionOptions") is XmlNode agentConnectionOptionsNode)
            {
                AgentConnectionOptions.LoadFromXml(agentConnectionOptionsNode);
            }

            if (xmlNode.SelectSingleNode("DbConnectionOptions") is XmlNode dbConnectionOptionsNode)
            {
                DbConnectionOptions.LoadFromXml(dbConnectionOptionsNode);
            }

            if (xmlNode.SelectSingleNode("DownloadOptions") is XmlNode downloadOptionsNode)
            {
                DownloadOptions.LoadFromXml(downloadOptionsNode);
            }

            if (xmlNode.SelectSingleNode("UploadOptions") is XmlNode uploadOptionsNode)
            {
                UploadOptions.LoadFromXml(uploadOptionsNode);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves the settings into the XML node.
        /// </summary>
        public void SaveToXml(XmlElement xmlElem)
        {
            if (xmlElem == null)
            {
                throw new ArgumentNullException(nameof(xmlElem));
            }

            xmlElem.AppendElem("InstanceID", InstanceID);
            xmlElem.AppendElem("Name", Name);
            xmlElem.AppendElem("Extension", Extension);
            xmlElem.AppendElem("WebUrl", WebUrl);
            xmlElem.AppendElem("AgentEnabled", AgentEnabled);
            xmlElem.AppendElem("DbEnabled", DbEnabled);
            AgentConnectionOptions.SaveToXml(xmlElem.AppendElem("AgentConnectionOptions"));
            DbConnectionOptions.SaveToXml(xmlElem.AppendElem("DbConnectionOptions"));
            DownloadOptions.SaveToXml(xmlElem.AppendElem("DownloadOptions"));
            UploadOptions.SaveToXml(xmlElem.AppendElem("UploadOptions"));
        }