Example #1
0
        public static void Save(Highscores scoresTable)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Highscores));
            StreamWriter  writer     = new StreamWriter("Highscores.xml");

            serializer.Serialize(writer, scoresTable);
            writer.Close();
        }
Example #2
0
 public static Highscores Load()
 {
     if (File.Exists("Highscores.xml"))
     {
         XmlSerializer serializer = new XmlSerializer(typeof(Highscores));
         StreamReader  reader     = new StreamReader("Highscores.xml");
         Highscores    table      = (Highscores)serializer.Deserialize(reader);
         reader.Close();
         return(table);
     }
     else
     {
         Highscores table = new Cetris.Highscores();
         table.SetDefault();
         return(table);
     }
 }