Exemplo n.º 1
0
        public static void Abilities(string location = "")
        {
            if (location == "")
            {
                Console.WriteLine("Drag and drop the abilities file and press enter...");
                location = Console.ReadLine();
            }
            var abilitiesList = Parser.ParseAbilities(location);

            abilitiesList.Sort((m1, m2) => String.CompareOrdinal(m1.Name, m2.Name));

            foreach (var move in abilitiesList)
            {
                Console.WriteLine(move.Name);
            }

            Console.WriteLine(string.Format("There are {0} abilities in this list!", abilitiesList.Count));
            Console.WriteLine("Saving to XML");

            var xml  = new System.Xml.Serialization.XmlSerializer(typeof(List <Ability>));
            var path = System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, "Files", "abilities.xml");

            var stream = new System.IO.StreamWriter(path);

            xml.Serialize(stream, abilitiesList);
            stream.Flush();
            stream.Close();
            Console.WriteLine("Done");
            Console.WriteLine("Output at {0}", path);
        }