2022-06-09 18:52:19 -05:00
|
|
|
#if OPENZUNE
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace OwlCore.AbstractStorage;
|
|
|
|
|
|
|
|
|
|
public class Win32FileSystemService : IFileSystemService
|
|
|
|
|
{
|
|
|
|
|
public Win32FileSystemService(string rootFolder)
|
|
|
|
|
{
|
|
|
|
|
RootFolder = new SystemIOFolderData(rootFolder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IFolderData RootFolder { get; }
|
|
|
|
|
|
|
|
|
|
public bool IsInitialized => true;
|
|
|
|
|
|
|
|
|
|
public Task<IFolderData> CreateDirectoryAsync(string folderName)
|
|
|
|
|
=> RootFolder.CreateFolderAsync(folderName);
|
|
|
|
|
|
|
|
|
|
public Task<bool> DirectoryExistsAsync(string path) => Task.FromResult(Directory.Exists(path));
|
|
|
|
|
|
|
|
|
|
public Task<bool> FileExistsAsync(string path) => Task.FromResult(File.Exists(path));
|
|
|
|
|
|
|
|
|
|
public Task<IFileData> GetFileFromPathAsync(string path)
|
|
|
|
|
=> Task.FromResult<IFileData>(new SystemIOFileData(path));
|
|
|
|
|
|
|
|
|
|
public Task<IFolderData> GetFolderFromPathAsync(string path)
|
|
|
|
|
=> Task.FromResult<IFolderData>(new SystemIOFolderData(path));
|
|
|
|
|
|
|
|
|
|
public Task<IReadOnlyList<IFolderData>> GetPickedFolders()
|
|
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task InitAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
|
|
|
|
|
|
|
|
|
|
public Task<IFolderData> PickFolder()
|
|
|
|
|
{
|
2022-06-10 17:07:41 -05:00
|
|
|
return Task.FromResult(RootFolder);
|
2022-06-09 18:52:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task RevokeAccess(IFolderData folder) => Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|