-
Notifications
You must be signed in to change notification settings - Fork 1
/
MKFilePicker.cs
62 lines (61 loc) · 2.63 KB
/
MKFilePicker.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MKFilePicker
{
public static class MKFilePicker
{
static FilePicker? filePicker;
public static IFilePicker Default
{
get
{
if(filePicker == null)
{
filePicker = new FilePicker();
}
return filePicker;
}
}
/// <summary>
/// pick mutilple files
/// </summary>
/// <param name="pickOptions">can be null</param>
/// <returns></returns>
public static Task<IEnumerable<FilePickResult>> PickFilesAsync(FilePickOptions? pickOptions)=>Default.PickFilesAsync(pickOptions);
/// <summary>
/// pick single file
/// </summary>
/// <param name="pickOptions">can be null</param>
/// <returns></returns>
public static Task<FilePickResult?> PickFileAsync(FilePickOptions? pickOptions)=>Default.PickFileAsync(pickOptions);
/// <summary>
/// pick a folder to create file in it
/// </summary>
/// <param name="pickOptions">set display title</param>
/// <returns></returns>
public static Task<FilePickResult?> PickFolderAsync(FilePickOptions? pickOptions)=>Default.PickFolderAsync(pickOptions);
/// <summary>
/// open picked file
/// </summary>
/// <param name="platformPath">the path from picked result</param>
/// <returns></returns>
public static Stream? OpenPickedFile(string platformPath, string fileOpenMode)=>Default.OpenPickedFile(platformPath,fileOpenMode);
/// <summary>
/// create file
/// </summary>
/// <param name="platformFolderPath">the path from picked result or created from CreateFolder</param>
/// <param name="childPath">"folder/file.txt or file.txt. "/"is Path.PathSeparator,In Android is ":" "</param>
/// <returns></returns>
public static FilePickResult? CreateFile(string platformFolderPath, string childPath)=>Default.CreateFile(platformFolderPath, childPath);
/// <summary>
/// create folder
/// </summary>
/// <param name="platformFolderPath">the path from picked result or created from CreateFolder</param>
/// <param name="childPath">"folder/innerFodler or folder. "/"is Path.PathSeparator,In Android is ":" "</param>
/// <returns></returns>
public static FilePickResult? CreateFolder(string platformFolderPath, string childPath)=>Default.CreateFolder(platformFolderPath, childPath);
}
}