|
FileSurfer 2.1.2
Cross-platform file manager with support for Git and SFTP
|
FileSurfer is a cross-platform file manager built with Avalonia UI and ReactiveUI, targeting Windows and Linux on .NET 8.0. This page gives a high-level orientation to the codebase. For member-level detail, browse the generated class list and namespace index; this page focuses on how the pieces fit together.
The solution FileSurfer.sln consists of three projects: one shared library containing most of the application logic, and two thin platform-specific executable projects.
| Project | Responsibility |
|---|---|
| FileSurfer.Core | Platform-independent logic: business logic, ViewModels, and Views |
| FileSurfer.Linux | Linux-specific functionality and the application entry point (Main) |
| FileSurfer.Windows | Windows-specific functionality and the application entry point (Main) |
Both platform projects reference FileSurfer.Core and produce an executable named FileSurfer. FileSurfer.Core has no dependency on either platform project — all platform selection is resolved through a single interface, IPlatformBootstrap (see Central Abstractions).
Namespaces in FileSurfer.Linux and FileSurfer.Windows mirror those of FileSurfer.Core, containing only the classes required by the respective platform. The namespaces below belong to FileSurfer.Core.
Models and Services together form the Model layer of MVVM, split to separate data representation from behavior.
IPlatformBootstrap decouples the shared logic from platform specifics. Each platform project implements it and assigns an instance to the static App.Bootstrap before Avalonia startup. It builds the main ViewModel and supplies a platform-specific default settings provider. Platform services are then injected into shared classes through interfaces such as IFileIoHandler (implemented by LinuxFileIoHandler / WindowsFileIoHandler).
IFileSystem is the central abstraction for file system interaction. It is a facade combining file information retrieval, icon provision, archive management, file operations, trash handling, file properties, shell command execution, and Git integration.
A Location pairs a directory path with the IFileSystem instance it belongs to, letting ViewModels treat local and remote directories uniformly. Path manipulation is abstracted behind IPathTools, with LocalPathTools for native paths and RemoteUnixPathTools for POSIX-style SFTP paths.
Expected failure conditions are represented via IResult (success flag plus error messages) rather than exceptions, with ValueResult<T> additionally carrying a return value on success. Exceptions from underlying libraries are caught and converted to IResult at the lowest implementation levels; exceptions from programmer errors (null references, invalid arguments) propagate normally.
Implemented with the command pattern. FileOperation provides a shared execution pipeline (iteration over targeted entries, progress reporting, cancellation); UndoableFileOperation extends it with an inverse execution method. Concrete undoable operations include move, copy, duplicate, move to trash, batch rename, flatten directory, and create file/directory. Deletion is a plain (non-undoable) FileOperation. UndoRedoHandler<T> stores the history of executed undoable operations.
IClipboardManager (ClipboardManager) coordinates an internal clipboard and the OS clipboard, tracking metadata the OS clipboard cannot represent (source file system, copy vs. cut). It depends on IOsClipboardProxy (AvaloniaClipboardProxy) to stay synchronized with the OS clipboard when entries originate from the local file system. On paste, if OS clipboard content no longer matches what was last stored, the source is assumed external and the operation defaults to copy.
Built on SSH.NET's SSH/SFTP client classes. SftpConnection models connection parameters and credentials; SftpFileSystemFactory constructs the corresponding SftpFileSystem. Separate classes handle file information retrieval, file transfer, and file property access over SFTP, plus a shell handler for commands over the SSH channel. LocalToSftpSynchronizer handles directory synchronization between a local and a remote location.
IGitIntegration (LocalGitIntegration, backed by LibGit2Sharp) detects whether a local location belongs to a repository and exposes entry/directory status and ahead/behind counts relative to the tracked remote branch. It supports staging/unstaging, committing, branch switching, and fetch/pull/push. Only local repositories are supported; SFTP-hosted repositories use a stub IGitIntegration implementation.
MainWindowViewModel holds the primary application state (current Location, displayed entries, navigation history) and exposes it via ReactiveUI's ReactiveObject/IObservable mechanisms. Its command handling logic lives in a separate partial class file, split from initialization and property declarations. Additional ViewModels cover the properties window, settings window, individual SFTP connections, the directory synchronizer, individual file system entries, and sidebar entries. ViewLocator resolves the View for a given ViewModel, avoiding explicit wiring between the two layers.