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

# XPackageEstimateDownloadSize

> XPackageEstimateDownloadSize

# XPackageEstimateDownloadSize

指定されたインストール セレクターに一致するチャンクのダウンロード サイズを計算します。

## Syntax

```cpp theme={null}
HRESULT XPackageEstimateDownloadSize(  
         const char* packageIdentifier,  
         uint32_t selectorCount,  
         XPackageChunkSelector* selectors,  
         uint64_t* downloadSize,  
         bool* shouldPresentUserConfirmation  
)  
```

### Parameters

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

ディスク上のインストール済みパッケージを一意に識別する文字列。パッケージ識別子の詳細については、[ダウンロード可能なコンテンツ (DLC) の管理およびライセンス](https://docs.xbox.com/ja-jp/publishing/xstore-commerce/xstore-dlc.md) を参照してください。

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

*selectors* パラメーター内のセレクターの数。

*selectors*   \_In\_reads\_(selectorCount)\
型: [XPackageChunkSelector\*](https://docs.xbox.com/ja-jp/reference/system/xpackage/structs/xpackagechunkselector.md)

操作対象のチャンクを指定するセレクターの配列。

*downloadSize*   \_Out\_\
型: uint64\_t\*

戻り時、指定されたインストール セレクターのダウンロード サイズを含みます。

*shouldPresentUserConfirmation*   \_Out\_opt\_\
型: bool\*

ダウンロードにユーザーの確認が必要な場合は true を、それ以外の場合は false を返します。

### Return value

型: HRESULT

HRESULT の成功またはエラー コード。

## Remarks

> [!NOTE]
>
> この関数はタイム センシティブなスレッドで呼び出すのは安全ではありません。詳細については、[タイム センシティブなスレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads) を参照してください。

指定した場合、*shouldPresentUserConfirmation* パラメーターは、推定ダウンロード サイズがユーザーにダウンロード サイズを承認するように促す程度に大きい場合、true に設定されます。

次の例は、レース ゲームのトラック名を受け取り、そのトラックがインストールされていない場合、トラックのダウンロード サイズを出力します:

```cpp theme={null}
HRESULT ListDownloadSize(char* trackName)
{
    XPackageChunkSelector selector;
    selector.type = XPackageChunkSelectorType::Tag;
    selector.tag = trackName;

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

    XPackageChunkAvailability availability;
    hr = XPackageFindChunkAvailability(id, 1, &selector, &availability);
    if (FAILED(hr)) return hr;

    if (availability == XPackageChunkAvailability::Installable)
    {
        uint64_t downloadSize;
        hr = XPackageEstimateDownloadSize(id, 1, &selector, &downloadSize, nullptr);
        if (FAILED(hr)) return hr;

        printf("Download Size for track %s: %I64u\n", trackName, downloadSize);
    }

    return hr;
}
```

## Requirements

**ヘッダー:** XPackage.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体および XBOX Series 本体

## Conceptual documentation

* [タイム センシティブなスレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XPackage](https://docs.xbox.com/ja-jp/reference/system/xpackage/xpackage_members.md)\
[ストリーミング インストールと Intelligent Delivery](https://docs.xbox.com/ja-jp/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery.md)


## Related topics

- [XPackageInstallChunksAsync](https://docs.xbox.com/ja-jp/reference/system/xpackage/functions/xpackageinstallchunksasync.md)
- [XPackageInstallChunks](https://docs.xbox.com/ja-jp/reference/system/xpackage/functions/xpackageinstallchunks.md)
- [Unity プロジェクトでの GDK API 用 C# ラッパーの使用](https://docs.xbox.com/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XPackage (API の内容)](https://docs.xbox.com/ja-jp/reference/system/xpackage/xpackage_members.md)
- [XStoreDownloadPackageUpdatesAsync](https://docs.xbox.com/ja-jp/reference/system/xstore/functions/xstoredownloadpackageupdatesasync.md)
