Ejemplo n.º 1
0
        public void Add(World world, string path)
        {
            string realPath = world.Name;

            realPath = realPath.ToLower();
            realPath = realPath.Replace(' ', '_');
            realPath += MainStrings.XmlFormat;
            realPath = path + realPath;

            world.Save(realPath);

            _worlds.Add(world.Name, realPath);

            XDocument loadFile = XDocument.Load(_path);
            XElement mainElement = loadFile.Element(Tags.WorldsTag);

            XElement newWorld = new XElement(Tags.WorldTag,
                new XAttribute(Tags.NameTag, world.Name),
                new XAttribute(Tags.PathTag, realPath));

            mainElement.Add(newWorld);

            loadFile.Save(_path);
        }