Class FtpBaseServer
The base class used for all FTP server specific support. You may extend this class to implement support for custom FTP servers.
public abstract class FtpBaseServer
- Inheritance
-
FtpBaseServer
- Inherited Members
- Extension Methods
Constructors
FtpBaseServer()
protected FtpBaseServer()
Methods
AfterConnected(FtpClient)
Perform server-specific post-connection commands here. Return true if you executed a server-specific command.
public virtual void AfterConnected(FtpClient client)
Parameters
client
FtpClient
AfterConnectedAsync(AsyncFtpClient, CancellationToken)
Perform server-specific post-connection commands here. Return true if you executed a server-specific command.
public virtual Task AfterConnectedAsync(AsyncFtpClient client, CancellationToken token)
Parameters
client
AsyncFtpClienttoken
CancellationToken
Returns
AlwaysReadToEnd(string)
Always read to end of stream on a download If you are unsure, return false.
public virtual bool AlwaysReadToEnd(string remotePath)
Parameters
remotePath
string
Returns
CalculateFullFtpPath(BaseFtpClient, string, FtpListItem)
Get the full path of a given FTP Listing entry Return null indicates custom code decided not to handle this
public virtual bool? CalculateFullFtpPath(BaseFtpClient client, string path, FtpListItem item)
Parameters
client
BaseFtpClientpath
stringitem
FtpListItem
Returns
- bool?
CreateDirectory(FtpClient, string, string, bool)
Perform server-specific create directory commands here. Return true if you executed a server-specific command.
public virtual bool CreateDirectory(FtpClient client, string path, string ftppath, bool force)
Parameters
Returns
CreateDirectoryAsync(AsyncFtpClient, string, string, bool, CancellationToken)
Perform async server-specific create directory commands here. Return true if you executed a server-specific command.
public virtual Task<bool> CreateDirectoryAsync(AsyncFtpClient client, string path, string ftppath, bool force, CancellationToken token)
Parameters
client
AsyncFtpClientpath
stringftppath
stringforce
booltoken
CancellationToken
Returns
DefaultCapabilities()
Return your FTP server's default capabilities. Used if your server does not broadcast its capabilities using the FEAT command.
public virtual string[] DefaultCapabilities()
Returns
- string[]
DeleteDirectory(FtpClient, string, string, bool, FtpListOption)
Perform server-specific delete directory commands here. Return true if you executed a server-specific command.
public virtual bool DeleteDirectory(FtpClient client, string path, string ftppath, bool deleteContents, FtpListOption options)
Parameters
client
FtpClientpath
stringftppath
stringdeleteContents
booloptions
FtpListOption
Returns
DeleteDirectoryAsync(AsyncFtpClient, string, string, bool, FtpListOption, CancellationToken)
Perform async server-specific delete directory commands here. Return true if you executed a server-specific command.
public virtual Task<bool> DeleteDirectoryAsync(AsyncFtpClient client, string path, string ftppath, bool deleteContents, FtpListOption options, CancellationToken token)
Parameters
client
AsyncFtpClientpath
stringftppath
stringdeleteContents
booloptions
FtpListOptiontoken
CancellationToken
Returns
DetectBySyst(string)
Return true if your server is detected by the given SYST response message. Its a fallback method if the server did not send an identifying welcome message.
public virtual bool DetectBySyst(string message)
Parameters
message
string
Returns
DetectByWelcome(string)
Return true if your server is detected by the given FTP server welcome message.
public virtual bool DetectByWelcome(string message)
Parameters
message
string
Returns
DontUseMdtmEvenIfCapable(string)
Disable MDTM command even if server says it is supported
public virtual bool DontUseMdtmEvenIfCapable(string path)
Parameters
path
string
Returns
DontUseSizeEvenIfCapable(string)
Disable SIZE command even if server says it is supported
public virtual bool DontUseSizeEvenIfCapable(string path)
Parameters
path
string
Returns
FileExists(FtpClient, string)
Check for existence of a file Return null indicates custom code decided not to handle this
public virtual bool? FileExists(FtpClient client, string path)
Parameters
Returns
- bool?
FileExistsAsync(AsyncFtpClient, string, CancellationToken)
Check for existence of a file Return null indicates custom code decided not to handle this
public virtual Task<bool?> FileExistsAsync(AsyncFtpClient client, string path, CancellationToken token)
Parameters
client
AsyncFtpClientpath
stringtoken
CancellationToken
Returns
GetAbsoluteDir(FtpClient, string)
Perform server-specific path modification here. Return the absolute dir.
public virtual string GetAbsoluteDir(FtpClient client, string path)
Parameters
Returns
GetAbsoluteDirAsync(AsyncFtpClient, string, CancellationToken)
Perform server-specific path modification here. Return the absolute path.
public virtual Task<string> GetAbsoluteDirAsync(AsyncFtpClient client, string path, CancellationToken token)
Parameters
client
AsyncFtpClientpath
stringtoken
CancellationToken
Returns
GetAbsoluteFilePath(FtpClient, string, string)
Perform server-specific path modification here. Return concatenation of path and filename
public virtual string GetAbsoluteFilePath(FtpClient client, string path, string fileName)
Parameters
Returns
GetAbsoluteFilePathAsync(AsyncFtpClient, string, string, CancellationToken)
Perform server-specific path modification here. Return concatenation of path and filename
public virtual Task<string> GetAbsoluteFilePathAsync(AsyncFtpClient client, string path, string fileName, CancellationToken token)
Parameters
client
AsyncFtpClientpath
stringfileName
stringtoken
CancellationToken
Returns
GetAbsolutePath(FtpClient, string)
Perform server-specific path modification here. Return the absolute path.
public virtual string GetAbsolutePath(FtpClient client, string path)
Parameters
Returns
GetAbsolutePathAsync(AsyncFtpClient, string, CancellationToken)
Perform server-specific path modification here. Return the absolute path.
public virtual Task<string> GetAbsolutePathAsync(AsyncFtpClient client, string path, CancellationToken token)
Parameters
client
AsyncFtpClientpath
stringtoken
CancellationToken
Returns
GetFileSize(FtpClient, string)
Perform server-specific file size fetching commands here. Return the file size in bytes.
public virtual long GetFileSize(FtpClient client, string path)
Parameters
Returns
GetFileSizeAsync(AsyncFtpClient, string, CancellationToken)
Perform server-specific file size fetching commands here. Return the file size in bytes.
public virtual Task<long> GetFileSizeAsync(AsyncFtpClient client, string path, CancellationToken token)
Parameters
client
AsyncFtpClientpath
stringtoken
CancellationToken
Returns
GetParser()
Return the default file listing parser to be used with your FTP server.
public virtual FtpParser GetParser()
Returns
IsAbsolutePath(string)
Return true if the path is an absolute path according to your server's convention.
public virtual bool IsAbsolutePath(string path)
Parameters
path
string
Returns
IsCustomCalculateFullFtpPath()
Return true if your server requires custom handling to handle listing analysis.
public virtual bool IsCustomCalculateFullFtpPath()
Returns
IsCustomFileExists()
Return true if your server requires custom handling to check file existence.
public virtual bool IsCustomFileExists()
Returns
IsCustomFileSize()
Return true if your server requires custom handling of file size.
public virtual bool IsCustomFileSize()
Returns
IsCustomGetAbsoluteDir()
Return true if your server requires custom handling of absolute dir.
public virtual bool IsCustomGetAbsoluteDir()
Returns
IsCustomGetAbsoluteFilePath()
Return true if your server requires custom handling of path and filename concatenation.
public virtual bool IsCustomGetAbsoluteFilePath()
Returns
IsCustomGetAbsolutePath()
Return true if your server requires custom handling of absolute paths.
public virtual bool IsCustomGetAbsolutePath()
Returns
IsRoot(BaseFtpClient, string)
Check if the given path is a root directory on your FTP server. If you are unsure, return false.
public virtual bool IsRoot(BaseFtpClient client, string path)
Parameters
client
BaseFtpClientpath
string
Returns
RecursiveList()
Detect if your FTP server supports the recursive LIST command (LIST -R). If you know for sure that this is supported, return true here.
public virtual bool RecursiveList()
Returns
SkipParserErrorReport()
Skip reporting a parser error
public virtual bool SkipParserErrorReport()
Returns
ToEnum()
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
public virtual FtpServer ToEnum()