How else can you open up an XML file then? I am using a map editor called GLEED2D and it saves everything in an XML file. It came with its own object to load in maps but it uses FileStream and doesn't work on the Xbox. How else can I do this?
This is where the error occurs and shows a little on how it reads the XML File:
public static Level FromFile(string filename, ContentManager cm)
{
FileStream stream = File.Open(filename, FileMode.Open); //exception occurs here!
XmlSerializer serializer = new XmlSerializer(typeof(Level));
Level level = (Level)serializer.Deserialize(stream);
stream.Close();
foreach (Layer layer in level.Layers)
{
foreach (Item item in layer.Items)
{
item.CustomProperties.RestoreItemAssociations(level);
item.load(cm);
}
}
return level;
}
The actual exception says "System.UnauthorizedAccessException".
UPDATE!!
All I had to do was change "FileStream stream = File.Open(filename, FileMode.Open);" to "Stream stream = File.OpenRead(filename);".
Works fine now :)