Smb save servers, auth

This commit is contained in:
2022-02-10 11:24:04 +01:00
parent 70180b9f12
commit ec03067af1
19 changed files with 463 additions and 132 deletions

View File

@@ -3,5 +3,6 @@ namespace FileTime.Core.Models
public static class Constants
{
public const char SeparatorChar = '/';
public const string ContentProviderProtocol = "ctp://";
}
}

View File

@@ -10,7 +10,26 @@ namespace FileTime.Core.Models
Task<IReadOnlyList<IElement>?> GetElements(CancellationToken token = default);
Task RefreshAsync(CancellationToken token = default);
Task<IItem?> GetByPath(string path, bool acceptDeepestMatch = false);
async Task<IItem?> GetByPath(string path, bool acceptDeepestMatch = false)
{
var paths = path.Split(Constants.SeparatorChar);
var item = (await GetItems())?.FirstOrDefault(i => i.Name == paths[0]);
if (paths.Length == 1)
{
return item;
}
if (item is IContainer container)
{
var result = await container.GetByPath(string.Join(Constants.SeparatorChar, paths.Skip(1)), acceptDeepestMatch);
return result == null && acceptDeepestMatch ? this : result;
}
return null;
}
Task<IContainer> CreateContainer(string name);
Task<IElement> CreateElement(string name);

View File

@@ -0,0 +1,12 @@
namespace FileTime.Core.Persistence
{
public class PersistenceSettings
{
public PersistenceSettings(string rootAppDataPath)
{
RootAppDataPath = rootAppDataPath;
}
public string RootAppDataPath { get; }
}
}