Deficuet.APFS 0.0.1-alpha.11

This is a prerelease version of Deficuet.APFS.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Deficuet.APFS --version 0.0.1-alpha.11
                    
NuGet\Install-Package Deficuet.APFS -Version 0.0.1-alpha.11
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Deficuet.APFS" Version="0.0.1-alpha.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Deficuet.APFS" Version="0.0.1-alpha.11" />
                    
Directory.Packages.props
<PackageReference Include="Deficuet.APFS" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Deficuet.APFS --version 0.0.1-alpha.11
                    
#r "nuget: Deficuet.APFS, 0.0.1-alpha.11"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Deficuet.APFS@0.0.1-alpha.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Deficuet.APFS&version=0.0.1-alpha.11&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Deficuet.APFS&version=0.0.1-alpha.11&prerelease
                    
Install as a Cake Tool

APFS — AzurPromilia Package File System

A read-only virtual file system for game asset packages, built on ROVFS (and therefore WinFsp). APFS is the data manager implementation: it maps a JSON-describable asset tree onto flat, case-insensitive lookup maps and serves reads from segmented package files.

Concepts

Type Role
SegmentedFileData Population-phase file entry: the physical segment (PackageName, ResSubPath, PathType, Offset, Size). It carries no virtual-name metadata — the caller computes the final file name. Immutable; equality is physical identity only.
SegmentedFileEntry Finalized file entry that is persisted in the JSON: PackageName, ResSubPath, PathType, Offset, Size, IndexNumber. Only physical fields survive.
DirectoryData Population-phase (intermediate) directory node holding Files (SegmentedFileData per formal name), Aliases (lookup-only paths per file key) and Directories, all in case-insensitive dictionaries.
DirectoryView Static (final) directory: natural-sort-ordered EntryInfo<string>[]; the case-insensitive name→index map is derived from it and rebuilt after deserialization. Win32 wildcard matching is built in.
AzurPromiliaFileDataManager The ROVFS data manager: path resolution, directory contexts, backing file handles, and FileInfo assembly.

Population workflow

The manager follows a populate first, mount once, never modify lifecycle. Entry and directory objects are created outside this project; after population they are handed to the manager, and the manager can be serialized to / deserialized from JSON (also outside this project) for persistence.

  1. Create a root DirectoryData instance acting as the volume root.

  2. For every file call root.AddFile(path, entry, alias). path is one or more formal paths (at least one is required), alias is zero or more lookup-only alias paths and may be omitted. Every path is relative to the node, separated by / or \, and never starts or ends with a separator; missing intermediate directories are created implicitly (case-insensitively merged).

    The caller owns the virtual names: the final file name — including any uniqueness suffix — must already be in the formal path. Nothing is rewritten or suffixed here:

    var hero = new SegmentedFileData(
        packageName: "pkg001",
        resSubPath: "characters/hero/hero.bin",
        pathType: PathType.Static,
        offset: 0,
        size: 1048576);
    
    root.AddFile(
        new[]
        {
            "characters/hero/hero.bin$3f2a9c1d_42.bin",            // formal path (enumerated)
            "__per_pkg/pkg001/characters/hero/hero.bin$3f2a9c1d_42.bin", // per-package mirror (enumerated)
        },
        hero,
        new[] { "characters/hero/hero.bin" });                     // alias (lookup only)
    

    The same physical entry may be added under several formal paths (for example a normal path and a per-package mirror); AddFileTree collapses those occurrences, like hard links. Aliases are attached to the entry and never create entries of their own, so an entry always needs at least one formal path.

  3. Call manager.AddFileTree(root). This traverses the tree breadth-first, finalizes every node into a DirectoryView, assigns a unique IndexNumber to every directory and every unique physical entry, accumulates TotalSize once per unique entry, and fills the flat maps:

    • PathFileMap[fullPath] = index for every formal path (all paths of one entry share the index);
    • Entries[index] is the finalized SegmentedFileEntry;
    • after every formal path is indexed, each alias path is normalized (/ → \, because that is the form WinFsp passes in), prefixed with its node path and added to PathFileMap only. An alias is therefore never in a DirectoryView and never shows up in a directory listing; a path already indexed by a different entry is logged and skipped, and an alias whose parent directory does not exist is logged as a warning.
  4. Mount. AddFileTree may be called exactly once; the internal maps must not be modified afterwards.

Full paths are rooted at \ and use \ separators — exactly the form WinFsp passes to the file system, regardless of whether the volume is mounted on a drive letter or into a folder.

All lookups use StringComparer.OrdinalIgnoreCase dictionaries, matching the case-insensitive volume flag applied by ROVFS. TryCheckNodeExists checks directories before files, so an alias can never shadow a real folder.

Formal paths vs. alias paths

Formal path Alias path
Passed as path array (AddFile) alias array (AddFile)
Lives in DirectoryView yes no
Visible to ReadDirectory / Explorer listing yes no
Resolvable by exact path (GetSecurityByName, Open) yes yes
Creates an entry yes (first occurrence) never
Creates directories yes (implicitly) never

Both kinds end up as keys of the same PathFileMap pointing at one Entries[i]; the only difference is that a formal path also contributed an EntryInfo to its DirectoryView. Because aliases create no directories, an alias may name a path whose parent folder does not exist — the file stays openable by its exact path but the folder itself is not browsable (this is logged as a warning at build time).

Persisted JSON shape

AzurPromiliaFileDataManager persists PathFileMap (path → int), PathDirectoryMap (path → DirectoryView) and Entries (SegmentedFileEntry[]). DirectoryView.EntryIndexMap is [JsonIgnore] and rebuilt in [OnDeserialized], so it is not part of the file. The JSON has no schema version: after changing the manager's shape, delete and rebuild the file.

Backing files

PathType Physical location
Static {RootDirectoryPath}\StreamingAssets\.res\{PackageName}\{ResSubPath}
Cache {RootDirectoryPath}\.res\{PackageName}\BundleFiles\{ResSubPath}

RootDirectoryPath must not end with a separator. It is not part of the persisted JSON state ([JsonIgnore]): the host supplies it after deserialization (the APFS service passes it on the command line). Handles are opened read-only with FILE_FLAG_OVERLAPPED, so multiple segments of the same package can be read concurrently through independent handles. A missing or unreadable backing file is logged and mapped to a Win32-derived NT status.

Mounting example

var manager = new AzurPromiliaFileDataManager
{
    RootDirectoryPath = rootDirectoryPath, // supplied by the host; not persisted in JSON
    GlobalTimestamp = volumeCreationFileTime,
};
manager.PackageTimestampMap["pkg001"] = packageFileTime;
manager.AddFileTree(root); // populated tree from the steps above

var fileSystem = new ReadOnlyFileSystem<
    SegmentedFileEntry, DirectoryView, SafeFileHandle, string, string>(manager);
var host = new FileSystemHost(fileSystem);
host.Mount("X:"); // or host.Mount(@"C:\Some\NotYetExisting\Folder");

Dependencies

  • Deficuet.ROVFS 0.0.1-alpha.16
  • NaturalSort.Extension 4.4.1
  • Newtonsoft.Json 13.0.4 (used for the [JsonIgnore] / [OnDeserialized] annotations)
  • System.Text.Encoding.CodePages 8.0.0
  • WinFsp 2.1 must be installed on the machine.

Both libraries target netstandard2.0; Deficuet.ROVFS transitively brings in System.Memory, which Unity consumers must also ship.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1-alpha.14 46 11/25/2026
0.0.1-alpha.13 48 11/25/2026
0.0.1-alpha.12 42 11/25/2026
0.0.1-alpha.11 52 11/25/2026
0.0.1-alpha.10 73 10/27/2026
0.0.1-alpha.9 69 10/23/2026
0.0.1-alpha.8 70 10/20/2026
0.0.1-alpha.7 66 10/18/2026
0.0.1-alpha.6 68 10/16/2026
0.0.1-alpha.5 63 10/15/2026
0.0.1-alpha.4 106 9/13/2026
0.0.1-alpha.3 88 9/13/2026
0.0.1-alpha.2 102 9/8/2026
0.0.1-alpha.1 93 9/8/2026