File scoped namespace
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
namespace FileTime.Core.Behaviors
|
||||
namespace FileTime.Core.Behaviors;
|
||||
|
||||
public interface IOnContainerEnter
|
||||
{
|
||||
public interface IOnContainerEnter
|
||||
{
|
||||
Task OnEnter();
|
||||
}
|
||||
Task OnEnter();
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace FileTime.Core.Command
|
||||
namespace FileTime.Core.Command;
|
||||
|
||||
public interface ICommand
|
||||
{
|
||||
public interface ICommand
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace FileTime.Core.Command
|
||||
namespace FileTime.Core.Command;
|
||||
|
||||
public interface ITransportationCommand : ICommand
|
||||
{
|
||||
public interface ITransportationCommand : ICommand
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace FileTime.Core.Enums
|
||||
namespace FileTime.Core.Enums;
|
||||
|
||||
public enum AbsolutePathType
|
||||
{
|
||||
public enum AbsolutePathType
|
||||
{
|
||||
Unknown,
|
||||
Container,
|
||||
Element
|
||||
}
|
||||
Unknown,
|
||||
Container,
|
||||
Element
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace FileTime.Core.Enums
|
||||
namespace FileTime.Core.Enums;
|
||||
|
||||
public enum SupportsDelete
|
||||
{
|
||||
public enum SupportsDelete
|
||||
{
|
||||
False,
|
||||
True,
|
||||
HardDeleteOnly,
|
||||
}
|
||||
False,
|
||||
True,
|
||||
HardDeleteOnly,
|
||||
}
|
||||
@@ -6,6 +6,10 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DynamicData" Version="7.6.7" />
|
||||
<PackageReference Include="System.Reactive" Version="5.0.0" />
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace FileTime.Core.Models
|
||||
namespace FileTime.Core.Models;
|
||||
|
||||
public static class Constants
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
public const char SeparatorChar = '/';
|
||||
}
|
||||
public const char SeparatorChar = '/';
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
namespace FileTime.Core.Models
|
||||
{
|
||||
public record FullName(string Path)
|
||||
{
|
||||
public FullName? GetParent()
|
||||
{
|
||||
if (Path is null) return null;
|
||||
namespace FileTime.Core.Models;
|
||||
|
||||
var pathParts = Path.TrimEnd(Constants.SeparatorChar).Split(Constants.SeparatorChar);
|
||||
return pathParts.Length switch
|
||||
{
|
||||
> 1 => new(string.Join(Constants.SeparatorChar, pathParts.SkipLast(1))),
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
public record FullName(string Path)
|
||||
{
|
||||
public FullName? GetParent()
|
||||
{
|
||||
if (Path is null) return null;
|
||||
|
||||
var pathParts = Path.TrimEnd(Constants.SeparatorChar).Split(Constants.SeparatorChar);
|
||||
return pathParts.Length switch
|
||||
{
|
||||
> 1 => new(string.Join(Constants.SeparatorChar, pathParts.SkipLast(1))),
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
using FileTime.Core.Enums;
|
||||
using FileTime.Core.Services;
|
||||
|
||||
namespace FileTime.Core.Models
|
||||
{
|
||||
public interface IAbsolutePath
|
||||
{
|
||||
IContentProvider ContentProvider { get; }
|
||||
IContentProvider? VirtualContentProvider { get; }
|
||||
FullName Path { get; }
|
||||
AbsolutePathType Type { get; }
|
||||
namespace FileTime.Core.Models;
|
||||
|
||||
Task<IItem> ResolveAsync(bool forceResolve = false, ItemInitializationSettings itemInitializationSettings = default);
|
||||
Task<IItem?> ResolveAsyncSafe(bool forceResolve = false, ItemInitializationSettings itemInitializationSettings = default);
|
||||
}
|
||||
public interface IAbsolutePath
|
||||
{
|
||||
IContentProvider ContentProvider { get; }
|
||||
IContentProvider? VirtualContentProvider { get; }
|
||||
FullName Path { get; }
|
||||
AbsolutePathType Type { get; }
|
||||
|
||||
Task<IItem> ResolveAsync(bool forceResolve = false, ItemInitializationSettings itemInitializationSettings = default);
|
||||
Task<IItem?> ResolveAsyncSafe(bool forceResolve = false, ItemInitializationSettings itemInitializationSettings = default);
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
using DynamicData;
|
||||
|
||||
namespace FileTime.Core.Models
|
||||
namespace FileTime.Core.Models;
|
||||
|
||||
public interface IContainer : IItem
|
||||
{
|
||||
public interface IContainer : IItem
|
||||
{
|
||||
IObservable<IObservable<IChangeSet<IAbsolutePath>>?> Items { get; }
|
||||
IObservable<bool> IsLoading { get; }
|
||||
}
|
||||
IObservable<IObservable<IChangeSet<IAbsolutePath>>?> Items { get; }
|
||||
IObservable<bool> IsLoading { get; }
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace FileTime.Core.Models
|
||||
namespace FileTime.Core.Models;
|
||||
|
||||
public interface IElement : IItem
|
||||
{
|
||||
public interface IElement : IItem
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace FileTime.Core.Models
|
||||
namespace FileTime.Core.Models;
|
||||
|
||||
public interface IFileElement : IElement
|
||||
{
|
||||
public interface IFileElement : IElement
|
||||
{
|
||||
long Size { get; }
|
||||
}
|
||||
long Size { get; }
|
||||
}
|
||||
@@ -1,23 +1,22 @@
|
||||
using FileTime.Core.Enums;
|
||||
using FileTime.Core.Services;
|
||||
|
||||
namespace FileTime.Core.Models
|
||||
namespace FileTime.Core.Models;
|
||||
|
||||
public interface IItem
|
||||
{
|
||||
public interface IItem
|
||||
{
|
||||
string Name { get; }
|
||||
string DisplayName { get; }
|
||||
FullName? FullName { get; }
|
||||
NativePath? NativePath { get; }
|
||||
IAbsolutePath? Parent { get; }
|
||||
bool IsHidden { get; }
|
||||
bool IsExists { get; }
|
||||
DateTime? CreatedAt { get; }
|
||||
SupportsDelete CanDelete { get; }
|
||||
bool CanRename { get; }
|
||||
IContentProvider Provider { get; }
|
||||
string? Attributes { get; }
|
||||
AbsolutePathType Type { get; }
|
||||
IObservable<IEnumerable<Exception>> Exceptions { get; }
|
||||
}
|
||||
string Name { get; }
|
||||
string DisplayName { get; }
|
||||
FullName? FullName { get; }
|
||||
NativePath? NativePath { get; }
|
||||
IAbsolutePath? Parent { get; }
|
||||
bool IsHidden { get; }
|
||||
bool IsExists { get; }
|
||||
DateTime? CreatedAt { get; }
|
||||
SupportsDelete CanDelete { get; }
|
||||
bool CanRename { get; }
|
||||
IContentProvider Provider { get; }
|
||||
string? Attributes { get; }
|
||||
AbsolutePathType Type { get; }
|
||||
IObservable<IEnumerable<Exception>> Exceptions { get; }
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
namespace FileTime.Core.Models
|
||||
{
|
||||
public readonly struct ItemInitializationSettings
|
||||
{
|
||||
public readonly bool SkipChildInitialization;
|
||||
namespace FileTime.Core.Models;
|
||||
|
||||
public ItemInitializationSettings(bool skipChildInitialization)
|
||||
{
|
||||
SkipChildInitialization = skipChildInitialization;
|
||||
}
|
||||
public readonly struct ItemInitializationSettings
|
||||
{
|
||||
public readonly bool SkipChildInitialization;
|
||||
|
||||
public ItemInitializationSettings(bool skipChildInitialization)
|
||||
{
|
||||
SkipChildInitialization = skipChildInitialization;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace FileTime.Core.Models
|
||||
{
|
||||
public record ItemsTransformator(
|
||||
string Name,
|
||||
Func<IEnumerable<IItem>, Task<IEnumerable<IItem>>> Transformator
|
||||
);
|
||||
}
|
||||
namespace FileTime.Core.Models;
|
||||
|
||||
public record ItemsTransformator(
|
||||
string Name,
|
||||
Func<IEnumerable<IItem>, Task<IEnumerable<IItem>>> Transformator
|
||||
);
|
||||
@@ -1,4 +1,3 @@
|
||||
namespace FileTime.Core.Models
|
||||
{
|
||||
public record NativePath(string Path);
|
||||
}
|
||||
namespace FileTime.Core.Models;
|
||||
|
||||
public record NativePath(string Path);
|
||||
@@ -2,22 +2,21 @@ using FileTime.Core.Behaviors;
|
||||
using FileTime.Core.Enums;
|
||||
using FileTime.Core.Models;
|
||||
|
||||
namespace FileTime.Core.Services
|
||||
namespace FileTime.Core.Services;
|
||||
|
||||
public interface IContentProvider : IContainer, IOnContainerEnter
|
||||
{
|
||||
public interface IContentProvider : IContainer, IOnContainerEnter
|
||||
{
|
||||
Task<IItem> GetItemByFullNameAsync(
|
||||
FullName fullName,
|
||||
bool forceResolve = false,
|
||||
AbsolutePathType forceResolvePathType = AbsolutePathType.Unknown,
|
||||
ItemInitializationSettings itemInitializationSettings = default);
|
||||
Task<IItem> GetItemByFullNameAsync(
|
||||
FullName fullName,
|
||||
bool forceResolve = false,
|
||||
AbsolutePathType forceResolvePathType = AbsolutePathType.Unknown,
|
||||
ItemInitializationSettings itemInitializationSettings = default);
|
||||
|
||||
Task<IItem> GetItemByNativePathAsync(
|
||||
NativePath nativePath,
|
||||
bool forceResolve = false,
|
||||
AbsolutePathType forceResolvePathType = AbsolutePathType.Unknown,
|
||||
ItemInitializationSettings itemInitializationSettings = default);
|
||||
Task<IItem> GetItemByNativePathAsync(
|
||||
NativePath nativePath,
|
||||
bool forceResolve = false,
|
||||
AbsolutePathType forceResolvePathType = AbsolutePathType.Unknown,
|
||||
ItemInitializationSettings itemInitializationSettings = default);
|
||||
|
||||
Task<List<IAbsolutePath>> GetItemsByContainerAsync(FullName fullName);
|
||||
}
|
||||
Task<List<IAbsolutePath>> GetItemsByContainerAsync(FullName fullName);
|
||||
}
|
||||
@@ -2,18 +2,17 @@ using DynamicData;
|
||||
using FileTime.Core.Models;
|
||||
using InitableService;
|
||||
|
||||
namespace FileTime.Core.Services
|
||||
{
|
||||
public interface ITab : IInitable<IContainer>
|
||||
{
|
||||
IObservable<IContainer?> CurrentLocation { get; }
|
||||
IObservable<IAbsolutePath?> CurrentSelectedItem { get; }
|
||||
IObservable<IObservable<IChangeSet<IItem>>?> CurrentItems { get; }
|
||||
namespace FileTime.Core.Services;
|
||||
|
||||
void SetCurrentLocation(IContainer newLocation);
|
||||
void AddSelectedItemsTransformator(ItemsTransformator transformator);
|
||||
void RemoveSelectedItemsTransformator(ItemsTransformator transformator);
|
||||
void RemoveSelectedItemsTransformatorByName(string name);
|
||||
void SetSelectedItem(IAbsolutePath newSelectedItem);
|
||||
}
|
||||
public interface ITab : IInitable<IContainer>
|
||||
{
|
||||
IObservable<IContainer?> CurrentLocation { get; }
|
||||
IObservable<IAbsolutePath?> CurrentSelectedItem { get; }
|
||||
IObservable<IObservable<IChangeSet<IItem>>?> CurrentItems { get; }
|
||||
|
||||
void SetCurrentLocation(IContainer newLocation);
|
||||
void AddSelectedItemsTransformator(ItemsTransformator transformator);
|
||||
void RemoveSelectedItemsTransformator(ItemsTransformator transformator);
|
||||
void RemoveSelectedItemsTransformatorByName(string name);
|
||||
void SetSelectedItem(IAbsolutePath newSelectedItem);
|
||||
}
|
||||
Reference in New Issue
Block a user