ComparisonDifference.Resolve Method

Resolves the difference represented by ComparisonDifference instance by appropriately updating the local or remote files.

Syntax

C#
public FileOperationEventArgs Resolve(
    Session session,
    TransferOptions options = null
)
VB.NET
Public Function AddRawSettings(
    session As Session,
    options As TransferOptions = Nothing
) As FileOperationEventArgs

Parameters

Name Description
Session session The session to use for resolving the difference. It can be a different instance of Session than the one used with Session.CompareDirectories to find the difference. Though it should be opened with the same session settings. The method can also be called on a different thread.
TransferOptions options Transfer options. The options should be the same as those used with Session.CompareDirectories to find the difference. Defaults to null, what is an equivalent to new TransferOptions().

Return Value

When the difference is resolved by a transfer of a file, returns TransferEventArgs.

When the difference is resolved by a removal of a remote file, returns RemovalEventArgs.

Otherwise returns null (this can be changed in future versions of the assembly).

Exceptions

Exception Condition
InvalidOperationException Session is not opened.
ArgumentNullException session is null.
ArgumentException
ArgumentOutOfRangeException
Invalid combination of values of TransferOptions properties.
SessionLocalException Error communicating with winscp.com.
See the exception documentation for details.
SessionRemoteException Session has failed.
Transfer of files has failed.
Removal of remote files has failed.
See the exception documentation for details.
DirectoryNotFoundException
IOException
PathTooLongException
UnauthorizedAccessException
Removal of local files has failed.
TimeoutException Timeout waiting for winscp.com to respond.

Remarks

According to the Action of the difference, calls methods like Session.PutFileToDirectory, Session.GetFileToDirectory, Session.RemoveFile, File.Delete, etc. If appropriate, it returns their results.

The method can be used as a replacement for Session.SynchronizeDirectories, to synchronize only selected differences or for custom error handling.

Examples

Real-Life Examples

Last modified: by martin