BiomePainter.Settings.Save C# (CSharp) Method

Save() public static method

public static Save ( ) : void
return void
        public static void Save()
        {
            if(!Directory.Exists(Path.GetDirectoryName(path)))
                Directory.CreateDirectory(Path.GetDirectoryName(path));

            XmlDocument doc = new XmlDocument();
            doc.AppendChild(doc.CreateXmlDeclaration("1.0", null, null));
            XmlNode settings = doc.CreateElement("settings");
            XmlNode node = doc.CreateElement("worlds");
            XmlAttribute attr;

            for (int i = 0; i < recentWorlds.Count; i++)
            {
                XmlNode world = doc.CreateElement("world");
                attr = doc.CreateAttribute("path");
                attr.Value = recentWorlds[i].Path;
                world.Attributes.Append(attr);

                attr = doc.CreateAttribute("name");
                attr.Value = recentWorlds[i].Name;
                world.Attributes.Append(attr);
                node.AppendChild(world);
            }

            settings.AppendChild(node);

            node = doc.CreateElement("redraw");
            attr = doc.CreateAttribute("value");
            attr.Value = redrawTerrainMap.ToString().ToLower();
            node.Attributes.Append(attr);
            settings.AppendChild(node);

            node = doc.CreateElement("transparency");
            attr = doc.CreateAttribute("value");
            attr.Value = transparency.ToString().ToLower();
            node.Attributes.Append(attr);
            settings.AppendChild(node);

            node = doc.CreateElement("biomeFoliage");
            attr = doc.CreateAttribute("value");
            attr.Value = biomeFoliage.ToString().ToLower();
            node.Attributes.Append(attr);
            settings.AppendChild(node);

            doc.AppendChild(settings);
            doc.Save(path);
        }