File scoped namespace

This commit is contained in:
2022-05-07 19:40:54 +02:00
parent b161ded92e
commit 9bf95ebe4e
126 changed files with 2562 additions and 2598 deletions

View File

@@ -1,2 +1,4 @@
[*.cs]
dotnet_diagnostic.RCS1196.severity = none
csharp_style_namespace_declarations = file_scoped:error
dotnet_diagnostic.IDE0161.severity = error

View File

@@ -1,7 +1,7 @@
namespace FileTime.App.Core.Command
namespace FileTime.App.Core.Command;
public enum Commands
{
public enum Commands
{
None,
AutoRefresh,
@@ -62,5 +62,4 @@ namespace FileTime.App.Core.Command
TimelineStart,
ToggleAdvancedIcons,
ToggleHidden,
}
}

View File

@@ -6,6 +6,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Reactive" Version="5.0.0" />
</ItemGroup>

View File

@@ -1,10 +1,10 @@
using System.Collections.ObjectModel;
using DynamicData;
namespace FileTime.App.Core.Models
namespace FileTime.App.Core.Models;
public class BindedCollection<T> : IDisposable
{
public class BindedCollection<T> : IDisposable
{
private readonly IDisposable _disposable;
public ReadOnlyObservableCollection<T> Collection { get; }
public BindedCollection(IObservable<IChangeSet<T>> dynamicList)
@@ -22,5 +22,4 @@ namespace FileTime.App.Core.Models
_disposable.Dispose();
GC.SuppressFinalize(this);
}
}
}

View File

@@ -1,10 +1,9 @@
namespace FileTime.App.Core.Models.Enums
namespace FileTime.App.Core.Models.Enums;
public enum ItemAttributeType
{
public enum ItemAttributeType
{
File,
Element,
Container,
SizeContainer
}
}

View File

@@ -1,12 +1,11 @@
namespace FileTime.App.Core.Models.Enums
namespace FileTime.App.Core.Models.Enums;
public enum ItemViewMode
{
public enum ItemViewMode
{
Default,
Alternative,
Selected,
Marked,
MarkedSelected,
MarkedAlternative
}
}

View File

@@ -1,8 +1,7 @@
namespace FileTime.App.Core.Models.Enums
namespace FileTime.App.Core.Models.Enums;
public enum ViewMode
{
public enum ViewMode
{
Default,
RapidTravel
}
}

View File

@@ -1,7 +1,7 @@
namespace FileTime.App.Core.Models
namespace FileTime.App.Core.Models;
public class ItemNamePart
{
public class ItemNamePart
{
public string Text { get; set; }
public bool IsSpecial { get; set; }
@@ -10,5 +10,4 @@ namespace FileTime.App.Core.Models
Text = text;
IsSpecial = isSpecial;
}
}
}

View File

@@ -1,10 +1,10 @@
using FileTime.Core.Command;
using FileTime.Core.Models;
namespace FileTime.App.Core.Services
namespace FileTime.App.Core.Services;
public interface IClipboardService
{
public interface IClipboardService
{
Type? CommandType { get; }
IReadOnlyList<IAbsolutePath> Content { get; }
@@ -12,5 +12,4 @@ namespace FileTime.App.Core.Services
void RemoveContent(IAbsolutePath absolutePath);
void Clear();
void SetCommand<T>() where T : ITransportationCommand;
}
}

View File

@@ -1,10 +1,9 @@
using FileTime.App.Core.Command;
namespace FileTime.App.Core.Services
namespace FileTime.App.Core.Services;
public interface ICommandHandler
{
public interface ICommandHandler
{
bool CanHandleCommand(Commands command);
Task HandleCommandAsync(Commands command);
}
}

View File

@@ -1,9 +1,8 @@
using FileTime.App.Core.Command;
namespace FileTime.App.Core.Services
namespace FileTime.App.Core.Services;
public interface ICommandHandlerService
{
public interface ICommandHandlerService
{
Task HandleCommandAsync(Commands command);
}
}

View File

@@ -1,11 +1,10 @@
using FileTime.App.Core.Models;
namespace FileTime.App.Core.Services
namespace FileTime.App.Core.Services;
public interface IItemNameConverterService
{
public interface IItemNameConverterService
{
List<ItemNamePart> GetDisplayName(string name, string? searchText);
string GetFileExtension(string fullName);
string GetFileName(string fullName);
}
}

View File

@@ -1,10 +1,9 @@
using System.Reactive.Concurrency;
namespace FileTime.App.Core.Services
namespace FileTime.App.Core.Services;
public interface IRxSchedulerService
{
public interface IRxSchedulerService
{
IScheduler GetWorkerScheduler();
IScheduler GetUIScheduler();
}
}

View File

@@ -1,10 +1,10 @@
using System.Collections.ObjectModel;
using FileTime.App.Core.Models.Enums;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
public interface IAppState
{
public interface IAppState
{
ObservableCollection<ITabViewModel> Tabs { get; }
IObservable<ITabViewModel?> SelectedTab { get; }
IObservable<string?> SearchText { get; }
@@ -13,5 +13,4 @@ namespace FileTime.App.Core.ViewModels
void AddTab(ITabViewModel tabViewModel);
void RemoveTab(ITabViewModel tabViewModel);
void SetSearchText(string? searchText);
}
}

View File

@@ -1,10 +1,9 @@
using FileTime.Core.Models;
using InitableService;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
public interface IContainerSizeContainerViewModel : IItemViewModel, IInitable<IContainer, ITabViewModel>
{
public interface IContainerSizeContainerViewModel : IItemViewModel, IInitable<IContainer, ITabViewModel>
{
long Size { get; set; }
}
}

View File

@@ -1,10 +1,9 @@
using FileTime.Core.Models;
using InitableService;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
public interface IContainerViewModel : IItemViewModel, IInitable<IContainer, ITabViewModel>
{
public interface IContainerViewModel : IItemViewModel, IInitable<IContainer, ITabViewModel>
{
IContainer? Container { get; }
}
}

View File

@@ -1,10 +1,9 @@
using FileTime.Core.Models;
using InitableService;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
public interface IElementViewModel : IItemViewModel, IInitable<IElement, ITabViewModel>
{
public interface IElementViewModel : IItemViewModel, IInitable<IElement, ITabViewModel>
{
long? Size { get; set; }
}
}

View File

@@ -1,9 +1,8 @@
using FileTime.Core.Models;
using InitableService;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
public interface IFileViewModel : IElementViewModel, IInitable<IFileElement, ITabViewModel>
{
public interface IFileViewModel : IElementViewModel, IInitable<IFileElement, ITabViewModel>
{
}
}

View File

@@ -3,10 +3,10 @@ using FileTime.App.Core.Models.Enums;
using FileTime.Core.Models;
using InitableService;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
public interface IItemViewModel : IInitable<IItem, ITabViewModel>
{
public interface IItemViewModel : IInitable<IItem, ITabViewModel>
{
IItem? BaseItem { get; set; }
IObservable<IReadOnlyList<ItemNamePart>>? DisplayName { get; set; }
string? DisplayNameText { get; set; }
@@ -17,5 +17,4 @@ namespace FileTime.App.Core.ViewModels
DateTime? CreatedAt { get; set; }
string? Attributes { get; set; }
bool EqualsTo(IItemViewModel? itemViewModel);
}
}

View File

@@ -5,10 +5,10 @@ using FileTime.Core.Models;
using FileTime.Core.Services;
using InitableService;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
public interface ITabViewModel : IInitable<ITab, int>
{
public interface ITabViewModel : IInitable<ITab, int>
{
ITab? Tab { get; }
int TabNumber { get; }
IObservable<bool> IsSelected { get; }
@@ -26,5 +26,4 @@ namespace FileTime.App.Core.ViewModels
void RemoveMarkedItem(IAbsolutePath item);
void AddMarkedItem(IAbsolutePath item);
void ToggleMarkedItem(IAbsolutePath item);
}
}

View File

@@ -1,9 +1,8 @@
using System.Reactive.Linq;
namespace FileTime.App.Core.Extensions
namespace FileTime.App.Core.Extensions;
public static class ObservableExtensions
{
public static class ObservableExtensions
{
public static IObservable<T> WhereNotNull<T>(this IObservable<T?> source) => source.Where(c => c != null)!;
}
}

View File

@@ -1,14 +1,13 @@
using FileTime.App.Core.ViewModels;
using FileTime.Core.Models;
namespace FileTime.App.Core.Extensions
namespace FileTime.App.Core.Extensions;
public static class ViewModelExtensions
{
public static class ViewModelExtensions
{
public static IAbsolutePath ToAbsolutePath(this IItemViewModel itemViewModel)
{
var item = itemViewModel.BaseItem ?? throw new ArgumentException($"{nameof(itemViewModel)} does not have {nameof(IItemViewModel.BaseItem)}");
return new AbsolutePath(item);
}
}
}

View File

@@ -6,6 +6,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="morelinq" Version="3.3.2" />
<PackageReference Include="MvvmGen" Version="1.1.5" />

View File

@@ -1,10 +1,10 @@
using FileTime.Core.Command;
using FileTime.Core.Models;
namespace FileTime.App.Core.Services
namespace FileTime.App.Core.Services;
public class ClipboardService : IClipboardService
{
public class ClipboardService : IClipboardService
{
private List<IAbsolutePath> _content;
public IReadOnlyList<IAbsolutePath> Content { get; private set; }
public Type? CommandType { get; private set; }
@@ -47,5 +47,4 @@ namespace FileTime.App.Core.Services
{
CommandType = typeof(T);
}
}
}

View File

@@ -4,10 +4,10 @@ using FileTime.App.Core.Command;
using FileTime.App.Core.ViewModels;
using FileTime.Core.Models;
namespace FileTime.App.Core.Services.CommandHandler
namespace FileTime.App.Core.Services.CommandHandler;
public abstract class CommandHandlerBase : ICommandHandler
{
public abstract class CommandHandlerBase : ICommandHandler
{
private readonly Dictionary<Commands, Func<Task>> _commandHandlers = new();
private readonly IAppState? _appState;
@@ -50,5 +50,4 @@ namespace FileTime.App.Core.Services.CommandHandler
return act(_appState);
}
}
}

View File

@@ -6,10 +6,10 @@ using FileTime.Core.Command;
using FileTime.Core.Command.Copy;
using FileTime.Core.Models;
namespace FileTime.App.Core.Services.CommandHandler
namespace FileTime.App.Core.Services.CommandHandler;
public class ItemManipulationCommandHandler : CommandHandlerBase
{
public class ItemManipulationCommandHandler : CommandHandlerBase
{
private ITabViewModel? _selectedTab;
private IItemViewModel? _currentSelectedItem;
private readonly ICommandHandlerService _commandHandlerService;
@@ -92,5 +92,4 @@ namespace FileTime.App.Core.Services.CommandHandler
if (_clipboardService.CommandType is null) return Task.CompletedTask;
return Task.CompletedTask;
}
}
}

View File

@@ -4,10 +4,10 @@ using FileTime.App.Core.Extensions;
using FileTime.App.Core.ViewModels;
using FileTime.Core.Models;
namespace FileTime.App.Core.Services.CommandHandler
namespace FileTime.App.Core.Services.CommandHandler;
public class NavigationCommandHandler : CommandHandlerBase
{
public class NavigationCommandHandler : CommandHandlerBase
{
private ITabViewModel? _selectedTab;
private IContainer? _currentLocation;
private IItemViewModel? _currentSelectedItem;
@@ -64,5 +64,4 @@ namespace FileTime.App.Core.Services.CommandHandler
_selectedTab.Tab?.SetSelectedItem(newSelectedItem.ToAbsolutePath());
}
}
}

View File

@@ -1,10 +1,10 @@
using FileTime.App.Core.Command;
using Microsoft.Extensions.DependencyInjection;
namespace FileTime.App.Core.Services
namespace FileTime.App.Core.Services;
public class CommandHandlerService : ICommandHandlerService
{
public class CommandHandlerService : ICommandHandlerService
{
private readonly Lazy<IEnumerable<ICommandHandler>> _commandHandlers;
public CommandHandlerService(IServiceProvider serviceProvider)
@@ -76,5 +76,4 @@ namespace FileTime.App.Core.Services
await handler.HandleCommandAsync(command);
}
}
}
}

View File

@@ -1,9 +1,9 @@
using FileTime.App.Core.Models;
namespace FileTime.App.Core.Services
namespace FileTime.App.Core.Services;
public class ItemNameConverterService : IItemNameConverterService
{
public class ItemNameConverterService : IItemNameConverterService
{
public List<ItemNamePart> GetDisplayName(string name, string? searchText)
{
var nameParts = new List<ItemNamePart>();
@@ -52,5 +52,4 @@ namespace FileTime.App.Core.Services
var parts = fullName.Split('.');
return parts.Length == 1 || (parts.Length == 2 && string.IsNullOrEmpty(parts[0])) ? "" : parts[^1];
}
}
}

View File

@@ -3,10 +3,10 @@ using FileTime.App.Core.Services.CommandHandler;
using FileTime.App.Core.ViewModels;
using Microsoft.Extensions.DependencyInjection;
namespace FileTime.App.Core
namespace FileTime.App.Core;
public static class Startup
{
public static class Startup
{
public static IServiceCollection AddCoreAppServices(this IServiceCollection serviceCollection)
{
return serviceCollection
@@ -25,5 +25,4 @@ namespace FileTime.App.Core
.AddSingleton<ICommandHandler, NavigationCommandHandler>()
.AddSingleton<ICommandHandler, ItemManipulationCommandHandler>();
}
}
}

View File

@@ -5,11 +5,11 @@ using FileTime.App.Core.Models.Enums;
using MvvmGen;
using MoreLinq;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
[ViewModel]
public abstract partial class AppStateBase : IAppState
{
[ViewModel]
public abstract partial class AppStateBase : IAppState
{
private readonly BehaviorSubject<string?> _searchText = new(null);
private readonly BehaviorSubject<ITabViewModel?> _selectedTab = new(null);
private readonly BehaviorSubject<IEnumerable<ITabViewModel>> _tabs = new(Enumerable.Empty<ITabViewModel>());
@@ -50,5 +50,4 @@ namespace FileTime.App.Core.ViewModels
var (prefered, others) = tabs.OrderBy(t => t.TabNumber).Partition(t => t.TabNumber >= (expectedSelectedTab?.TabNumber ?? 0));
return prefered.Concat(others).FirstOrDefault();
}
}
}

View File

@@ -2,11 +2,11 @@ using FileTime.App.Core.Services;
using FileTime.Core.Models;
using MvvmGen;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
[ViewModel(GenerateConstructor = false)]
public partial class ContainerSizeContainerViewModel : ItemViewModel, IContainerSizeContainerViewModel
{
[ViewModel(GenerateConstructor = false)]
public partial class ContainerSizeContainerViewModel : ItemViewModel, IContainerSizeContainerViewModel
{
[Property]
private long _size;
@@ -18,5 +18,4 @@ namespace FileTime.App.Core.ViewModels
{
Init((IItem)item, parentTab);
}
}
}

View File

@@ -2,11 +2,11 @@ using FileTime.App.Core.Services;
using FileTime.Core.Models;
using MvvmGen;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
[ViewModel(GenerateConstructor = false)]
public partial class ContainerViewModel : ItemViewModel, IContainerViewModel
{
[ViewModel(GenerateConstructor = false)]
public partial class ContainerViewModel : ItemViewModel, IContainerViewModel
{
public IContainer? Container => BaseItem as IContainer;
public ContainerViewModel(IItemNameConverterService _itemNameConverterService, IAppState _appState) : base(_itemNameConverterService, _appState)
@@ -17,5 +17,4 @@ namespace FileTime.App.Core.ViewModels
{
Init((IItem)item, parentTab);
}
}
}

View File

@@ -2,11 +2,11 @@ using FileTime.App.Core.Services;
using FileTime.Core.Models;
using MvvmGen;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
[ViewModel(GenerateConstructor = false)]
public partial class ElementViewModel : ItemViewModel, IElementViewModel
{
[ViewModel(GenerateConstructor = false)]
public partial class ElementViewModel : ItemViewModel, IElementViewModel
{
[Property]
private long? _size;
@@ -18,5 +18,4 @@ namespace FileTime.App.Core.ViewModels
{
Init((IItem)item, parentTab);
}
}
}

View File

@@ -2,11 +2,11 @@ using FileTime.App.Core.Services;
using FileTime.Core.Models;
using MvvmGen;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
[ViewModel(GenerateConstructor = false)]
public partial class FileViewModel : ElementViewModel, IFileViewModel
{
[ViewModel(GenerateConstructor = false)]
public partial class FileViewModel : ElementViewModel, IFileViewModel
{
public FileViewModel(IItemNameConverterService _itemNameConverterService, IAppState _appState) : base(_itemNameConverterService, _appState)
{
}
@@ -15,5 +15,4 @@ namespace FileTime.App.Core.ViewModels
{
Init((IElement)item, parentTab);
}
}
}

View File

@@ -7,13 +7,13 @@ using FileTime.Core.Models;
using MoreLinq;
using MvvmGen;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
[ViewModel]
[Inject(typeof(IAppState), "_appState")]
[Inject(typeof(IItemNameConverterService), "_itemNameConverterService")]
public abstract partial class ItemViewModel : IItemViewModel
{
[ViewModel]
[Inject(typeof(IAppState), "_appState")]
[Inject(typeof(IItemNameConverterService), "_itemNameConverterService")]
public abstract partial class ItemViewModel : IItemViewModel
{
[Property]
private IItem? _baseItem;
@@ -69,5 +69,4 @@ namespace FileTime.App.Core.ViewModels
{
return BaseItem?.FullName?.Path is string path && path == itemViewModel?.BaseItem?.FullName?.Path;
}
}
}

View File

@@ -9,11 +9,11 @@ using FileTime.Tools.Extensions;
using Microsoft.Extensions.DependencyInjection;
using MvvmGen;
namespace FileTime.App.Core.ViewModels
namespace FileTime.App.Core.ViewModels;
[ViewModel]
public partial class TabViewModel : ITabViewModel, IDisposable
{
[ViewModel]
public partial class TabViewModel : ITabViewModel, IDisposable
{
private readonly IServiceProvider _serviceProvider;
private readonly IItemNameConverterService _itemNameConverterService;
private readonly IAppState _appState;
@@ -242,5 +242,4 @@ namespace FileTime.App.Core.ViewModels
}
disposed = true;
}
}
}

View File

@@ -3,10 +3,10 @@ using FileTime.Core.Services;
using FileTime.Providers.Local;
using Microsoft.Extensions.DependencyInjection;
namespace FileTime.App.DependencyInjection
namespace FileTime.App.DependencyInjection;
public static class DependencyInjection
{
public static class DependencyInjection
{
public static IServiceCollection RegisterDefaultServices(IServiceCollection? serviceCollection = null)
{
serviceCollection ??= new ServiceCollection();
@@ -16,5 +16,4 @@ namespace FileTime.App.DependencyInjection
.AddCoreAppServices()
.AddLocalServices();
}
}
}

View File

@@ -5,6 +5,11 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
</ItemGroup>

View File

@@ -6,4 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
</Project>

View File

@@ -7,6 +7,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\FileTime.ConsoleUI.App\FileTime.ConsoleUI.App.csproj" />
</ItemGroup>

View File

@@ -1,7 +1,6 @@
namespace FileTime.Core.Behaviors
namespace FileTime.Core.Behaviors;
public interface IOnContainerEnter
{
public interface IOnContainerEnter
{
Task OnEnter();
}
}

View File

@@ -1,7 +1,6 @@
namespace FileTime.Core.Command
{
public interface ICommand
{
namespace FileTime.Core.Command;
public interface ICommand
{
}
}

View File

@@ -1,7 +1,6 @@
namespace FileTime.Core.Command
{
public interface ITransportationCommand : ICommand
{
namespace FileTime.Core.Command;
public interface ITransportationCommand : ICommand
{
}
}

View File

@@ -1,9 +1,8 @@
namespace FileTime.Core.Enums
namespace FileTime.Core.Enums;
public enum AbsolutePathType
{
public enum AbsolutePathType
{
Unknown,
Container,
Element
}
}

View File

@@ -1,9 +1,8 @@
namespace FileTime.Core.Enums
namespace FileTime.Core.Enums;
public enum SupportsDelete
{
public enum SupportsDelete
{
False,
True,
HardDeleteOnly,
}
}

View File

@@ -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" />

View File

@@ -1,7 +1,6 @@
namespace FileTime.Core.Models
namespace FileTime.Core.Models;
public static class Constants
{
public static class Constants
{
public const char SeparatorChar = '/';
}
}

View File

@@ -1,7 +1,7 @@
namespace FileTime.Core.Models
namespace FileTime.Core.Models;
public record FullName(string Path)
{
public record FullName(string Path)
{
public FullName? GetParent()
{
if (Path is null) return null;
@@ -13,5 +13,4 @@ namespace FileTime.Core.Models
_ => null
};
}
}
}

View File

@@ -1,10 +1,10 @@
using FileTime.Core.Enums;
using FileTime.Core.Services;
namespace FileTime.Core.Models
namespace FileTime.Core.Models;
public interface IAbsolutePath
{
public interface IAbsolutePath
{
IContentProvider ContentProvider { get; }
IContentProvider? VirtualContentProvider { get; }
FullName Path { get; }
@@ -12,5 +12,4 @@ namespace FileTime.Core.Models
Task<IItem> ResolveAsync(bool forceResolve = false, ItemInitializationSettings itemInitializationSettings = default);
Task<IItem?> ResolveAsyncSafe(bool forceResolve = false, ItemInitializationSettings itemInitializationSettings = default);
}
}

View File

@@ -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; }
}
}

View File

@@ -1,7 +1,6 @@
namespace FileTime.Core.Models
{
public interface IElement : IItem
{
namespace FileTime.Core.Models;
public interface IElement : IItem
{
}
}

View File

@@ -1,7 +1,6 @@
namespace FileTime.Core.Models
namespace FileTime.Core.Models;
public interface IFileElement : IElement
{
public interface IFileElement : IElement
{
long Size { get; }
}
}

View File

@@ -1,10 +1,10 @@
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; }
@@ -19,5 +19,4 @@ namespace FileTime.Core.Models
string? Attributes { get; }
AbsolutePathType Type { get; }
IObservable<IEnumerable<Exception>> Exceptions { get; }
}
}

View File

@@ -1,12 +1,11 @@
namespace FileTime.Core.Models
namespace FileTime.Core.Models;
public readonly struct ItemInitializationSettings
{
public readonly struct ItemInitializationSettings
{
public readonly bool SkipChildInitialization;
public ItemInitializationSettings(bool skipChildInitialization)
{
SkipChildInitialization = skipChildInitialization;
}
}
}

View File

@@ -1,7 +1,6 @@
namespace FileTime.Core.Models
{
public record ItemsTransformator(
namespace FileTime.Core.Models;
public record ItemsTransformator(
string Name,
Func<IEnumerable<IItem>, Task<IEnumerable<IItem>>> Transformator
);
}
);

View File

@@ -1,4 +1,3 @@
namespace FileTime.Core.Models
{
public record NativePath(string Path);
}
namespace FileTime.Core.Models;
public record NativePath(string Path);

View File

@@ -2,10 +2,10 @@ 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,
@@ -19,5 +19,4 @@ namespace FileTime.Core.Services
ItemInitializationSettings itemInitializationSettings = default);
Task<List<IAbsolutePath>> GetItemsByContainerAsync(FullName fullName);
}
}

View File

@@ -2,10 +2,10 @@ using DynamicData;
using FileTime.Core.Models;
using InitableService;
namespace FileTime.Core.Services
namespace FileTime.Core.Services;
public interface ITab : IInitable<IContainer>
{
public interface ITab : IInitable<IContainer>
{
IObservable<IContainer?> CurrentLocation { get; }
IObservable<IAbsolutePath?> CurrentSelectedItem { get; }
IObservable<IObservable<IChangeSet<IItem>>?> CurrentItems { get; }
@@ -15,5 +15,4 @@ namespace FileTime.Core.Services
void RemoveSelectedItemsTransformator(ItemsTransformator transformator);
void RemoveSelectedItemsTransformatorByName(string name);
void SetSelectedItem(IAbsolutePath newSelectedItem);
}
}

View File

@@ -1,7 +1,6 @@
namespace FileTime.Core.Command.Copy
{
public class CopyCommand : ITransportationCommand
{
namespace FileTime.Core.Command.Copy;
public class CopyCommand : ITransportationCommand
{
}
}

View File

@@ -4,6 +4,10 @@
<ProjectReference Include="..\FileTime.Core.Abstraction\FileTime.Core.Abstraction.csproj" />
</ItemGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>

View File

@@ -1,9 +1,8 @@
namespace FileTime.Core.Command
namespace FileTime.Core.Command;
public enum TransportMode
{
public enum TransportMode
{
Merge,
Overwrite,
Skip
}
}

View File

@@ -1,10 +1,10 @@
using FileTime.Core.Enums;
using FileTime.Core.Services;
namespace FileTime.Core.Models
namespace FileTime.Core.Models;
public class AbsolutePath : IAbsolutePath
{
public class AbsolutePath : IAbsolutePath
{
public IContentProvider ContentProvider { get; }
public IContentProvider? VirtualContentProvider { get; }
@@ -41,5 +41,4 @@ namespace FileTime.Core.Models
}
catch { return null; }
}
}
}

View File

@@ -4,9 +4,9 @@ using DynamicData;
using FileTime.Core.Enums;
using FileTime.Core.Services;
namespace FileTime.Core.Models
{
public record Container(
namespace FileTime.Core.Models;
public record Container(
string Name,
string DisplayName,
FullName FullName,
@@ -21,9 +21,8 @@ namespace FileTime.Core.Models
IContentProvider Provider,
IObservable<IEnumerable<Exception>> Exceptions,
IObservable<IObservable<IChangeSet<IAbsolutePath>>?> Items) : IContainer
{
{
BehaviorSubject<bool> IsLoading { get; } = new BehaviorSubject<bool>(false);
IObservable<bool> IContainer.IsLoading => IsLoading.AsObservable();
public AbsolutePathType Type => AbsolutePathType.Container;
}
}

View File

@@ -1,9 +1,9 @@
using FileTime.Core.Enums;
using FileTime.Core.Services;
namespace FileTime.Core.Models
{
public record Element(
namespace FileTime.Core.Models;
public record Element(
string Name,
string DisplayName,
FullName FullName,
@@ -17,7 +17,6 @@ namespace FileTime.Core.Models
string? Attributes,
IContentProvider Provider,
IObservable<IEnumerable<Exception>> Exceptions) : IElement
{
{
public AbsolutePathType Type => AbsolutePathType.Element;
}
}

View File

@@ -1,9 +1,9 @@
using FileTime.Core.Enums;
using FileTime.Core.Services;
namespace FileTime.Core.Models
{
public record FileElement(
namespace FileTime.Core.Models;
public record FileElement(
string Name,
string DisplayName,
FullName FullName,
@@ -33,4 +33,3 @@ namespace FileTime.Core.Models
Provider,
Exceptions
), IFileElement;
}

View File

@@ -6,6 +6,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\FileTime.Core.Abstraction\FileTime.Core.Abstraction.csproj" />
</ItemGroup>

View File

@@ -4,10 +4,10 @@ using DynamicData;
using FileTime.Core.Enums;
using FileTime.Core.Models;
namespace FileTime.Core.Services
namespace FileTime.Core.Services;
public abstract class ContentProviderBase : IContentProvider
{
public abstract class ContentProviderBase : IContentProvider
{
protected BehaviorSubject<IObservable<IChangeSet<IAbsolutePath>>?> Items { get; } = new (null);
IObservable<IObservable<IChangeSet<IAbsolutePath>>?> IContainer.Items => Items;
@@ -63,5 +63,4 @@ namespace FileTime.Core.Services
ItemInitializationSettings itemInitializationSettings = default);
public abstract Task<List<IAbsolutePath>> GetItemsByContainerAsync(FullName fullName);
public abstract NativePath GetNativePath(FullName fullName);
}
}

View File

@@ -6,6 +6,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Interactive.Async" Version="6.0.1" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />

View File

@@ -3,10 +3,10 @@ using System.Reactive.Subjects;
using DynamicData;
using FileTime.Core.Models;
namespace FileTime.Core.Services
namespace FileTime.Core.Services;
public class Tab : ITab
{
public class Tab : ITab
{
private readonly BehaviorSubject<IContainer?> _currentLocation = new(null);
private readonly BehaviorSubject<IAbsolutePath?> _currentSelectedItem = new(null);
private readonly List<ItemsTransformator> _transformators = new();
@@ -91,5 +91,4 @@ namespace FileTime.Core.Services
if (resolvedSelectedItem is not IContainer resolvedContainer) return;
SetCurrentLocation(resolvedContainer);
}
}
}

View File

@@ -1,10 +1,10 @@
using Avalonia.Input;
using FileTime.App.Core.Command;
namespace FileTime.GuiApp.Configuration
namespace FileTime.GuiApp.Configuration;
public class CommandBindingConfiguration
{
public class CommandBindingConfiguration
{
public List<KeyConfig> Keys { get; set; } = new List<KeyConfig>();
public Commands Command { get; set; } = Commands.None;
@@ -85,5 +85,4 @@ namespace FileTime.GuiApp.Configuration
return s;
}
}
}

View File

@@ -1,9 +1,8 @@
namespace FileTime.GuiApp.Configuration
namespace FileTime.GuiApp.Configuration;
public class KeyBindingConfiguration
{
public class KeyBindingConfiguration
{
public bool UseDefaultBindings { get; set; } = true;
public List<CommandBindingConfiguration> DefaultKeyBindings { get; set; } = new();
public List<CommandBindingConfiguration> KeyBindings { get; set; } = new();
}
}

View File

@@ -1,9 +1,9 @@
using Avalonia.Input;
namespace FileTime.GuiApp.Configuration
namespace FileTime.GuiApp.Configuration;
public class KeyConfig
{
public class KeyConfig
{
public Key Key { get; set; }
public bool Shift { get; set; }
public bool Alt { get; set; }
@@ -28,5 +28,4 @@ namespace FileTime.GuiApp.Configuration
&& Alt == otherKeyConfig.Alt
&& Shift == otherKeyConfig.Shift
&& Ctrl == otherKeyConfig.Ctrl;
}
}

View File

@@ -3,10 +3,10 @@ using FileTime.App.Core.Command;
using System;
using System.Collections.Generic;
namespace FileTime.GuiApp.Configuration
namespace FileTime.GuiApp.Configuration;
public static class MainConfiguration
{
public static class MainConfiguration
{
private static readonly Lazy<List<CommandBindingConfiguration>> _defaultKeybindings = new(InitDefaultKeyBindings);
public static Dictionary<string, string> Configuration { get; }
@@ -124,5 +124,4 @@ namespace FileTime.GuiApp.Configuration
}
}
}
}
}

View File

@@ -1,7 +1,7 @@
namespace FileTime.GuiApp.Configuration
namespace FileTime.GuiApp.Configuration;
public class ProgramConfiguration
{
public class ProgramConfiguration
{
public string? Path { get; set; }
public string? Arguments { get; set; }
@@ -12,5 +12,4 @@ namespace FileTime.GuiApp.Configuration
Path = path;
Arguments = arguments;
}
}
}

View File

@@ -1,10 +1,9 @@
using System.Collections.Generic;
namespace FileTime.GuiApp.Configuration
namespace FileTime.GuiApp.Configuration;
public class ProgramsConfiguration
{
public class ProgramsConfiguration
{
public List<ProgramConfiguration> DefaultEditorPrograms { get; set; } = new();
public List<ProgramConfiguration> EditorPrograms { get; set; } = new();
}
}

View File

@@ -1,8 +1,7 @@
namespace FileTime.GuiApp.Configuration
namespace FileTime.GuiApp.Configuration;
public static class SectionNames
{
public static class SectionNames
{
public const string KeybindingSectionName = "KeyBindings";
public const string ProgramsSectionName = "Programs";
}
}

View File

@@ -6,6 +6,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
</ItemGroup>

View File

@@ -1,4 +1,3 @@
namespace FileTime.GuiApp.Models
{
public record SpecialKeysStatus(bool IsAltPressed, bool IsShiftPressed, bool IsCtrlPressed);
}
namespace FileTime.GuiApp.Models;
public record SpecialKeysStatus(bool IsAltPressed, bool IsShiftPressed, bool IsCtrlPressed);

View File

@@ -1,4 +1,3 @@
namespace FileTime.GuiApp.Services
{
public interface IDefaultModeKeyInputHandler : IKeyInputHandler { }
}
namespace FileTime.GuiApp.Services;
public interface IDefaultModeKeyInputHandler : IKeyInputHandler { }

View File

@@ -1,10 +1,9 @@
using Avalonia.Input;
using FileTime.GuiApp.Models;
namespace FileTime.GuiApp.Services
namespace FileTime.GuiApp.Services;
public interface IKeyInputHandler
{
public interface IKeyInputHandler
{
Task HandleInputKey(Key key, SpecialKeysStatus specialKeysStatus, Action<bool> setHandled);
}
}

View File

@@ -1,9 +1,8 @@
using Avalonia.Input;
namespace FileTime.GuiApp.Services
namespace FileTime.GuiApp.Services;
public interface IKeyInputHandlerService
{
public interface IKeyInputHandlerService
{
Task ProcessKeyDown(Key key, KeyModifiers keyModifiers, Action<bool> setHandled);
}
}

View File

@@ -1,11 +1,10 @@
using FileTime.GuiApp.Configuration;
namespace FileTime.GuiApp.Services
namespace FileTime.GuiApp.Services;
public interface IKeyboardConfigurationService
{
public interface IKeyboardConfigurationService
{
IReadOnlyList<CommandBindingConfiguration> CommandBindings { get; }
IReadOnlyList<CommandBindingConfiguration> UniversalCommandBindings { get; }
IReadOnlyList<CommandBindingConfiguration> AllShortcut { get; }
}
}

View File

@@ -1,4 +1,3 @@
namespace FileTime.GuiApp.Services
{
public interface IRapidTravelModeKeyInputHandler : IKeyInputHandler { }
}
namespace FileTime.GuiApp.Services;
public interface IRapidTravelModeKeyInputHandler : IKeyInputHandler { }

View File

@@ -1,14 +1,13 @@
using FileTime.App.Core.ViewModels;
using FileTime.GuiApp.Configuration;
namespace FileTime.GuiApp.ViewModels
namespace FileTime.GuiApp.ViewModels;
public interface IGuiAppState : IAppState
{
public interface IGuiAppState : IAppState
{
List<KeyConfig> PreviousKeys { get; }
bool IsAllShortcutVisible { get; set; }
bool NoCommandFound { get; set; }
string? MessageBoxText { get; set; }
List<CommandBindingConfiguration> PossibleCommands { get; set; }
}
}

View File

@@ -7,10 +7,10 @@ using FileTime.GuiApp.Views;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace FileTime.GuiApp
namespace FileTime.GuiApp;
public partial class App : Application
{
public partial class App : Application
{
static App()
{
DI.ServiceProvider ??= DependencyInjection
@@ -42,5 +42,4 @@ namespace FileTime.GuiApp
base.OnFrameworkInitializationCompleted();
}
}
}

View File

@@ -9,6 +9,11 @@
<ApplicationIcon>filetime.ico</ApplicationIcon>
<Version>0.0.1</Version>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<Content Include="filetime.ico" />
</ItemGroup>

View File

@@ -3,10 +3,10 @@ using System.IO;
using Avalonia;
using Avalonia.ReactiveUI;
namespace FileTime.GuiApp
namespace FileTime.GuiApp;
public static class Program
{
public static class Program
{
public static string AppDataRoot { get; }
public static string EnvironmentName { get; }
@@ -58,5 +58,4 @@ namespace FileTime.GuiApp
.UsePlatformDetect()
.UseReactiveUI()
.LogToTrace();
}
}

View File

@@ -11,10 +11,10 @@ using Microsoft.Extensions.DependencyInjection;
using Serilog;
using Serilog.Configuration;
namespace FileTime.GuiApp
namespace FileTime.GuiApp;
public static class Startup
{
public static class Startup
{
internal static IServiceCollection AddViewModels(this IServiceCollection serviceCollection)
{
return serviceCollection
@@ -76,5 +76,4 @@ namespace FileTime.GuiApp
{
return loggerConfiguration.Sink(serviceProvider.GetService<ToastMessageSink>());
}
}
}

View File

@@ -6,6 +6,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\AppCommon\FileTime.App.Core\FileTime.App.Core.csproj" />
<ProjectReference Include="..\FileTime.GuiApp.Abstractions\FileTime.GuiApp.Abstractions.csproj" />

View File

@@ -2,11 +2,11 @@ using FileTime.App.Core.ViewModels;
using FileTime.GuiApp.Configuration;
using MvvmGen;
namespace FileTime.GuiApp.ViewModels
namespace FileTime.GuiApp.ViewModels;
[ViewModel]
public partial class GuiAppState : AppStateBase, IGuiAppState
{
[ViewModel]
public partial class GuiAppState : AppStateBase, IGuiAppState
{
[Property]
private bool _isAllShortcutVisible;
@@ -20,5 +20,4 @@ namespace FileTime.GuiApp.ViewModels
private List<CommandBindingConfiguration> _possibleCommands = new();
public List<KeyConfig> PreviousKeys { get; } = new();
}
}

View File

@@ -1,20 +1,20 @@
using System.Globalization;
using Avalonia.Data.Converters;
namespace FileTime.GuiApp.Converters
namespace FileTime.GuiApp.Converters;
public enum ComparisonCondition
{
public enum ComparisonCondition
{
Equal,
GreaterThan,
LessThan,
LessThanOrEqual,
NotEqual,
GreaterThanOrEqual
}
}
public class CompareConverter : IValueConverter
{
public class CompareConverter : IValueConverter
{
public ComparisonCondition ComparisonCondition { get; set; } = ComparisonCondition.Equal;
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -50,5 +50,4 @@ namespace FileTime.GuiApp.Converters
return value == parameter;
}
}
}

View File

@@ -1,10 +1,10 @@
using System.Globalization;
using Avalonia.Data.Converters;
namespace FileTime.GuiApp.Converters
namespace FileTime.GuiApp.Converters;
public class DateTimeConverter : IValueConverter
{
public class DateTimeConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
value is DateTime dateTime && parameter is string parameterS
? dateTime.ToString(parameterS)
@@ -14,5 +14,4 @@ namespace FileTime.GuiApp.Converters
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,10 +1,10 @@
using System.Globalization;
using Avalonia.Data.Converters;
namespace FileTime.GuiApp.Converters
namespace FileTime.GuiApp.Converters;
public class ExceptionToStringConverter : IValueConverter
{
public class ExceptionToStringConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not Exception e) return value;
@@ -41,5 +41,4 @@ namespace FileTime.GuiApp.Converters
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,10 +1,10 @@
using System.Globalization;
using Avalonia.Data.Converters;
namespace FileTime.GuiApp.Converters
namespace FileTime.GuiApp.Converters;
public class FormatSizeConverter : IValueConverter
{
public class FormatSizeConverter : IValueConverter
{
private const long OneKiloByte = 1024;
private const long OneMegaByte = OneKiloByte * 1024;
private const long OneGigaByte = OneMegaByte * 1024;
@@ -43,5 +43,4 @@ namespace FileTime.GuiApp.Converters
if (result.Contains('.')) result = result.TrimEnd('0').TrimEnd('.');
return result + " " + suffix;
}
}
}

View File

@@ -3,10 +3,10 @@ using Avalonia.Data.Converters;
using FileTime.App.Core.Services;
using Microsoft.Extensions.DependencyInjection;
namespace FileTime.GuiApp.Converters
namespace FileTime.GuiApp.Converters;
public class GetFileExtensionConverter : IValueConverter
{
public class GetFileExtensionConverter : IValueConverter
{
private IItemNameConverterService? _itemNameConverterService;
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
@@ -20,5 +20,4 @@ namespace FileTime.GuiApp.Converters
{
throw new NotImplementedException();
}
}
}

View File

@@ -3,10 +3,10 @@ using Avalonia.Data.Converters;
using Avalonia.Media;
using FileTime.App.Core.Models.Enums;
namespace FileTime.GuiApp.Converters
namespace FileTime.GuiApp.Converters;
public class ItemViewModeToBrushConverter : IValueConverter
{
public class ItemViewModeToBrushConverter : IValueConverter
{
public Brush? DefaultBrush { get; set; }
public Brush? AlternativeBrush { get; set; }
public Brush? SelectedBrush { get; set; }
@@ -37,5 +37,4 @@ namespace FileTime.GuiApp.Converters
{
throw new NotImplementedException();
}
}
}

View File

@@ -3,10 +3,10 @@ using Avalonia.Data.Converters;
using FileTime.App.Core.Models.Enums;
using FileTime.App.Core.ViewModels;
namespace FileTime.GuiApp.Converters
namespace FileTime.GuiApp.Converters;
public class ItemViewModelIsAttributeTypeConverter : IValueConverter
{
public class ItemViewModelIsAttributeTypeConverter : IValueConverter
{
public bool Invert { get; set; }
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
@@ -33,5 +33,4 @@ namespace FileTime.GuiApp.Converters
{
throw new NotImplementedException();
}
}
}

View File

@@ -4,10 +4,10 @@ using Avalonia.Media;
using FileTime.App.Core.Models;
using FileTime.GuiApp.ViewModels;
namespace FileTime.GuiApp.Converters
namespace FileTime.GuiApp.Converters;
public class NamePartShrinkerConverter : IMultiValueConverter
{
public class NamePartShrinkerConverter : IMultiValueConverter
{
private const int PixelPerChar = 8;
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
@@ -111,5 +111,4 @@ namespace FileTime.GuiApp.Converters
}
return newNameParts;
}
}
}

View File

@@ -1,10 +1,10 @@
using System.Globalization;
using Avalonia.Data.Converters;
namespace FileTime.GuiApp.Converters
namespace FileTime.GuiApp.Converters;
public class SplitStringConverter : IValueConverter
{
public class SplitStringConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is string path && parameter is string separator)
@@ -23,5 +23,4 @@ namespace FileTime.GuiApp.Converters
{
throw new NotImplementedException();
}
}
}

Some files were not shown because too many files have changed in this diff Show More