3 #if SILICONSTUDIO_PLATFORM_ANDROID
6 namespace SiliconStudio.Core.IO
11 public class AndroidAssetProvider : VirtualFileProviderBase
13 private readonly
string assetRoot;
14 private FileSystemProvider fileSystemProvider;
16 public AndroidAssetProvider(
string rootPath,
string assetRoot,
string cachePath) : base(rootPath)
18 fileSystemProvider =
new FileSystemProvider(rootPath +
"/cache", cachePath);
19 this.assetRoot = assetRoot;
25 lock (fileSystemProvider)
27 if (!fileSystemProvider.FileExists(url))
30 fileSystemProvider.CreateDirectory(VirtualFileSystem.GetParentFolder(url));
32 using (var asset = PlatformAndroid.Context.Assets.Open(assetRoot + url))
33 using (var output = fileSystemProvider.OpenStream(url, VirtualFileMode.CreateNew, VirtualFileAccess.Write, share, streamType))
38 return fileSystemProvider.OpenStream(url, mode, access);
41 public override bool FileExists(
string url)
45 using (var asset = PlatformAndroid.Context.Assets.Open(assetRoot + url))
56 public override string GetAbsolutePath(
string path)
58 return fileSystemProvider.GetAbsolutePath(path);
VirtualFileShare
File share capabilities, equivalent of System.IO.FileShare.
VirtualFileAccess
File access equivalent of System.IO.FileAccess.
VirtualFileMode
File mode equivalent of System.IO.FileMode.
StreamFlags
Describes the different type of streams.