Home

Awesome

cfapiSync

Working c# Example implementig a Cloud Sync Engine on Windows 10 / 11 based on the cloud files API.

This is very early alpha... And also my very first project written entirely in c#.

It uses the content of folder "d:\temp" as the server source and creates a OneDrive Style sync folder for the current user.

Bi-directional synchronization is supported as long as the Server is able to notify the client of file changes. The ServerProvider is implemented as an Interface to allow easy adaption to other cloud sources.

There are lot things to do, but at least for lokal folders it seems to be fully functional with sometimes an "uupppsss...."

Short Explanation of the Components

SyncProvider

The SyncProvider is the core function which handles all synchronization logic and monitoring of the local files.

ServerProvider

The ServerProvider uses the IServerProvider Interface to communicate with the SyncProvider. The ServerProvider is ued to connect to the cloud. For each cloud type, a new ServerProvider is required.

Available ServerProviders

Planned ServerProviders

Supported Sources:

Planed:

Current issues:

Word and Excel drives me crazy. The way files are handled by office apps are absolutely not easy to handle in sync scenarios in realtime. The chance is high, that local changes to a word file triggers a local delete request while word trnsfers the temp file to the actual existing word document. While the delete request is processed on the server, the server may retrigger the delete to all clients which will result in deletion of the word document on all clients.

Maybe i should in general not handle any delete request in realtime. It may be much saver to add all delete rquests to a queue wich is then checked few minutes later by the full sync algorithm for the given directory. Also it does not seem to be relieble to handle each file request in cloud scenario as a single task... In some situations it seems to be more relieable to revalidate the entire directory where changes occured.... Changes to an entire directory triggers one request to the server with response of the folder content while several files are producing multiple request to the server vor a single directory. So whats better? Muliple smal requests or one request with larger amount of data?

TODO:

Changes:

11-07.2021

11-03-2021

Notes on FileSystemWatcher

To enable realtime Monitoring of changed files on Server. The ServerProvider for local and UNC Paths is using FileSystemWatcher. UNC Paths, hostet on Windows can be realtime monitored with FileSystemWatcher. But there are a few exceptions. If the UNC Path is a DFS-Path, the realtime Monitoring won't work. In this case, set the UNC Path not to DFS-Path, but to the direct Server path. In other projects, I used functions to get the Server path, based on the DFS-Root to set Monitoring to that location. But this is not available in the current impementation of the ServerProvider.

Workflow of CfapiSync

First start

New local files

Changes to local files

Changes to remote File

If local file is PINNED and server file is newer

If local file is not Pinned but Hydrated

If local file is not Pinned and also Dehydrated

If local file does not exist

If local Folder does not contain any pinned or hydrated placeholders