public static void Save(Highscores scoresTable) { XmlSerializer serializer = new XmlSerializer(typeof(Highscores)); StreamWriter writer = new StreamWriter("Highscores.xml"); serializer.Serialize(writer, scoresTable); writer.Close(); }
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); } }