Extract a per-user background host so indexing can later run outside the window.

Keep the GUI as the index writer for now; mutex, named pipe, and opt-in logon autostart prepare Explorer.Host.exe without two SQLite writers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 17:10:49 +02:00
parent 9efb306979
commit 7c23bc2474
40 changed files with 1586 additions and 140 deletions

View File

@@ -10,9 +10,9 @@
<ItemGroup>
<ProjectReference Include="..\Explorer.Analysis\Explorer.Analysis.csproj" />
<ProjectReference Include="..\Explorer.Application\Explorer.Application.csproj" />
<ProjectReference Include="..\Explorer.Contracts\Explorer.Contracts.csproj" />
<ProjectReference Include="..\Explorer.Domain\Explorer.Domain.csproj" />
<ProjectReference Include="..\Explorer.FileOperations\Explorer.FileOperations.csproj" />
<ProjectReference Include="..\Explorer.Indexing\Explorer.Indexing.csproj" />
<ProjectReference Include="..\Explorer.Plugin.Abstractions\Explorer.Plugin.Abstractions.csproj" />
<ProjectReference Include="..\Explorer.Search\Explorer.Search.csproj" />
</ItemGroup>

View File

@@ -2,9 +2,9 @@ using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Explorer.Application;
using Explorer.Contracts;
using Explorer.Domain;
using Explorer.FileOperations;
using Explorer.Indexing;
namespace Explorer.Presentation.ViewModels;
@@ -12,7 +12,7 @@ public sealed partial class ExplorerPaneViewModel : ObservableObject
{
private readonly BrowseService _browse;
private readonly FileOperationService _ops;
private readonly IndexingCoordinator _indexing;
private readonly IIndexingHost _indexing;
private readonly SourceManager _sources;
private readonly IGitStatusProvider _git;
private readonly IThumbnailService? _thumbnails;
@@ -43,7 +43,7 @@ public sealed partial class ExplorerPaneViewModel : ObservableObject
public ExplorerPaneViewModel(
BrowseService browse,
FileOperationService ops,
IndexingCoordinator indexing,
IIndexingHost indexing,
SourceManager sources,
IGitStatusProvider git,
IThumbnailService? thumbnails = null)

View File

@@ -1,8 +1,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Explorer.Application;
using Explorer.Contracts;
using Explorer.Domain;
using Explorer.FileOperations;
using Explorer.Indexing;
namespace Explorer.Presentation.ViewModels;
@@ -22,7 +22,7 @@ public sealed partial class ExplorerTabViewModel : ObservableObject
public ExplorerTabViewModel(
BrowseService browse,
FileOperationService ops,
IndexingCoordinator indexing,
IIndexingHost indexing,
SourceManager sources,
IGitStatusProvider git,
IThumbnailService? thumbnails = null)

View File

@@ -2,9 +2,9 @@ using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Explorer.Application;
using Explorer.Contracts;
using Explorer.Domain;
using Explorer.FileOperations;
using Explorer.Indexing;
using Explorer.Search;
using Explorer.Analysis;
using Explorer.Domain.Abstractions;
@@ -16,7 +16,7 @@ public sealed partial class MainViewModel : ObservableObject
{
private readonly BrowseService _browse;
private readonly FileOperationService _ops;
private readonly IndexingCoordinator _indexing;
private readonly IIndexingHost _indexing;
private readonly SourceManager _sources;
private readonly PathHistoryStore _pathHistory;
private readonly StorageProviderRegistry _providers;
@@ -63,12 +63,11 @@ public sealed partial class MainViewModel : ObservableObject
public MainViewModel(
BrowseService browse,
FileOperationService ops,
IndexingCoordinator indexing,
SourceManager sources,
SearchService search,
AnalysisService analysis,
IIndexStore store,
TransferQueue transfers,
IWorkbenchHost workbench,
IOsClipboard clipboard,
PathHistoryStore pathHistory,
StorageProviderRegistry providers,
@@ -88,7 +87,7 @@ public sealed partial class MainViewModel : ObservableObject
{
_browse = browse;
_ops = ops;
_indexing = indexing;
_indexing = workbench.Indexing;
_sources = sources;
_pathHistory = pathHistory;
_providers = providers;
@@ -112,10 +111,10 @@ public sealed partial class MainViewModel : ObservableObject
Analysis = new AnalysisViewModel(analysis);
Duplicates = new DuplicateViewModel(store, sources, analysis);
Duplicates.RevealPath += (_, path) => _ = RevealDuplicateAsync(path);
Transfers = new TransferQueueViewModel(transfers, preferences);
Transfers = new TransferQueueViewModel(workbench.Transfers, preferences);
Tabs = [];
Clipboard = clipboard;
transfers.JobFinished += (_, job) =>
workbench.Transfers.JobFinished += (_, job) =>
{
void Go() => _ = OnTransferFinishedAsync(job);
if (_ui is { } ctx)

View File

@@ -2,8 +2,8 @@ using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Explorer.Application;
using Explorer.Contracts;
using Explorer.Domain;
using Explorer.FileOperations;
namespace Explorer.Presentation.ViewModels;
@@ -186,7 +186,7 @@ public sealed partial class TransferJobViewModel : ObservableObject
public sealed partial class TransferQueueViewModel : ObservableObject
{
private readonly TransferQueue _queue;
private readonly ITransferHost _queue;
private readonly UiPreferencesStore _preferences;
private readonly SynchronizationContext? _ui = SynchronizationContext.Current;
private readonly Dictionary<long, (long Bytes, DateTime Utc)> _speed = [];
@@ -205,7 +205,7 @@ public sealed partial class TransferQueueViewModel : ObservableObject
[ObservableProperty] private double _overallProgress;
[ObservableProperty] private bool _hasOverallProgress;
public TransferQueueViewModel(TransferQueue queue, UiPreferencesStore preferences)
public TransferQueueViewModel(ITransferHost queue, UiPreferencesStore preferences)
{
_queue = queue;
_preferences = preferences;