public Cartridge InitAndRestoreCartridge(string filename, string gwsFilename)
{
// Boot Time: inits the cartridge and process position.
Cartridge cart = new Cartridge(filename);
try
{
using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fs = isf.OpenFile(cart.Filename, System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
Init(fs, cart);
}
// Adds info about the cartridge to the crash reporter.
Geowigo.Utils.DebugUtils.AddBugSenseCrashExtraData(cart);
ApplySensorData();
// Run Time: the game starts.
using (IsolatedStorageFileStream fs = isf.OpenFile(gwsFilename, System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
Restore(fs);
}
ApplySensorData();
}
}
catch (Exception)
{
// Re-throw any exception.
lock (_SyncRoot)
{
_IsInCrash = true;
}
throw;
}
return cart;
}