CreateOrReplace() public method

Creates or replaces the underlying savegame file and opens a writing stream for it.
public CreateOrReplace ( IsolatedStorageFile isf ) : System.IO.Stream
isf System.IO.IsolatedStorage.IsolatedStorageFile Isolated storage to use.
return System.IO.Stream
Beispiel #1
0
 /// <summary>
 /// Saves the game to a CartridgeSavegame object.
 /// </summary>
 /// <param name="cs">The CartridgeSavegame representing the savegame.</param>
 public void Save(CartridgeSavegame cs)
 {
     using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
     {
         using (System.IO.Stream fs = cs.CreateOrReplace(isf))
         {
             Save(fs, cs.Name);
         }
     }
 }
		/// <summary>
		/// Saves the game to a CartridgeSavegame object.
		/// </summary>
		/// <param name="cs">The CartridgeSavegame representing the savegame.</param>
        /// <returns>True if the savegame was a success, false if an error occured.</returns>
		public bool Save(CartridgeSavegame cs)
		{
			try
			{
				using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
				{
					using (System.IO.Stream fs = cs.CreateOrReplace(isf))
					{
						Save(fs, cs.Name);
					}
				}

                return true;
			}
			catch (Exception)
			{
                return false;
			}
		}
		/// <summary>
		/// Saves the game to a CartridgeSavegame object.
		/// </summary>
		/// <param name="cs">The CartridgeSavegame representing the savegame.</param>
		public void Save(CartridgeSavegame cs)
		{
			using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
			{
				using (System.IO.Stream fs = cs.CreateOrReplace(isf))
				{
					Save(fs);
				}
			}
		}