public override IAsyncOperation <IReadOnlyList <IStorageItem> > GetItemsAsync(uint startIndex, uint maxItemsToRetrieve) { return(AsyncInfo.Run <IReadOnlyList <IStorageItem> >(async(cancellationToken) => { var res = await GetFolderAndItems(Path, true, (int)startIndex, (int)maxItemsToRetrieve); if (res.Items is null) { return null; } var items = new List <IStorageItem>(); foreach (var entry in res.Items) { if (entry.IsFolder) { items.Add(ShellStorageFolder.FromShellItem(entry)); } else { items.Add(ShellStorageFile.FromShellItem(entry)); } } return items; })); }
public override IAsyncOperation <StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode, uint requestedSize, ThumbnailOptions options) { return(AsyncInfo.Run(async(cancellationToken) => { if (ShellStorageFolder.IsShellPath(Path)) { return null; } var zipFile = await StorageFile.GetFileFromPathAsync(Path); return await zipFile.GetThumbnailAsync(mode, requestedSize, options); })); }
public static IAsyncOperation <BaseStorageFile> FromPathAsync(string path) { return(AsyncInfo.Run <BaseStorageFile>(async(cancellationToken) => { if (ShellStorageFolder.IsShellPath(path)) { if (await GetFile(path) is ShellFileItem file) { return FromShellItem(file); } } return null; })); }
public override IAsyncOperation <IStorageItem> GetItemAsync(string name) { return(AsyncInfo.Run <IStorageItem>(async(cancellationToken) => { var res = await GetFolderAndItems(Path, true); if (res.Items is null) { return null; } var entry = res.Items.FirstOrDefault(x => x.FileName != null && x.FileName.Equals(name, StringComparison.OrdinalIgnoreCase)); if (entry is null) { return null; } if (entry.IsFolder) { return ShellStorageFolder.FromShellItem(entry); } return ShellStorageFile.FromShellItem(entry); })); }