2
votes

I am trying to save high score information in my XNA 4.0 game. They way I've read how to do it uses StorageContainer.TileLocation which is apparently not available in XNA 4.0. Here is the SaveHighScores method

 public static void SaveHighScores(HighScoreData data, string filename)
        {
            // Get the path of the save game
            string fullpath = Path.Combine(StorageContainer.TitleLocation, filename);

            // Open the file, creating it if necessary
            FileStream stream = File.Open(fullpath, FileMode.OpenOrCreate);
            try
            {
                // Convert the object to XML data and put it in the stream
                XmlSerializer serializer = new XmlSerializer(typeof(HighScoreData));
                serializer.Serialize(stream, data);
            }
            finally
            {
                // Close the file
                stream.Close();
            }
        }

TitleLocation is what is giving me an error and I later found out it is no longer available in XNA 4.0

Is there any way of making this work in XNA 4.0 or if not, how is it done in XNA 4.0 instead of using StorageContainer.TitleLocation?

1

1 Answers