StorageLibraryLastChangeId.Unknown 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當 USN 日誌溢位且服務無法跟上變更,或因無法計算變更識別碼的另一個原因而傳回。
public:
static property unsigned long long Unknown { unsigned long long get(); };
static uint64_t Unknown();
public static ulong Unknown { get; }
var uInt64 = StorageLibraryLastChangeId.unknown;
Public Shared ReadOnly Property Unknown As ULong
屬性值
唯讀的唯一識別碼,表示無法計算變更識別碼。
範例
// 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();
}
}
}