Esempio n. 1
0
        public static void SaveTournamentToFile(ITournament tournament, string filename)
        {
            if (tournament == null)
            {
                return;
            }
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Encoding           = Encoding.UTF8;
            settings.OmitXmlDeclaration = false;
            settings.Indent             = true;
            settings.IndentChars        = "\t";
            if (!Directory.Exists(Path.GetDirectoryName(filename)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(filename));
            }
            XmlWriter writer = XmlWriter.Create(filename, settings);

            tournament.ToFullXml(writer);
            writer.Flush();
            writer.Close();
        }