Exemplo n.º 1
0
        public static XmlElement ToXml(Dictionary <string, object> dct, XmlDocument xmlDocument = null)
        {
            if (xmlDocument == null)
            {
                xmlDocument = new();
            }

            var xmlElementCM = xmlDocument.CreateElement("ConfigurationManager");

            xmlElementCM.SetAttribute("basePath", dct["basePath"] as string);
            var xmlElementLoaders = xmlDocument.CreateElement("Loaders");

            xmlDocument.AddChildren(xmlElementLoaders, dct["loaders"] as List <object>, LoaderInputType.ToXml);
            xmlElementCM.AppendChild(xmlElementLoaders);

            return(xmlElementCM);
        }
Exemplo n.º 2
0
        public static XmlElement ToXml(Dictionary <string, object> dct, XmlDocument xmlDocument = null)
        {
            if (xmlDocument == null)
            {
                xmlDocument = new();
            }

            var xmlElementLoader = xmlDocument.CreateElement("Loader");

            xmlElementLoader.SetAttribute("name", $"{dct["name"]}");
            xmlElementLoader.SetAttribute("assembly", $"{dct["assembly"]}");
            xmlElementLoader.SetAttribute("type", $"{dct["type"]}");
            xmlElementLoader.SetAttribute("enabled", $"{dct["enabled"]}".ToLower());

            xmlDocument.AddChildren(xmlElementLoader, dct["sources"] as List <object>, SourceInputType.ToXml);

            return(xmlElementLoader);
        }