Share via


Microsoft.Xbox.Wrappers.XGameSave.Provider.Load

Loads the data from the given blob (file), from within the specified container.

Syntax

BlobData Load(const std::string& containerName,
              const std::string& blobName );

Parameters

containerName   _In_
Type: std::string

The name of the container.

blobName  _In_
Type: std::string

The name of the blob from which to load data.

Return value

Type: BlobData

This method returns a vector containing a bytewise copy of the contents of the blob.

Example

The following example code demonstrates how to use the Load method.

using Microsoft::Xbox::Wrappers::GameSave;

Provider provider = new Provider();

if(SUCCEEDED(provider->Initialize(userHandle, mySCID))
{
   std::vector<std::string> containers = provider->QueryContainers("Save slot 1");
   
   if(containers.size() == 1)
   {
      BlobData data = provider->Load("Save_slot_1", "progress");
      
      if(!data.empty())
      {
         // Read the data into the game.
      }
      else
      {
         // Unexpected because there should be
         // only one blob in the container.
      }
   }
}

Remarks

This method throws an exception if you call it on the UI thread.

If there is no match for the container and blob names, then the returned vector is empty.

You must call the Initialize method before you can call any other method from the Provider class.

Requirements

Header: xgamesavewrappers.hpp

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

Microsoft.Xbox.Wrappers.XGameSave.Provider
XGameSave wrapper members
Game saves simplified wrapper