Sign-Out Events

Jan 8, 2010 at 5:06 PM

First - Thanks tons for EasyStorage. Without it I would have no clue at all how to do all this stuff.

Now for the question ....

I start the game and the player is signed in. Later the player signs out and I restart the game and disable saves/reloads. Now even later the player relogs in. In this case I just continue with the game but I want to turn back on saves. Or even simplier, in the middle of the game the player signs out and signs in as someone else.

Do I just call all the EasyStorage init stuff again (since I assume everything from before was invalid). Or is there a different way to re-initialize EasyStorage ?


Jan 8, 2010 at 5:10 PM

Recreating the component and performing the initialization again is probably the safest approach to make sure the old StorageDevice held inside is cleared.

Jan 8, 2010 at 5:20 PM

Thanks for the quick reply

Sep 24, 2010 at 8:27 AM

I am having a problem with this scenario, so hopefully someone can help me out.

I try to clear out the PlayerSaveDevice whenever someone returns to my splash screen.  Then I create a new PlayerSaveDevice when someone presses start.  EasySorage works fine after the first "start", but then I get an exception when I back out and start again:

An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll

Additional information: A new container cannot be opened until all previouses containers used by this PlayerIndex have been disposed.

It looks to me like I'm not closing the old save device properly, but I'm not sure how to do that correctly.  Here is what I have:

 public void ClearPlayer()
            // remove any existing save device
            if (individualSaveDeviceComponent != null)

            individualSaveDevice = individualSaveDeviceComponent = null;
            IndividualSaveDeviceReady = false;

Any advice?


Sep 25, 2010 at 2:03 AM

I looked through the EasyStorage code and found that since my problem is happening with calls to FileExists(), I could change this code:

return File.Exists(path);

// no need to dispose the container since we aren't changing data

to this:

bool fileExists = File.Exists(path);

// no need to dispose the container since we aren't changing data (<-- i guess this isn't true if you want to be able to recreate devices)
return fileExists;

The problem seems to be fixed so maybe containers do need to be disposed even after read-only operations if you plan to do this save device recreation without exiting the game.  I didn't test it, but my guess is the code in Load() and GetFiles() needs to be changed also.