> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Load

> 从指定容器中的给定 Blob（文件）加载数据。

# Microsoft.Xbox.Wrappers.XGameSave.Provider.Load

从指定容器中的给定 Blob（文件）加载数据。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
BlobData Load(const std::string& containerName,
              const std::string& blobName );
```

<a id="parametersSection" />

### 参数

*containerName*   \_In\_<br />类型：std::string

容器的名称。

*blobName*  \_In\_<br />类型：std::string

要从中加载数据的 Blob 的名称。

<a id="retvalSection" />

### 返回值

类型：BlobData

此方法返回一个向量，其中包含该 Blob 内容的逐字节副本。

<a id="exampleSection" />

### 示例

以下示例代码演示了如何使用 **Load** 方法。

```cpp theme={null}
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.
      }
   }
}
```

<a id="remarksSection" />

## 备注

如果在 UI 线程上调用此方法，它将抛出异常。

如果没有与容器和 Blob 名称相匹配的项，则返回的向量为空。

必须先调用 [Initialize](/reference/system/Wrappers/classes/provider/methods/xgamesave_wrapper_provider_initialize) 方法，然后才能调用 `Provider` 类中的任何其他方法。

<a id="requirementsSection" />

## 要求

**标头：** xgamesavewrappers.hpp

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

<a id="seealsoSection" />

## 另请参阅

[Microsoft.Xbox.Wrappers.XGameSave.Provider](/reference/system/Wrappers/classes/provider/xgamesave_wrapper_provider)<br />[XGameSave 包装器成员](/reference/system/Wrappers/xgamesave_wrapper_members)


## Related topics

- [LoadPipeline](/zh-CN/reference/graphics/d3d12/interfaces/id3d12pipelinelibrary1/methods/id3d12pipelinelibrary1_loadpipeline_public.md)
- [LoadGraphicsPipeline](/zh-CN/reference/graphics/d3d12/interfaces/id3d12pipelinelibrary/methods/id3d12pipelinelibrary_loadgraphicspipeline_public.md)
- [LoadComputePipeline](/zh-CN/reference/graphics/d3d12/interfaces/id3d12pipelinelibrary/methods/id3d12pipelinelibrary_loadcomputepipeline_public.md)
- [ACP_COMMAND_LOAD_SHAPE_FLOWGRAPH](/zh-CN/reference/audio/acphal/structs/acp_command_load_shape_flowgraph.md)
- [Economy V2 TurboLoading](/zh-CN/services/playfab/economy-monetization/economy-v2/inventory/turboloading.md)
