This repository was archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathGtkIsolatedStorageFile.cs
63 lines (50 loc) · 1.58 KB
/
GtkIsolatedStorageFile.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
63
using System;
using System.IO;
using System.IO.IsolatedStorage;
using System.Threading.Tasks;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.GTK
{
public class GtkIsolatedStorageFile : IIsolatedStorageFile
{
public Task CreateDirectoryAsync(string path)
{
var storage = CreateStorageFileInstance();
storage.CreateDirectory(path);
return Task.FromResult(true);
}
public Task<bool> GetDirectoryExistsAsync(string path)
{
var storage = CreateStorageFileInstance();
return Task.FromResult(storage.DirectoryExists(path));
}
public Task<bool> GetFileExistsAsync(string path)
{
var storage = CreateStorageFileInstance();
return Task.FromResult(storage.FileExists(path));
}
public Task<DateTimeOffset> GetLastWriteTimeAsync(string path)
{
var storage = CreateStorageFileInstance();
return Task.FromResult(storage.GetLastWriteTime(path));
}
public Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access)
{
var storage = CreateStorageFileInstance();
Stream stream = storage.OpenFile(path, mode, access);
return Task.FromResult(stream);
}
public Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access, FileShare share)
{
var storage = CreateStorageFileInstance();
Stream stream = storage.OpenFile(path, mode, access, share);
return Task.FromResult(stream);
}
private IsolatedStorageFile CreateStorageFileInstance()
{
return IsolatedStorageFile.GetStore(
IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly,
null, null);
}
}
}