Top navigation, search delete
This commit is contained in:
@@ -14,7 +14,8 @@ public sealed partial class LocalContentProvider : ContentProviderBase, ILocalCo
|
||||
private readonly ITimelessContentProvider _timelessContentProvider;
|
||||
private readonly bool _isCaseInsensitive;
|
||||
|
||||
public LocalContentProvider(ITimelessContentProvider timelessContentProvider) : base(LocalContentProviderConstants.ContentProviderId)
|
||||
public LocalContentProvider(ITimelessContentProvider timelessContentProvider)
|
||||
: base(LocalContentProviderConstants.ContentProviderId, timelessContentProvider)
|
||||
{
|
||||
_timelessContentProvider = timelessContentProvider;
|
||||
_isCaseInsensitive = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
@@ -66,13 +67,13 @@ public sealed partial class LocalContentProvider : ContentProviderBase, ILocalCo
|
||||
PointInTime pointInTime,
|
||||
bool forceResolve = false,
|
||||
AbsolutePathType forceResolvePathType = AbsolutePathType.Unknown,
|
||||
ItemInitializationSettings itemInitializationSettings = default)
|
||||
ItemInitializationSettings? itemInitializationSettings = null)
|
||||
{
|
||||
var path = nativePath.Path;
|
||||
Exception? innerException;
|
||||
try
|
||||
{
|
||||
if ((path?.Length ?? 0) == 0)
|
||||
if (path.Length == 0)
|
||||
{
|
||||
return Task.FromResult((IItem) this);
|
||||
}
|
||||
@@ -81,7 +82,7 @@ public sealed partial class LocalContentProvider : ContentProviderBase, ILocalCo
|
||||
return Task.FromResult((IItem) DirectoryToContainer(
|
||||
new DirectoryInfo(path!.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar),
|
||||
pointInTime,
|
||||
!itemInitializationSettings.SkipChildInitialization)
|
||||
itemInitializationSettings)
|
||||
);
|
||||
}
|
||||
else if (File.Exists(path))
|
||||
@@ -193,18 +194,21 @@ public sealed partial class LocalContentProvider : ContentProviderBase, ILocalCo
|
||||
}
|
||||
|
||||
private Container DirectoryToContainer(DirectoryInfo directoryInfo, PointInTime pointInTime,
|
||||
bool initializeChildren = true)
|
||||
ItemInitializationSettings? initializationSettings = null)
|
||||
{
|
||||
initializationSettings ??= new();
|
||||
|
||||
var fullName = GetFullName(directoryInfo.FullName);
|
||||
var parentFullName = fullName.GetParent();
|
||||
var parent =
|
||||
parentFullName is null
|
||||
initializationSettings.Parent
|
||||
?? (parentFullName is null
|
||||
? null
|
||||
: new AbsolutePath(
|
||||
_timelessContentProvider,
|
||||
pointInTime,
|
||||
parentFullName,
|
||||
AbsolutePathType.Container);
|
||||
AbsolutePathType.Container));
|
||||
var exceptions = new ObservableCollection<Exception>();
|
||||
|
||||
var children = new ObservableCollection<AbsolutePath>();
|
||||
@@ -229,7 +233,7 @@ public sealed partial class LocalContentProvider : ContentProviderBase, ILocalCo
|
||||
children
|
||||
);
|
||||
|
||||
if (initializeChildren)
|
||||
if (!initializationSettings.SkipChildInitialization)
|
||||
{
|
||||
Task.Run(async () => await LoadChildren(container, directoryInfo, children, pointInTime, exceptions));
|
||||
}
|
||||
|
||||
@@ -9,22 +9,22 @@ namespace FileTime.Providers.LocalAdmin;
|
||||
//TODO: this should be a RemoteContentProvider if there will be one
|
||||
public class AdminContentProvider : RemoteContentProvider, IAdminContentProvider
|
||||
{
|
||||
public AdminContentProvider() : base("local", "localAdmin")
|
||||
public AdminContentProvider(ITimelessContentProvider timelessContentProvider) : base(timelessContentProvider, "local", "localAdmin")
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<IItem> GetItemByNativePathAsync(NativePath nativePath, PointInTime pointInTime, bool forceResolve = false, AbsolutePathType forceResolvePathType = AbsolutePathType.Unknown, ItemInitializationSettings itemInitializationSettings = default)
|
||||
public override Task<IItem> GetItemByNativePathAsync(NativePath nativePath, PointInTime pointInTime, bool forceResolve = false, AbsolutePathType forceResolvePathType = AbsolutePathType.Unknown, ItemInitializationSettings itemInitializationSettings = default)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public override NativePath GetNativePath(FullName fullName)
|
||||
public override NativePath GetNativePath(FullName fullName)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public override FullName GetFullName(NativePath nativePath)
|
||||
public override FullName GetFullName(NativePath nativePath)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public override Task<byte[]?> GetContentAsync(IElement element, int? maxLength = null, CancellationToken cancellationToken = default)
|
||||
public override Task<byte[]?> GetContentAsync(IElement element, int? maxLength = null, CancellationToken cancellationToken = default)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public override bool CanHandlePath(NativePath path)
|
||||
public override bool CanHandlePath(NativePath path)
|
||||
=> throw new NotImplementedException();
|
||||
}
|
||||
@@ -7,7 +7,11 @@ namespace FileTime.Providers.Remote;
|
||||
|
||||
public class RemoteContentProvider : ContentProviderBase, IRemoteContentProvider
|
||||
{
|
||||
public RemoteContentProvider(string remoteName, string name = "remote") : base(name)
|
||||
public RemoteContentProvider(
|
||||
ITimelessContentProvider timelessContentProvider,
|
||||
string remoteName,
|
||||
string name = "remote")
|
||||
: base(name, timelessContentProvider)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user