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] [*.cs]
dotnet_diagnostic.RCS1196.severity = none 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, None,
AutoRefresh, AutoRefresh,
@@ -62,5 +62,4 @@ namespace FileTime.App.Core.Command
TimelineStart, TimelineStart,
ToggleAdvancedIcons, ToggleAdvancedIcons,
ToggleHidden, ToggleHidden,
}
} }

View File

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

View File

@@ -1,10 +1,10 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using DynamicData; 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; private readonly IDisposable _disposable;
public ReadOnlyObservableCollection<T> Collection { get; } public ReadOnlyObservableCollection<T> Collection { get; }
public BindedCollection(IObservable<IChangeSet<T>> dynamicList) public BindedCollection(IObservable<IChangeSet<T>> dynamicList)
@@ -22,5 +22,4 @@ namespace FileTime.App.Core.Models
_disposable.Dispose(); _disposable.Dispose();
GC.SuppressFinalize(this); 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, File,
Element, Element,
Container, Container,
SizeContainer 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, Default,
Alternative, Alternative,
Selected, Selected,
Marked, Marked,
MarkedSelected, MarkedSelected,
MarkedAlternative 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, Default,
RapidTravel 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 string Text { get; set; }
public bool IsSpecial { get; set; } public bool IsSpecial { get; set; }
@@ -10,5 +10,4 @@ namespace FileTime.App.Core.Models
Text = text; Text = text;
IsSpecial = isSpecial; IsSpecial = isSpecial;
} }
}
} }

View File

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

View File

@@ -1,10 +1,9 @@
using FileTime.App.Core.Command; 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); bool CanHandleCommand(Commands command);
Task HandleCommandAsync(Commands command); Task HandleCommandAsync(Commands command);
}
} }

View File

@@ -1,9 +1,8 @@
using FileTime.App.Core.Command; 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); Task HandleCommandAsync(Commands command);
}
} }

View File

@@ -1,11 +1,10 @@
using FileTime.App.Core.Models; 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); List<ItemNamePart> GetDisplayName(string name, string? searchText);
string GetFileExtension(string fullName); string GetFileExtension(string fullName);
string GetFileName(string fullName); string GetFileName(string fullName);
}
} }

View File

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

View File

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

View File

@@ -1,10 +1,9 @@
using FileTime.Core.Models; using FileTime.Core.Models;
using InitableService; 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; } long Size { get; set; }
}
} }

View File

@@ -1,10 +1,9 @@
using FileTime.Core.Models; using FileTime.Core.Models;
using InitableService; 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; } IContainer? Container { get; }
}
} }

View File

@@ -1,10 +1,9 @@
using FileTime.Core.Models; using FileTime.Core.Models;
using InitableService; 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; } long? Size { get; set; }
}
} }

View File

@@ -1,9 +1,8 @@
using FileTime.Core.Models; using FileTime.Core.Models;
using InitableService; 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 FileTime.Core.Models;
using InitableService; 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; } IItem? BaseItem { get; set; }
IObservable<IReadOnlyList<ItemNamePart>>? DisplayName { get; set; } IObservable<IReadOnlyList<ItemNamePart>>? DisplayName { get; set; }
string? DisplayNameText { get; set; } string? DisplayNameText { get; set; }
@@ -17,5 +17,4 @@ namespace FileTime.App.Core.ViewModels
DateTime? CreatedAt { get; set; } DateTime? CreatedAt { get; set; }
string? Attributes { get; set; } string? Attributes { get; set; }
bool EqualsTo(IItemViewModel? itemViewModel); bool EqualsTo(IItemViewModel? itemViewModel);
}
} }

View File

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

View File

@@ -1,9 +1,8 @@
using System.Reactive.Linq; 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)!; 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.App.Core.ViewModels;
using FileTime.Core.Models; 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) public static IAbsolutePath ToAbsolutePath(this IItemViewModel itemViewModel)
{ {
var item = itemViewModel.BaseItem ?? throw new ArgumentException($"{nameof(itemViewModel)} does not have {nameof(IItemViewModel.BaseItem)}"); var item = itemViewModel.BaseItem ?? throw new ArgumentException($"{nameof(itemViewModel)} does not have {nameof(IItemViewModel.BaseItem)}");
return new AbsolutePath(item); return new AbsolutePath(item);
} }
}
} }

View File

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

View File

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

View File

@@ -4,10 +4,10 @@ using FileTime.App.Core.Command;
using FileTime.App.Core.ViewModels; using FileTime.App.Core.ViewModels;
using FileTime.Core.Models; 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 Dictionary<Commands, Func<Task>> _commandHandlers = new();
private readonly IAppState? _appState; private readonly IAppState? _appState;
@@ -50,5 +50,4 @@ namespace FileTime.App.Core.Services.CommandHandler
return act(_appState); return act(_appState);
} }
}
} }

View File

@@ -6,10 +6,10 @@ using FileTime.Core.Command;
using FileTime.Core.Command.Copy; using FileTime.Core.Command.Copy;
using FileTime.Core.Models; 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 ITabViewModel? _selectedTab;
private IItemViewModel? _currentSelectedItem; private IItemViewModel? _currentSelectedItem;
private readonly ICommandHandlerService _commandHandlerService; private readonly ICommandHandlerService _commandHandlerService;
@@ -92,5 +92,4 @@ namespace FileTime.App.Core.Services.CommandHandler
if (_clipboardService.CommandType is null) return Task.CompletedTask; if (_clipboardService.CommandType is null) return Task.CompletedTask;
return Task.CompletedTask; return Task.CompletedTask;
} }
}
} }

View File

@@ -4,10 +4,10 @@ using FileTime.App.Core.Extensions;
using FileTime.App.Core.ViewModels; using FileTime.App.Core.ViewModels;
using FileTime.Core.Models; 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 ITabViewModel? _selectedTab;
private IContainer? _currentLocation; private IContainer? _currentLocation;
private IItemViewModel? _currentSelectedItem; private IItemViewModel? _currentSelectedItem;
@@ -64,5 +64,4 @@ namespace FileTime.App.Core.Services.CommandHandler
_selectedTab.Tab?.SetSelectedItem(newSelectedItem.ToAbsolutePath()); _selectedTab.Tab?.SetSelectedItem(newSelectedItem.ToAbsolutePath());
} }
}
} }

View File

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

View File

@@ -1,9 +1,9 @@
using FileTime.App.Core.Models; 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) public List<ItemNamePart> GetDisplayName(string name, string? searchText)
{ {
var nameParts = new List<ItemNamePart>(); var nameParts = new List<ItemNamePart>();
@@ -52,5 +52,4 @@ namespace FileTime.App.Core.Services
var parts = fullName.Split('.'); var parts = fullName.Split('.');
return parts.Length == 1 || (parts.Length == 2 && string.IsNullOrEmpty(parts[0])) ? "" : parts[^1]; 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 FileTime.App.Core.ViewModels;
using Microsoft.Extensions.DependencyInjection; 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) public static IServiceCollection AddCoreAppServices(this IServiceCollection serviceCollection)
{ {
return serviceCollection return serviceCollection
@@ -25,5 +25,4 @@ namespace FileTime.App.Core
.AddSingleton<ICommandHandler, NavigationCommandHandler>() .AddSingleton<ICommandHandler, NavigationCommandHandler>()
.AddSingleton<ICommandHandler, ItemManipulationCommandHandler>(); .AddSingleton<ICommandHandler, ItemManipulationCommandHandler>();
} }
}
} }

View File

@@ -5,11 +5,11 @@ using FileTime.App.Core.Models.Enums;
using MvvmGen; using MvvmGen;
using MoreLinq; 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<string?> _searchText = new(null);
private readonly BehaviorSubject<ITabViewModel?> _selectedTab = new(null); private readonly BehaviorSubject<ITabViewModel?> _selectedTab = new(null);
private readonly BehaviorSubject<IEnumerable<ITabViewModel>> _tabs = new(Enumerable.Empty<ITabViewModel>()); 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)); var (prefered, others) = tabs.OrderBy(t => t.TabNumber).Partition(t => t.TabNumber >= (expectedSelectedTab?.TabNumber ?? 0));
return prefered.Concat(others).FirstOrDefault(); return prefered.Concat(others).FirstOrDefault();
} }
}
} }

View File

@@ -2,11 +2,11 @@ using FileTime.App.Core.Services;
using FileTime.Core.Models; using FileTime.Core.Models;
using MvvmGen; 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] [Property]
private long _size; private long _size;
@@ -18,5 +18,4 @@ namespace FileTime.App.Core.ViewModels
{ {
Init((IItem)item, parentTab); Init((IItem)item, parentTab);
} }
}
} }

View File

@@ -2,11 +2,11 @@ using FileTime.App.Core.Services;
using FileTime.Core.Models; using FileTime.Core.Models;
using MvvmGen; 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 IContainer? Container => BaseItem as IContainer;
public ContainerViewModel(IItemNameConverterService _itemNameConverterService, IAppState _appState) : base(_itemNameConverterService, _appState) public ContainerViewModel(IItemNameConverterService _itemNameConverterService, IAppState _appState) : base(_itemNameConverterService, _appState)
@@ -17,5 +17,4 @@ namespace FileTime.App.Core.ViewModels
{ {
Init((IItem)item, parentTab); Init((IItem)item, parentTab);
} }
}
} }

View File

@@ -2,11 +2,11 @@ using FileTime.App.Core.Services;
using FileTime.Core.Models; using FileTime.Core.Models;
using MvvmGen; 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] [Property]
private long? _size; private long? _size;
@@ -18,5 +18,4 @@ namespace FileTime.App.Core.ViewModels
{ {
Init((IItem)item, parentTab); Init((IItem)item, parentTab);
} }
}
} }

View File

@@ -2,11 +2,11 @@ using FileTime.App.Core.Services;
using FileTime.Core.Models; using FileTime.Core.Models;
using MvvmGen; 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) public FileViewModel(IItemNameConverterService _itemNameConverterService, IAppState _appState) : base(_itemNameConverterService, _appState)
{ {
} }
@@ -15,5 +15,4 @@ namespace FileTime.App.Core.ViewModels
{ {
Init((IElement)item, parentTab); Init((IElement)item, parentTab);
} }
}
} }

View File

@@ -7,13 +7,13 @@ using FileTime.Core.Models;
using MoreLinq; using MoreLinq;
using MvvmGen; 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] [Property]
private IItem? _baseItem; private IItem? _baseItem;
@@ -69,5 +69,4 @@ namespace FileTime.App.Core.ViewModels
{ {
return BaseItem?.FullName?.Path is string path && path == itemViewModel?.BaseItem?.FullName?.Path; 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 Microsoft.Extensions.DependencyInjection;
using MvvmGen; 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 IServiceProvider _serviceProvider;
private readonly IItemNameConverterService _itemNameConverterService; private readonly IItemNameConverterService _itemNameConverterService;
private readonly IAppState _appState; private readonly IAppState _appState;
@@ -242,5 +242,4 @@ namespace FileTime.App.Core.ViewModels
} }
disposed = true; disposed = true;
} }
}
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,6 @@
namespace FileTime.Core.Command namespace FileTime.Core.Command;
{
public interface ITransportationCommand : ICommand 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, Unknown,
Container, Container,
Element Element
}
} }

View File

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

View File

@@ -6,6 +6,10 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DynamicData" Version="7.6.7" /> <PackageReference Include="DynamicData" Version="7.6.7" />
<PackageReference Include="System.Reactive" Version="5.0.0" /> <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 = '/'; 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() public FullName? GetParent()
{ {
if (Path is null) return null; if (Path is null) return null;
@@ -13,5 +13,4 @@ namespace FileTime.Core.Models
_ => null _ => null
}; };
} }
}
} }

View File

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

View File

@@ -1,10 +1,9 @@
using DynamicData; 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<IObservable<IChangeSet<IAbsolutePath>>?> Items { get; }
IObservable<bool> IsLoading { get; } IObservable<bool> IsLoading { get; }
}
} }

View File

@@ -1,7 +1,6 @@
namespace FileTime.Core.Models namespace FileTime.Core.Models;
{
public interface IElement : IItem 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; } long Size { get; }
}
} }

View File

@@ -1,10 +1,10 @@
using FileTime.Core.Enums; using FileTime.Core.Enums;
using FileTime.Core.Services; using FileTime.Core.Services;
namespace FileTime.Core.Models namespace FileTime.Core.Models;
public interface IItem
{ {
public interface IItem
{
string Name { get; } string Name { get; }
string DisplayName { get; } string DisplayName { get; }
FullName? FullName { get; } FullName? FullName { get; }
@@ -19,5 +19,4 @@ namespace FileTime.Core.Models
string? Attributes { get; } string? Attributes { get; }
AbsolutePathType Type { get; } AbsolutePathType Type { get; }
IObservable<IEnumerable<Exception>> Exceptions { 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 readonly bool SkipChildInitialization;
public ItemInitializationSettings(bool skipChildInitialization) public ItemInitializationSettings(bool skipChildInitialization)
{ {
SkipChildInitialization = skipChildInitialization; SkipChildInitialization = skipChildInitialization;
} }
}
} }

View File

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

View File

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

View File

@@ -2,10 +2,10 @@ using FileTime.Core.Behaviors;
using FileTime.Core.Enums; using FileTime.Core.Enums;
using FileTime.Core.Models; 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( Task<IItem> GetItemByFullNameAsync(
FullName fullName, FullName fullName,
bool forceResolve = false, bool forceResolve = false,
@@ -19,5 +19,4 @@ namespace FileTime.Core.Services
ItemInitializationSettings itemInitializationSettings = default); ItemInitializationSettings itemInitializationSettings = default);
Task<List<IAbsolutePath>> GetItemsByContainerAsync(FullName fullName); Task<List<IAbsolutePath>> GetItemsByContainerAsync(FullName fullName);
}
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
using FileTime.Core.Enums; using FileTime.Core.Enums;
using FileTime.Core.Services; 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 ContentProvider { get; }
public IContentProvider? VirtualContentProvider { get; } public IContentProvider? VirtualContentProvider { get; }
@@ -41,5 +41,4 @@ namespace FileTime.Core.Models
} }
catch { return null; } catch { return null; }
} }
}
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,6 +6,10 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Interactive.Async" Version="6.0.1" /> <PackageReference Include="System.Interactive.Async" Version="6.0.1" />
<PackageReference Include="System.Linq.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 DynamicData;
using FileTime.Core.Models; 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<IContainer?> _currentLocation = new(null);
private readonly BehaviorSubject<IAbsolutePath?> _currentSelectedItem = new(null); private readonly BehaviorSubject<IAbsolutePath?> _currentSelectedItem = new(null);
private readonly List<ItemsTransformator> _transformators = new(); private readonly List<ItemsTransformator> _transformators = new();
@@ -91,5 +91,4 @@ namespace FileTime.Core.Services
if (resolvedSelectedItem is not IContainer resolvedContainer) return; if (resolvedSelectedItem is not IContainer resolvedContainer) return;
SetCurrentLocation(resolvedContainer); SetCurrentLocation(resolvedContainer);
} }
}
} }

View File

@@ -1,10 +1,10 @@
using Avalonia.Input; using Avalonia.Input;
using FileTime.App.Core.Command; 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 List<KeyConfig> Keys { get; set; } = new List<KeyConfig>();
public Commands Command { get; set; } = Commands.None; public Commands Command { get; set; } = Commands.None;
@@ -85,5 +85,4 @@ namespace FileTime.GuiApp.Configuration
return s; 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 bool UseDefaultBindings { get; set; } = true;
public List<CommandBindingConfiguration> DefaultKeyBindings { get; set; } = new(); public List<CommandBindingConfiguration> DefaultKeyBindings { get; set; } = new();
public List<CommandBindingConfiguration> KeyBindings { get; set; } = new(); public List<CommandBindingConfiguration> KeyBindings { get; set; } = new();
}
} }

View File

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

View File

@@ -3,10 +3,10 @@ using FileTime.App.Core.Command;
using System; using System;
using System.Collections.Generic; 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); private static readonly Lazy<List<CommandBindingConfiguration>> _defaultKeybindings = new(InitDefaultKeyBindings);
public static Dictionary<string, string> Configuration { get; } 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? Path { get; set; }
public string? Arguments { get; set; } public string? Arguments { get; set; }
@@ -12,5 +12,4 @@ namespace FileTime.GuiApp.Configuration
Path = path; Path = path;
Arguments = arguments; Arguments = arguments;
} }
}
} }

View File

@@ -1,10 +1,9 @@
using System.Collections.Generic; 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> DefaultEditorPrograms { get; set; } = new();
public List<ProgramConfiguration> EditorPrograms { 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 KeybindingSectionName = "KeyBindings";
public const string ProgramsSectionName = "Programs"; public const string ProgramsSectionName = "Programs";
}
} }

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,9 @@
using Avalonia.Input; using Avalonia.Input;
using FileTime.GuiApp.Models; 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); Task HandleInputKey(Key key, SpecialKeysStatus specialKeysStatus, Action<bool> setHandled);
}
} }

View File

@@ -1,9 +1,8 @@
using Avalonia.Input; 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); Task ProcessKeyDown(Key key, KeyModifiers keyModifiers, Action<bool> setHandled);
}
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,10 +3,10 @@ using System.IO;
using Avalonia; using Avalonia;
using Avalonia.ReactiveUI; 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 AppDataRoot { get; }
public static string EnvironmentName { get; } public static string EnvironmentName { get; }
@@ -58,5 +58,4 @@ namespace FileTime.GuiApp
.UsePlatformDetect() .UsePlatformDetect()
.UseReactiveUI() .UseReactiveUI()
.LogToTrace(); .LogToTrace();
}
} }

View File

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

View File

@@ -6,6 +6,10 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\AppCommon\FileTime.App.Core\FileTime.App.Core.csproj" /> <ProjectReference Include="..\..\..\AppCommon\FileTime.App.Core\FileTime.App.Core.csproj" />
<ProjectReference Include="..\FileTime.GuiApp.Abstractions\FileTime.GuiApp.Abstractions.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 FileTime.GuiApp.Configuration;
using MvvmGen; 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] [Property]
private bool _isAllShortcutVisible; private bool _isAllShortcutVisible;
@@ -20,5 +20,4 @@ namespace FileTime.GuiApp.ViewModels
private List<CommandBindingConfiguration> _possibleCommands = new(); private List<CommandBindingConfiguration> _possibleCommands = new();
public List<KeyConfig> PreviousKeys { get; } = new(); public List<KeyConfig> PreviousKeys { get; } = new();
}
} }

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
using System.Globalization; using System.Globalization;
using Avalonia.Data.Converters; 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) public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{ {
if (value is not Exception e) return value; if (value is not Exception e) return value;
@@ -41,5 +41,4 @@ namespace FileTime.GuiApp.Converters
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
}
} }

View File

@@ -1,10 +1,10 @@
using System.Globalization; using System.Globalization;
using Avalonia.Data.Converters; 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 OneKiloByte = 1024;
private const long OneMegaByte = OneKiloByte * 1024; private const long OneMegaByte = OneKiloByte * 1024;
private const long OneGigaByte = OneMegaByte * 1024; private const long OneGigaByte = OneMegaByte * 1024;
@@ -43,5 +43,4 @@ namespace FileTime.GuiApp.Converters
if (result.Contains('.')) result = result.TrimEnd('0').TrimEnd('.'); if (result.Contains('.')) result = result.TrimEnd('0').TrimEnd('.');
return result + " " + suffix; return result + " " + suffix;
} }
}
} }

View File

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

View File

@@ -3,10 +3,10 @@ using Avalonia.Data.Converters;
using Avalonia.Media; using Avalonia.Media;
using FileTime.App.Core.Models.Enums; 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? DefaultBrush { get; set; }
public Brush? AlternativeBrush { get; set; } public Brush? AlternativeBrush { get; set; }
public Brush? SelectedBrush { get; set; } public Brush? SelectedBrush { get; set; }
@@ -37,5 +37,4 @@ namespace FileTime.GuiApp.Converters
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
}
} }

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
using System.Globalization; using System.Globalization;
using Avalonia.Data.Converters; 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) public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{ {
if (value is string path && parameter is string separator) if (value is string path && parameter is string separator)
@@ -23,5 +23,4 @@ namespace FileTime.GuiApp.Converters
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
}
} }

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