1
This commit is contained in:
103
Core/Web/WebDavStorageProvider.cs
Normal file
103
Core/Web/WebDavStorageProvider.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
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<string> Combine(string path1, string path2)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override Task<IStorageFile> 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<bool> FileExists(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override async Task<IStorageFile> GetFile(string path)
|
||||
{
|
||||
EnsureConfig();
|
||||
await UniTask.Yield();
|
||||
return new WebFileProvider(client, path);
|
||||
}
|
||||
|
||||
public override async Task<IEnumerable<IStorageFile>> 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<IEnumerable<IStorageFolder>> 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<bool> TryCreateFolder(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override Task<bool> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user