RemoteContentProvider get items WIP
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>FileTime.Core</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FileTime.Core.Abstraction\FileTime.Core.Abstraction.csproj" />
|
||||
<ProjectReference Include="..\FileTime.Core.CommandHandlers\FileTime.Core.CommandHandlers.csproj" />
|
||||
<ProjectReference Include="..\FileTime.Core.Command\FileTime.Core.Command.csproj" />
|
||||
<ProjectReference Include="..\FileTime.Core.ContentAccess\FileTime.Core.ContentAccess.csproj" />
|
||||
<ProjectReference Include="..\FileTime.Core.Serialization\FileTime.Core.Serialization.csproj" />
|
||||
<ProjectReference Include="..\FileTime.Core.Services\FileTime.Core.Services.csproj" />
|
||||
<ProjectReference Include="..\FileTime.Core.Timeline\FileTime.Core.Timeline.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,88 @@
|
||||
using FileTime.Core.Command;
|
||||
using FileTime.Core.Command.Copy;
|
||||
using FileTime.Core.Command.CreateContainer;
|
||||
using FileTime.Core.Command.CreateElement;
|
||||
using FileTime.Core.Command.Delete;
|
||||
using FileTime.Core.Command.Move;
|
||||
using FileTime.Core.CommandHandlers;
|
||||
using FileTime.Core.ContentAccess;
|
||||
using FileTime.Core.Models;
|
||||
using FileTime.Core.Serialization;
|
||||
using FileTime.Core.Serialization.Container;
|
||||
using FileTime.Core.Services;
|
||||
using FileTime.Core.Timeline;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace FileTime.Core;
|
||||
|
||||
public static class Startup
|
||||
{
|
||||
public static IServiceCollection AddCoreDependencies(this IServiceCollection serviceCollection)
|
||||
=> serviceCollection
|
||||
.AddCoreServices()
|
||||
.AddTimelineServices()
|
||||
.AddDefaultCommandHandlers()
|
||||
.AddCommands()
|
||||
.AddCommandFactories()
|
||||
.AddCommandServices()
|
||||
.AddContentAccessServices()
|
||||
.AddSerialization();
|
||||
|
||||
private static IServiceCollection AddContentAccessServices(this IServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.TryAddSingleton<IContentAccessorFactory, ContentAccessorFactory>();
|
||||
serviceCollection.TryAddSingleton<IContentProviderRegistry, ContentProviderRegistry>();
|
||||
serviceCollection.TryAddSingleton<IRootContentProvider, RootContentProvider>();
|
||||
|
||||
return serviceCollection;
|
||||
}
|
||||
|
||||
private static IServiceCollection AddCommandServices(this IServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.TryAddSingleton<ICommandRunner, CommandRunner>();
|
||||
|
||||
return serviceCollection;
|
||||
}
|
||||
|
||||
private static IServiceCollection AddCoreServices(this IServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.TryAddTransient<ITab, Tab>();
|
||||
serviceCollection.TryAddSingleton<ITabEvents, TabEvents>();
|
||||
|
||||
return serviceCollection;
|
||||
}
|
||||
|
||||
private static IServiceCollection AddTimelineServices(this IServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.TryAddSingleton<ICommandScheduler, CommandScheduler>();
|
||||
serviceCollection.TryAddSingleton<ITimelessContentProvider, TimelessContentProvider>();
|
||||
//TODO: check local/remote context
|
||||
serviceCollection.TryAddSingleton<ILocalCommandExecutor, LocalCommandExecutor>();
|
||||
serviceCollection.TryAddSingleton<ICommandSchedulerNotifier, LocalCommandSchedulerNotifier>();
|
||||
|
||||
return serviceCollection;
|
||||
}
|
||||
|
||||
private static IServiceCollection AddCommands(this IServiceCollection serviceCollection)
|
||||
=> serviceCollection
|
||||
.AddTransient<CreateContainerCommand>()
|
||||
.AddTransient<CreateElementCommand>()
|
||||
.AddTransient<DeleteCommand>();
|
||||
|
||||
private static IServiceCollection AddCommandFactories(this IServiceCollection serviceCollection) =>
|
||||
serviceCollection
|
||||
.AddSingleton<CopyCommandFactory>()
|
||||
.AddSingleton<MoveCommandFactory>();
|
||||
|
||||
|
||||
private static IServiceCollection AddSerialization(this IServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.TryAddSingleton<ISerializer<IContainer>, ContainerSerializer>();
|
||||
return serviceCollection;
|
||||
}
|
||||
|
||||
private static IServiceCollection AddDefaultCommandHandlers(this IServiceCollection serviceCollection)
|
||||
=> serviceCollection
|
||||
.AddSingleton<ICommandHandler, StreamCopyCommandHandler>();
|
||||
}
|
||||
Reference in New Issue
Block a user