FileSystemLinkSynchronizer
Namespace: TagBites.IO
Assembly: TagBites.IO.dll
Product: TagBites.IO v. 2.0.0
Provides a synchronization mechanism for file systems.
public class FileSystemLinkSynchronizer : System.IDisposableInheritance: object → FileSystemLinkSynchronizer
Constructors
Section titled “Constructors”FileSystemLinkSynchronizer()
Section titled “FileSystemLinkSynchronizer()”public FileSystemLinkSynchronizer()Properties
Section titled “Properties”Enabled
Section titled “Enabled”Gets or sets a value indicating whether the synchronizer is enabled.
public bool Enabled { get; set; }Property Value
Section titled “Property Value”true if the synchronizer is enabled; otherwise, false.
Synchronized
Section titled “Synchronized”Gets a value indicating whether the files and directories are synchronized.
public bool? Synchronized { get; }Property Value
Section titled “Property Value”bool?
true if the files and directories are synchronized; otherwise, false. If no value is set, returns a null reference.
Methods
Section titled “Methods”Add(FileSystemStructureLink, DirectoryLink, FileSystemSynchronizeMode)
Section titled “Add(FileSystemStructureLink, DirectoryLink, FileSystemSynchronizeMode)”Adds a pair of links to the synchronization list with the specified mode.
public void Add(FileSystemStructureLink source, DirectoryLink destination, FileSystemSynchronizeMode mode)Parameters
Section titled “Parameters”sourceFileSystemStructureLink
The link to the source file or directory.destinationDirectoryLink
The link to the destination directory.modeFileSystemSynchronizeMode
The file system synchronization mode.
Dispose()
Section titled “Dispose()”public virtual void Dispose()Dispose(bool)
Section titled “Dispose(bool)”Releases all resources used by this.
protected void Dispose(bool disposing)Parameters
Section titled “Parameters”disposingbool
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
ForceSyncAsync()
Section titled “ForceSyncAsync()”Asynchronously forces synchronization.
public Task ForceSyncAsync()Returns
Section titled “Returns”The task object representing the asynchronous operation.
Remove(FileSystemStructureLink, DirectoryLink)
Section titled “Remove(FileSystemStructureLink, DirectoryLink)”Removes a pair of links from the synchronization list.
public bool Remove(FileSystemStructureLink source, DirectoryLink destination)Parameters
Section titled “Parameters”sourceFileSystemStructureLink
The link to the source file or directory.destinationDirectoryLink
The link to the destination directory.
Returns
Section titled “Returns”true if the pair was removed; otherwise, false.
WaitForSync()
Section titled “WaitForSync()”Waits for synchronization.
public void WaitForSync()WaitForSync(TimeSpan)
Section titled “WaitForSync(TimeSpan)”Waits for the synchronization to finish, up to the specified timeout.
public void WaitForSync(TimeSpan timeout)Parameters
Section titled “Parameters”timeoutTimeSpan
The synchronization timeout.
WaitForSync(int)
Section titled “WaitForSync(int)”Waits for the synchronization to finish, up to the specified timeout in milliseconds.
public void WaitForSync(int timeoutInMilliseconds)Parameters
Section titled “Parameters”timeoutInMillisecondsint
The synchronization timeout in milliseconds.
Events
Section titled “Events”SyncFailed
Section titled “SyncFailed”Occurs when a synchronization attempt fails.
public EventHandler<FileSystemLinkSyncFailedEventArgs> SyncFailedEvent Type
Section titled “Event Type”EventHandler<FileSystemLinkSyncFailedEventArgs>
Remarks
Section titled “Remarks”A failed pair is retried up to ten times before it is abandoned, and the event is raised for every attempt. Handlers run on the background synchronization thread, and an exception thrown by a handler is ignored so that it cannot stop the synchronizer.