mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-21 22:07:14 +02:00
use extension members for StorageProviderExtensions
This commit is contained in:
parent
483d42ec38
commit
2403bd4f3c
1 changed files with 18 additions and 15 deletions
|
@ -8,21 +8,24 @@ namespace Ryujinx.Ava.Utilities
|
||||||
{
|
{
|
||||||
public static class StorageProviderExtensions
|
public static class StorageProviderExtensions
|
||||||
{
|
{
|
||||||
public static async Task<Optional<IStorageFolder>> OpenSingleFolderPickerAsync(this IStorageProvider storageProvider, FolderPickerOpenOptions openOptions = null) =>
|
extension(IStorageProvider storageProvider)
|
||||||
await storageProvider.OpenFolderPickerAsync(FixOpenOptions(openOptions, false))
|
{
|
||||||
.Then(folders => folders.FindFirst());
|
public Task<Optional<IStorageFolder>> OpenSingleFolderPickerAsync(FolderPickerOpenOptions openOptions = null) =>
|
||||||
|
storageProvider.OpenFolderPickerAsync(FixOpenOptions(openOptions, false))
|
||||||
public static async Task<Optional<IStorageFile>> OpenSingleFilePickerAsync(this IStorageProvider storageProvider, FilePickerOpenOptions openOptions = null) =>
|
.Then(folders => folders.FindFirst());
|
||||||
await storageProvider.OpenFilePickerAsync(FixOpenOptions(openOptions, false))
|
|
||||||
.Then(files => files.FindFirst());
|
public Task<Optional<IStorageFile>> OpenSingleFilePickerAsync(FilePickerOpenOptions openOptions = null) =>
|
||||||
|
storageProvider.OpenFilePickerAsync(FixOpenOptions(openOptions, false))
|
||||||
public static async Task<Optional<IReadOnlyList<IStorageFolder>>> OpenMultiFolderPickerAsync(this IStorageProvider storageProvider, FolderPickerOpenOptions openOptions = null) =>
|
.Then(files => files.FindFirst());
|
||||||
await storageProvider.OpenFolderPickerAsync(FixOpenOptions(openOptions, true))
|
|
||||||
.Then(folders => folders.Count > 0 ? Optional.Of(folders) : default);
|
public Task<Optional<IReadOnlyList<IStorageFolder>>> OpenMultiFolderPickerAsync(FolderPickerOpenOptions openOptions = null) =>
|
||||||
|
storageProvider.OpenFolderPickerAsync(FixOpenOptions(openOptions, true))
|
||||||
public static async Task<Optional<IReadOnlyList<IStorageFile>>> OpenMultiFilePickerAsync(this IStorageProvider storageProvider, FilePickerOpenOptions openOptions = null) =>
|
.Then(folders => folders.Count > 0 ? Optional.Of(folders) : default);
|
||||||
await storageProvider.OpenFilePickerAsync(FixOpenOptions(openOptions, true))
|
|
||||||
.Then(files => files.Count > 0 ? Optional.Of(files) : default);
|
public Task<Optional<IReadOnlyList<IStorageFile>>> OpenMultiFilePickerAsync(FilePickerOpenOptions openOptions = null) =>
|
||||||
|
storageProvider.OpenFilePickerAsync(FixOpenOptions(openOptions, true))
|
||||||
|
.Then(files => files.Count > 0 ? Optional.Of(files) : default);
|
||||||
|
}
|
||||||
|
|
||||||
private static FilePickerOpenOptions FixOpenOptions(this FilePickerOpenOptions openOptions, bool allowMultiple)
|
private static FilePickerOpenOptions FixOpenOptions(this FilePickerOpenOptions openOptions, bool allowMultiple)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue