-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMKFileSaver.cs
More file actions
43 lines (41 loc) · 1.4 KB
/
MKFileSaver.cs
File metadata and controls
43 lines (41 loc) · 1.4 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MauiFileSaver
{
public static class MKFileSaver
{
static IFileSaver? fileSaver;
public static IFileSaver Default
{
get
{
fileSaver ??= new FileSaver(new DefaultFolderProvider());
return fileSaver;
}
}
/// <summary>
/// open file you saved
/// </summary>
/// <param name="platformPath">the path from file save result</param>
/// <param name="fileOpenMode">"r","w","rw"</param>
/// <returns></returns>
public static Stream? Open(string platformPath,string fileOpenMode)
{
return Default.Open(platformPath,fileOpenMode);
}
/// <summary>
/// save file in default folder withFolderType,
/// if u target android29 lower,declare readExternalPermission and writeExternalPermission
/// </summary>
/// <param name="folderType">folderTypes are depend on enum SaveFolderType</param>
/// <param name="childPath">etc "file.txt","zip/file.txt"</param>
/// <returns>use method Open to open stream</returns>
public static FileSaveResult? Save(int folderType, string childPath)
{
return Default.Save(folderType, childPath);
}
}
}