using BITKit.IO; using Cysharp.Threading.Tasks; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using WebDav; namespace BITKit.Web { [System.Serializable] public class WebDavStorageProvider : StorageProvider { public static IWebDavClient client; public string requestUrl = @"http://server.bitfall.icu:15108/Data/"; public override Task Combine(string path1, string path2) { throw new NotImplementedException(); } public override Task CreateFile(string path) { throw new NotImplementedException(); } public override void CreateFolder(string path) { throw new NotImplementedException(); } public override void DeleteFile(string path) { throw new NotImplementedException(); } public override void DeleteFolder(string path) { throw new NotImplementedException(); } public override Task FileExists(string path) { throw new NotImplementedException(); } public override async Task GetFile(string path) { EnsureConfig(); await UniTask.Yield(); return new WebFileProvider(client, path); } public override async Task> ListFiles(string path) { EnsureConfig(); await UniTask.Yield(); var resources = await client.Propfind(path); return resources.Resources.Select(x => new WebFileProvider(client, x.DisplayName)); } public override Task> ListFolders(string path) { throw new NotImplementedException(); } public override void RenameFile(string oldPath, string newPath) { throw new NotImplementedException(); } public override void RenameFolder(string oldPath, string newPath) { throw new NotImplementedException(); } public override void SaveStream(string path, Stream inputStream) { throw new NotImplementedException(); } public override Task TryCreateFolder(string path) { throw new NotImplementedException(); } public override Task TrySaveStream(string path, Stream inputStream) { throw new NotImplementedException(); } void EnsureConfig() { if(client is null) { var clientParams = new WebDavClientParams { BaseAddress =new(requestUrl) }; client = new WebDavClient(clientParams); } } } }