Geowigo.Models.WFCoreAdapter.InitAndRestoreCartridge C# (CSharp) Method

InitAndRestoreCartridge() public method

Resumes playing a Wherigo cartridge saved game.
public InitAndRestoreCartridge ( string filename, string gwsFilename ) : WF.Player.Core.Cartridge
filename string Filename of the cartridge in the isolated storage.
gwsFilename string Filename of the savegame to restore.
return WF.Player.Core.Cartridge
		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;
		}