using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Storage;
using System.IO;
using System.Xml.Serialization;
namespace DarkWynter.Engine.HighScores
{
///
/// This class is meant to load the saved HighScores file. THis works on
/// both the XBox and pc
///
class LoadHighScores
{
String file;
String path;
///
/// Constructor
///
/// the location of the file
/// the name of the file with extension
public LoadHighScores(String path, String file)
{
this.path = path;
this.file = file;
}//end constructor
///
/// loads the file and returns a list of SavedData
///
///
public List LoadScores()
{
// Get the path of the save game
string fileName = Path.Combine(path, file);
// Check to see if the save exists
if (!File.Exists(fileName))
// Notify the user there is no save
return null; ;
// Open the file
FileStream stream = File.Open(fileName, FileMode.OpenOrCreate,
FileAccess.Read);
// Read the data from the file
XmlSerializer serializer = new XmlSerializer(typeof(List));
List list = (List)serializer.Deserialize(stream);
// Close the file
stream.Close();
return list;
}//end load
}//end class
}//end namespace