Oakrey.Applications.FileBrowsing.Abstractions
6.0.0
dotnet add package Oakrey.Applications.FileBrowsing.Abstractions --version 6.0.0
NuGet\Install-Package Oakrey.Applications.FileBrowsing.Abstractions -Version 6.0.0
<PackageReference Include="Oakrey.Applications.FileBrowsing.Abstractions" Version="6.0.0" />
<PackageVersion Include="Oakrey.Applications.FileBrowsing.Abstractions" Version="6.0.0" />
<PackageReference Include="Oakrey.Applications.FileBrowsing.Abstractions" />
paket add Oakrey.Applications.FileBrowsing.Abstractions --version 6.0.0
#r "nuget: Oakrey.Applications.FileBrowsing.Abstractions, 6.0.0"
#:package Oakrey.Applications.FileBrowsing.Abstractions@6.0.0
#addin nuget:?package=Oakrey.Applications.FileBrowsing.Abstractions&version=6.0.0
#tool nuget:?package=Oakrey.Applications.FileBrowsing.Abstractions&version=6.0.0
Oakrey.Applications.FileBrowsing.Abstractions
A .NET 10 Windows library that defines the contracts and base classes for file browsing and selection services. It contains no UI or file-system scanning code and carries only minimal runtime dependencies, making it the correct reference for libraries and application layers that need to consume or extend file browsing without coupling to a concrete implementation.
Main features
Service interfaces
| Interface | Description |
|---|---|
IFileBrowsingService |
Core browsing contract: exposes the available file list, the selected file, and a reactive SelectedFileChanged observable |
IExtendedFileBrowsingService |
Extends IFileBrowsingService with file management operations: create, delete, edit, open folder in shell, and reload |
Settings interfaces and base class
| Type | Description |
|---|---|
IFileBrowsingServiceSettings |
Settings contract: folder path, file extension, search pattern, sub-folder scan toggle, last selected file, and a reactive FolderPathChanged observable |
IFileExtendedBrowsingServiceSettings |
Extends IFileBrowsingServiceSettings with NewFileTemplate for naming newly created files |
FileBrowsingServiceSettingsBase |
Abstract base class implementing IFileBrowsingServiceSettings via SettingsBase. Handles persistence, reactive folder-path notifications, and sensible defaults. Consumers must provide FileExtension and SearchPattern. |
Architecture
classDiagram
class IFileBrowsingService {
+AvailableFiles List~FileInfo~
+SelectedFile FileInfo?
+SelectedFileChanged IObservable~FileInfo?~
}
class IExtendedFileBrowsingService {
+CreateNewFile(name, ct) Task
+DeleteSelectedFile(ct) Task
+EditSelectedFile(ct) Task
+OpenFolder(ct) Task
+Reload(fileInfo)
+Reload()
}
class IFileBrowsingServiceSettings {
+FileExtension string
+FolderPath string
+FolderPathChanged IObservable~string~
+IncludeSubFolders bool
+LastSelectedFile string
+SearchPattern string
}
class IFileExtendedBrowsingServiceSettings {
+NewFileTemplate string
}
class FileBrowsingServiceSettingsBase {
<<abstract>>
+FileExtension string*
+SearchPattern string*
}
IExtendedFileBrowsingService --|> IFileBrowsingService
IFileExtendedBrowsingServiceSettings --|> IFileBrowsingServiceSettings
FileBrowsingServiceSettingsBase ..|> IFileBrowsingServiceSettings
FileBrowsingService ..|> IFileBrowsingService
ExtendedFileBrowsingService ..|> IExtendedFileBrowsingService
note for FileBrowsingService "Oakrey.Applications.FileBrowsing"
note for ExtendedFileBrowsingService "Oakrey.Applications.FileBrowsing.Extended"
Concrete implementations live in the separate Oakrey.Applications.FileBrowsing and
Oakrey.Applications.FileBrowsing.Extended packages. Consuming projects should reference
only this abstractions package and register the implementation via the extension methods
provided by those packages.
Requirements
- .NET 10 Windows (
net10.0-windows) or later System.Reactive6.1 or later � required forIObservablemembers on the interfacesOakrey.Log2.0 or laterOakrey.Applications.Abstractions� providesSettingsBaseandISettingsService
Installation
dotnet add package Oakrey.Applications.FileBrowsing.Abstractions
To also include the concrete implementation:
dotnet add package Oakrey.Applications.FileBrowsing
dotnet add package Oakrey.Applications.FileBrowsing.Extended
Configuration
Derive from FileBrowsingServiceSettingsBase to create a settings class for a specific
file type. The two abstract members that must be implemented are FileExtension and
SearchPattern.
public sealed class CsvBrowsingServiceSettings : FileBrowsingServiceSettingsBase
{
public CsvBrowsingServiceSettings(ISettingsService settingsService)
: base(settingsService)
{
}
public override string FileExtension => "csv";
public override string SearchPattern => "*.csv";
}
Register the settings and service in the DI container:
services.AddSingleton<IFileBrowsingServiceSettings, CsvBrowsingServiceSettings>();
services.AddFileBrowsingService();
Example usage
Consuming the abstraction
public sealed class FileViewModel
{
private readonly IFileBrowsingService _browser;
public FileViewModel(IFileBrowsingService browser)
{
_browser = browser;
_browser.SelectedFileChanged.Subscribe(file =>
{
if (file is not null)
{
Console.WriteLine($"Selected: {file.FullName}");
}
});
}
public IReadOnlyList<FileInfo> Files => _browser.AvailableFiles;
}
Using the extended service
await _extendedBrowser.CreateNewFile("report", cancellationToken);
await _extendedBrowser.DeleteSelectedFile(cancellationToken);
await _extendedBrowser.OpenFolder(cancellationToken);
Reacting to folder changes
settings.FolderPathChanged.Subscribe(newPath =>
{
Console.WriteLine($"Folder changed to: {newPath}");
});
settings.FolderPath = @"C:\Data\Reports";
Development notes
- This package contains only interfaces and the abstract settings base class. No file-system scanning, shell operations, or UI code is included.
FileBrowsingServiceSettingsBaseinherits fromSettingsBaseinOakrey.Applications.Abstractionsand usesISettingsServicefor value persistence. Values are stored and retrieved by caller member name viaGet<T>()/Set(value).- Reactive notifications (
SelectedFileChanged,FolderPathChanged) are backed bySystem.ReactiveSubject<T>instances and are exposed as coldIObservable<T>. - The target framework is
net10.0-windowsbecauseSystem.Reactiveincludes Windows-specific scheduler integrations used downstream. There is no direct WPF dependency in this package.
License
MIT � Copyright � Oakrey 2016-present
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Oakrey.Applications.Abstractions (>= 6.0.0)
- Oakrey.Log (>= 2.0.1)
- System.Reactive (>= 6.1.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Oakrey.Applications.FileBrowsing.Abstractions:
| Package | Downloads |
|---|---|
|
Oakrey.Applications.FileParsing.DBC
Specialized file parsing library for DBC (CAN database) files. Built on FileParsing framework with automatic parsing into DbcMatrix objects, reactive updates, and extended file management. Features CAN message/signal access, template support, and seamless integration with Oakrey.DBC parser. |
|
|
Oakrey.Applications.FileBrowsing
File browsing and selection management library for .NET applications. Features directory browsing with customizable search patterns, reactive file selection tracking, persistent settings, and WPF data binding support. Includes abstract base classes for creating specialized file browsers. |
|
|
Oakrey.Applications.FileParsing
Abstract framework for parsing files with automatic loading and reactive observable patterns. Provides base classes for building file-based services that automatically parse and monitor file changes. Features integration with file browsing, error handling with user prompts, and pre-loading support. |
GitHub repositories
This package is not used by any popular GitHub repositories.