コード例 #1
0
        public static void Moves(string location = "")
        {
            if (location == "")
            {
                Console.WriteLine("Drag and drop the move file and press enter...");
                location = Console.ReadLine();
            }

            var moveList = Parser.ParseMoves(location);

            // sort
            moveList.Sort((m1, m2) => String.CompareOrdinal(m1.Type, m2.Type));

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

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

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

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

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