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

# 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://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-manage-and-license-optional-packages) を参照してください。

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

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

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

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

*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) を参照してください。</Note>

指定した場合、*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](/reference/system/xpackage/xpackage_members)\
[ストリーミング インストールとインテリジェント デリバリー](/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery)


## Related topics

- [XPackageInstallChunksAsync](/ja-jp/reference/system/xpackage/functions/xpackageinstallchunksasync.md)
- [XPackageInstallChunks](/ja-jp/reference/system/xpackage/functions/xpackageinstallchunks.md)
- [XPackage](/ja-jp/reference/system/xpackage/xpackage_members.md)
- [GDK 向け Unity C# API ラッパー](/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XStoreDownloadPackageUpdatesAsync](/ja-jp/reference/system/xstore/functions/xstoredownloadpackageupdatesasync.md)
