To followup from a previous query - I need some help with the implementation of easystorage high scores, which is bringing up some errors on the xbox.
I get the prompt screen, a savedevice is selected and a file are all created! However the file remains empty, (I've tried prepopulating but still get errors).
The full portions of the scoring code can be found here: http://pastebin.com/74v897Yt
The current issue in particular is in LoadHighScores() - "There is an error in XML document (0, 0)." under line data = (HighScoreData)serializer.Deserialize(stream);
I'm not sure whether this line is correct either: HighScoreData data = new HighScoreData();
public static HighScoreData LoadHighScores(string container, string filename) { HighScoreData data = new HighScoreData();
if (Global.SaveDevice.FileExists(container, filename))
{
Global.SaveDevice.Load(container, filename, stream =>
{
File.Open(Global.fileName_options, FileMode.OpenOrCreate,
FileAccess.Read);
try
{
// Read the data from the file
XmlSerializer serializer = new XmlSerializer(typeof(HighScoreData));
data = (HighScoreData)serializer.Deserialize(stream);
}
finally
{
// Close the file
stream.Close();
// stream.Dispose();
}
});
}
return (data);
}
I call: PromptMe(); when the Start button is pressed at the beginning.
I call: if (Global.SaveDevice.IsReady){entries = LoadHighScores(HighScoresContainer, HighScoresFilename);} during the menu screen to try and display the highscore screen.
I call: SaveHighScore(); when game ends.
I've tried altering the struct code to a class but still no luck. Any help greatly appreciated.