> ## 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.

# XPackageInstallChunksAsync

> XPackageInstallChunksAsync

# XPackageInstallChunksAsync

Démarre l'installation de blocs.

## Syntaxe

```cpp theme={null}
HRESULT XPackageInstallChunksAsync(  
         const char* packageIdentifier,  
         uint32_t selectorCount,  
         XPackageChunkSelector* selectors,  
         uint32_t minimumUpdateIntervalMs,  
         bool suppressUserConfirmation,  
         XAsyncBlock* asyncBlock  
)  
```

### Paramètres

*packageIdentifier*   \_In\_z\_\
Type : char\*

Chaîne qui identifie de manière unique le package installé sur le disque. Pour plus d'informations sur les identificateurs de package, consultez [Gérer et octroyer des licences pour le contenu téléchargeable (DLC)](/fr/publishing/xstore-commerce/xstore-dlc).

*selectorCount*   \_In\_\
Type : uint32\_t

Nombre de sélecteurs dans le paramètre *selectors*.

*selectors*   \_In\_reads\_(selectorCount)\
Type : [XPackageChunkSelector\*](/fr/reference/system/xpackage/structs/xpackagechunkselector)

Tableau de sélecteurs qui spécifient les blocs à installer.

*minimumUpdateIntervalMs*   \_In\_\
Type : uint32\_t

Intervalle entre les mises à jour, en millisecondes.

*suppressUserConfirmation*   \_In\_\
Type : bool

Si les blocs à installer dépassent une taille prédéfinie, une invite de confirmation s'affiche. Si *suppressUserConfirmation* a la valeur true, aucune invite ne s'affiche et l'installation se poursuit comme si l'utilisateur avait accepté. Cela permet au jeu de présenter sa propre interface utilisateur. Si le jeu utilise cette option, il doit également appeler [XPackageEstimateDownloadSize](/fr/reference/system/xpackage/functions/xpackageestimatedownloadsize) pour obtenir la taille qui sera présentée à l'utilisateur. [XPackageEstimateDownloadSize](/fr/reference/system/xpackage/functions/xpackageestimatedownloadsize) renvoie également un booléen indiquant si la taille est suffisamment importante pour qu'une invite soit affichée. Si une confirmation de téléchargement est nécessaire, le jeu doit soit l'afficher à l'aide de sa propre interface utilisateur, soit laisser **XPackageInstallChunks** l'afficher.

*asyncBlock*   \_Inout\_\
Type : [XAsyncBlock\*](/fr/reference/system/xasync/structs/xasyncblock)

**XAsyncBlock** permettant de surveiller l'état de l'appel asynchrone.

### Valeur de retour

Type : HRESULT

Code de réussite ou d'erreur HRESULT.

## Remarques

[XPackageInstallChunks](/fr/reference/system/xpackage/functions/xpackageinstallchunks) possède une variante asynchrone. L'installation de blocs peut impliquer de demander à l'utilisateur d'accepter la taille du téléchargement.

Cet exemple montre comment BigMaps est installé à l'aide des API asynchrones :

```cpp theme={null}
void CALLBACK BigMapsInstallProgress(
    void* /* context */,
    XPackageInstallationMonitorHandle monitor)
{
    XPackageInstallationProgress progress;
    XPackageGetInstallationProgress(monitor, &progress);
    if (progress.completed)
    {
        printf("BigMaps Installed\n");
        XPackageCloseInstallationMonitorHandle(monitor);
    }
}

void CALLBACK BigMapsAsyncInstallComplete(XAsyncBlock* asyncBlock)
{
    XPackageInstallationMonitorHandle monitor;
    HRESULT hr = XPackageInstallChunksResult(asyncBlock, &monitor);
    delete asyncBlock;

    if (SUCCEEDED(hr))
    {
        XTaskQueueRegistrationToken token;
        if (FAILED(XPackageRegisterInstallationProgressChanged(
            monitor,
            nullptr,
            BigMapsInstallProgress, &token)))
        {
            XPackageCloseInstallationMonitorHandle(monitor);
        }
    }
}

HRESULT InstallBigMapsAsync(XTaskQueueHandle queue)
{
    char id[XPACKAGE_IDENTIFIER_MAX_LENGTH];
    HRESULT hr = XPackageGetCurrentProcessPackageIdentifier(_countof(id), id);
    if (FAILED(hr)) return hr;

    XPackageChunkSelector selector;
    selector.type = XPackageChunkSelectorType::Tag;
    selector.tag = "BigMaps";

    XAsyncBlock* asyncBlock = new (std::nothrow) XAsyncBlock{};
    asyncBlock->callback = BigMapsAsyncInstallComplete;
    asyncBlock->queue = queue;

    hr = XPackageInstallChunksAsync(
        id, 1, &selector, 1000,
        false, asyncBlock);

    if (FAILED(hr))
    {
        delete asyncBlock;
    }

    return hr;
}
```

## Configuration requise

**En-tête :** XPackage.h

**Bibliothèque :** xgameruntime.lib

**Plateformes prises en charge :** Windows, consoles de la famille XBOX One et consoles XBOX Series

## Documentation conceptuelle

* [Objectifs de conception et améliorations de la programmation asynchrone](/fr/build/core-features/common/async/async-whitepaper)

## Voir aussi

[XPackage](/fr/reference/system/xpackage/xpackage_members)\
[Installation en streaming et Intelligent Delivery](/fr/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery)\
[XPackageInstallChunks](/fr/reference/system/xpackage/functions/xpackageinstallchunks)


## Related topics

- [XPackageInstallChunksAsync](/reference/system/xpackage/functions/xpackageinstallchunksasync.md)
- [XPackageInstallChunksResult](/reference/system/xpackage/functions/xpackageinstallchunksresult.md)
