Class FtpAbstract
Abstract base class for FTP client implementations
public abstract class FtpAbstract
- Inheritance
-
FtpAbstract
- Derived
- Inherited Members
- Extension Methods
Properties
ExceptionCount
Number of exceptions for single operation. Ideal for counting up to 3 and then canceling entire operation.
protected int ExceptionCount { get; set; }
Property Value
FolderSizeRecursive
Total folder size calculated recursively
public ulong FolderSizeRecursive { get; set; }
Property Value
IsInitialLogin
Indicates if this is startup phase
protected bool IsInitialLogin { get; set; }
Property Value
IsLoggedIn
Indicates whether user is logged in
public bool IsLoggedIn { get; set; }
Property Value
MainWindow
Extended FTP client interface for application-specific operations
public IFtpClientExt MainWindow { get; set; }
Property Value
MaxExceptionCount
Maximum allowed exception count before operation is canceled
protected int MaxExceptionCount { get; set; }
Property Value
PathSelector
Path selector for managing FTP paths. Public only for Ftp class.
public PathSelector PathSelector { get; set; }
Property Value
ReallyUpload
If set to false, nothing will be uploaded to hosting. Used only in this class, everything else will work normally.
public bool ReallyUpload { get; set; }
Property Value
RemoteHost
Remote host address
public string RemoteHost { get; set; }
Property Value
RemotePass
Password for user authentication (sent with PASS command)
public string RemotePass { get; set; }
Property Value
RemotePort
Remote server port number
public int RemotePort { get; set; }
Property Value
RemoteUser
Username attempting to login (used with USER command)
public string RemoteUser { get; set; }
Property Value
Methods
ChdirLite(string)
Changes current directory on FTP server (lightweight version)
public abstract void ChdirLite(string directoryName)
Parameters
directoryNamestringDirectory name to change to
Connect()
Establishes connection to the FTP server
public abstract void Connect()
CreateDirectoryIfNotExists(string)
Creates a directory on FTP server if it doesn't already exist
public abstract void CreateDirectoryIfNotExists(string directoryName)
Parameters
directoryNamestringDirectory name to create
DebugActualFolder()
Debug output for current folder path
public abstract void DebugActualFolder()
DeleteRecursively(List<string>, string, int, List<DirectoriesToDeleteFtp>)
Recursively deletes directories and their contents from FTP server
public abstract void DeleteRecursively(List<string> foldersToSkip, string directoryName, int depth, List<DirectoriesToDeleteFtp> directoriesToDelete)
Parameters
foldersToSkipList<string>List of folder names to skip during deletion
directoryNamestringRoot directory name to start deletion from
depthintCurrent recursion depth level
directoriesToDeleteList<DirectoriesToDeleteFtp>List to collect directories marked for deletion
DeleteRemoteFile(string)
Deletes a file from the FTP server
public abstract bool DeleteRemoteFile(string fileName)
Parameters
fileNamestringFile name to delete
Returns
- bool
True if file was deleted successfully
Download(string, string, bool)
Downloads a file from FTP server to local filesystem
public abstract bool Download(string remFileName, string locFileName, bool isDeleteLocalIfExists)
Parameters
remFileNamestringRemote file name on FTP server
locFileNamestringLocal file path to save to
isDeleteLocalIfExistsboolWhether to delete local file if it already exists
Returns
- bool
True if download was successful
GetFSEntriesListRecursively(List<string>)
Recursively gets all filesystem entries (files and directories) from FTP server
public abstract Dictionary<string, List<string>> GetFSEntriesListRecursively(List<string> foldersToSkip)
Parameters
Returns
- Dictionary<string, List<string>>
Dictionary mapping directory paths to lists of entry names
GetFileSize(string)
Gets the size of a file on the FTP server
public abstract long GetFileSize(string filename)
Parameters
filenamestringFile name to get size for
Returns
- long
File size in bytes
GetRemoteHost()
Gets remote host address
public string GetRemoteHost()
Returns
- string
Remote host address
GetRemotePort()
Gets port used for remote transfer
public int GetRemotePort()
Returns
- int
Port number
GoToPath(string)
Navigates to specified path on FTP server
public abstract void GoToPath(string remoteFolder)
Parameters
remoteFolderstringRemote folder path to navigate to
GoToUpFolder()
Navigates to parent folder on FTP server with validation
public abstract void GoToUpFolder()
GoToUpFolderForce()
Navigates to parent folder on FTP server (forced, no validation)
public abstract void GoToUpFolderForce()
ListDirectoryDetails()
Lists all entries (files and directories) in current FTP directory with details
public abstract List<string> ListDirectoryDetails()
Returns
LoginIfIsNot(bool)
Performs login to FTP server if not already logged in
public abstract void LoginIfIsNot(bool isInitialLogin)
Parameters
isInitialLoginboolIndicates if this is initial startup login
Mkdir(string)
Creates a directory on the FTP server
public abstract bool Mkdir(string directoryName)
Parameters
directoryNamestringDirectory name to create
Returns
- bool
True if directory was created successfully
RenameRemoteFile(string, string)
Renames a file on the FTP server
public abstract void RenameRemoteFile(string oldFileName, string newFileName)
Parameters
Rmdir(List<string>, string)
Removes a directory from the FTP server
public abstract bool Rmdir(List<string> foldersToSkip, string directoryName)
Parameters
foldersToSkipList<string>List of folder names to skip during deletion
directoryNamestringDirectory name to remove
Returns
- bool
True if directory was removed successfully
SetRemoteHost(string)
Sets remote host address
public void SetRemoteHost(string remoteHost)
Parameters
remoteHoststringRemote host address
SetRemotePass(string)
Sets remote password
public void SetRemotePass(string remotePass)
Parameters
remotePassstringPassword
SetRemotePort(int)
Sets remote server port
public void SetRemotePort(int remotePort)
Parameters
remotePortintPort number
SetRemoteUser(string)
Sets remote username
public void SetRemoteUser(string remoteUser)
Parameters
remoteUserstringUsername
WriteDebugLog(string, string, params object[])
Debug output method for logging FTP operations
public abstract void WriteDebugLog(string context, string text, params object[] args)