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

# XPackageFindChunkAvailability

> XPackageFindChunkAvailability

# XPackageFindChunkAvailability

指定されたセレクターに一致するチャンクのコレクションに対して、最小の利用可能性を返します。

## Syntax

```cpp theme={null}
HRESULT XPackageFindChunkAvailability(  
         const char* packageIdentifier,  
         uint32_t selectorCount,  
         XPackageChunkSelector* selectors,  
         XPackageChunkAvailability* availability  
)  
```

### 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\_opt\_(selectorCount)\
型: [XPackageChunkSelector\*](/reference/system/xpackage/structs/xpackagechunkselector)

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

*availability*   \_Out\_\
型: [XPackageChunkAvailability\*](/reference/system/xpackage/enums/xpackagechunkavailability)

戻り時、チャンクの利用可能性を一覧表示します。

### Return value

型: HRESULT

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

## Remarks

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

**XPackageFindChunkAvailability** はチャンク セレクターの配列を受け取り、関連するチャンクを検索し、それらのチャンクに対する最小の利用可能性を返します。利用可能性は次の値の範囲で表されます:

* Ready: チャンクは既にインストールされており、読み取り可能です。
* Pending: チャンクはまだインストールされていませんが、インストールされる予定です。
* Installable: チャンクはインストールされていませんが、ダウンロード可能です。
* Unavailable: チャンクはダウンロードできません。

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

```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

* [インテリジェント デリバリー: カスタム タグ指定子](/build/core-features/common/packaging/intelligentdelivery-custom)
* [インテリジェント デリバリー: 機能とレシピ](/build/core-features/common/packaging/intelligentdelivery-features-recipes)
* [インテリジェント デリバリー: 言語指定子](/build/core-features/common/packaging/intelligentdelivery-language)
* [タイム センシティブ スレッド](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

- [Intelligent Delivery: カスタムタグ指定子](/ja-jp/build/core-features/common/packaging/intelligentdelivery-custom.md)
- [Intelligent Delivery: Feature と Recipe](/ja-jp/build/core-features/common/packaging/intelligentdelivery-features-recipes.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)
- [XPackageChunkAvailability](/ja-jp/reference/system/xpackage/enums/xpackagechunkavailability.md)
