Smb save servers, auth
This commit is contained in:
@@ -3,5 +3,6 @@ namespace FileTime.Core.Models
|
||||
public static class Constants
|
||||
{
|
||||
public const char SeparatorChar = '/';
|
||||
public const string ContentProviderProtocol = "ctp://";
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
12
src/Core/FileTime.Core/Persistence/PersistenceSettings.cs
Normal file
12
src/Core/FileTime.Core/Persistence/PersistenceSettings.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace FileTime.Core.Persistence
|
||||
{
|
||||
public class PersistenceSettings
|
||||
{
|
||||
public PersistenceSettings(string rootAppDataPath)
|
||||
{
|
||||
RootAppDataPath = rootAppDataPath;
|
||||
}
|
||||
|
||||
public string RootAppDataPath { get; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user