Skip to content
styletronixPublic

About

C# Cloud Sync Engine using cloud files API introduced in Windows 10.

Topics

Resources

Stars

69 stars

Watchers

7 watching

Forks

Latest commit

 

History

43 Commits

Folders and files

Repository files navigation

cfapiSync

cfapiSync is an experimental C# synchronization engine for Windows 10 and 11. It uses the Windows Cloud Files API (CFAPI) to show remote files as placeholders and download their contents on demand. The included WinForms application runs the provider for the current Windows user.

Build and run

Open ProjFS TEST.sln in Visual Studio and restore the NuGet packages. Both projects target .NET Framework 4.8. To build from a Visual Studio Developer PowerShell:

msbuild 'ProjFS TEST.sln' -restore -p:Configuration=Debug

Open the GUI, choose a server folder and a separate local sync folder on NTFS, then click Start. With command-line arguments, the GUI starts the provider automatically:

& '.\CfapiSync GUI\bin\Debug\CfapiSync GUI.exe' /serverpath 'C:\SyncTest\server' /localpath 'C:\SyncTest\client' /caption 'cfapiSync Test'

For a first run, use two test folders and put a few sample files in the server folder. Sync (Full) requests a reconciliation with the server. Stop disconnects the provider. Unregister stops the provider and removes the Windows sync-root registration.

Providers and synchronization

  • SyncProvider registers the local sync root, handles CFAPI callbacks, and reconciles local and server changes.
  • IServerFileProvider defines how a backend lists entries, supplies metadata and file ranges, receives uploads, and reports changes.
  • LocalNetworkServerProvider supports a local directory or a UNC share. It uses FileSystemWatcher for change detection and periodically requests a full reconciliation. For prompt change detection on a UNC share, use a share that delivers compatible file change notifications. DFS paths may require using the direct server share.

The provider can create placeholders from server entries without downloading their content. Opening or pinning a placeholder can hydrate it. Hydrated bytes are stored locally. Starting the provider updates an existing streaming-enabled registration so Windows can complete reads from the hydrated placeholder.

Full and partial uploads write to a temporary file before publishing the result. An aborted upload leaves the existing server copy intact. The local/UNC provider backs up replaced and deleted server files under $Recycle.bin. The sync engine also backs up fully available local files before replacing them in a conflict.

Server-side renames and deletions follow the corresponding Windows completion callback. Failed operations can be retried while the process is running. An incomplete server listing is discarded so missing entries from that listing cannot be treated as deletions.

Current limitations

  • WebDAV, WebDAV Sync (REPORT sync-collection), and Amazon S3 backends are planned or under consideration. The included provider uses local or UNC paths.
  • Retry queues are held in memory. If the process exits after a local deletion but before the corresponding server deletion, the server copy can reappear as a placeholder during the next full reconciliation. The original server path can similarly reappear after an interrupted rename.
  • A simulated CFAPI cancellation reaches the matching server read, and stopping the provider cancels an active download. End-to-end cancellation from a Windows client remains unverified because Windows did not deliver CANCEL_FETCH_DATA in the tested scenario.
  • The stabilization changes were tested with a real Windows CFAPI sync root and a local NTFS server folder. The tests covered hydration, uploads and backups, rename and delete propagation, retry after a locked server file, incomplete listings, and restarting the provider. UNC and Office-specific save workflows still need end-to-end testing.

About

C# Cloud Sync Engine using cloud files API introduced in Windows 10.

Topics

Resources

Stars

69 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages