다음을 통해 공유


StorageLibraryLastChangeId 클래스

정의

지정된 StorageFolder 또는 StorageLibrary에 대해 인덱싱 서비스에서 처리한 마지막 변경 내용을 나타내는 고유 값을 기반으로 변경 내용을 추적할 수 있습니다.

public ref class StorageLibraryLastChangeId sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 720896)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class StorageLibraryLastChangeId final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 720896)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class StorageLibraryLastChangeId
Public NotInheritable Class StorageLibraryLastChangeId
상속
Object Platform::Object IInspectable StorageLibraryLastChangeId
특성

Windows 요구 사항

디바이스 패밀리
Windows 10, version 2104 (10.0.20348.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v12.0에서 도입되었습니다.)

예제

// applications are expected to persist the previous value
UINT64 appsLastPersistedChangeId = StorageLibraryLastChangeId::Unknown();
StorageFolder folder = StorageFolder::GetFolderFromPathAsync(L"my folder path").get();

StorageLibraryChangeTracker tracker = folder.TryGetChangeTracker();
if (tracker != nullptr)
{
StorageLibraryChangeTrackerOptions ops;
ops.TrackChangeDetails(false);
tracker.Enable(ops);

StorageLibraryChangeReader reader = tracker.GetChangeReader();
if (reader != nullptr)
{
    UINT32 changeId = reader.GetLastChangeId();
    if ((changeId == StorageLibraryLastChangeId::Unknown())
    {
        ScanFolderSlow();
    }
    else if (changeId == 0)
    {
        // no changes in the storage folder yet, OR nothing has changed
        ProcessNormalApplicationStartup();
    }
    else if (changeId != appsLastPersistedChangeId)
    {
        // There have been new changes since we’ve last ran, process them
        appsLastPersistedChangeId = changeId;
        ScanFolderForChanges();
    }
    else
    {
        // changeId and our last persisted change id match, also normal application startup
        ProcessNormalApplicationStartup();
    }
}
}

속성

Unknown

USN 저널이 오버플로되고 서비스가 변경 내용을 따라갈 수 없거나 변경 ID를 계산할 수 없는 또 다른 이유가 있을 때 반환됩니다.

적용 대상

추가 정보