Class FluentFtpWrapper
- Namespace
- SunamoFluentFtp.FtpClients
- Assembly
- SunamoFluentFtp.dll
Wrapper for FluentFTP client providing high-level FTP operations. Elements of this class are made public because their parent elements must be at most internal. Therefore they cannot be public here.
public class FluentFtpWrapper : FtpBaseNewFluentFtp
- Inheritance
-
FluentFtpWrapper
- Inherited Members
- Extension Methods
Properties
Adds
Additional functionality for the FTP client
public FluentFtpAdds Adds { get; set; }
Property Value
Client
The FluentFTP client instance
public FtpClient? Client { get; set; }
Property Value
- FtpClient
Methods
ChdirLite(string)
Changes directory (lite version, must be here due to interface)
public override void ChdirLite(string directoryName)
Parameters
directoryNamestringDirectory name
Connect()
Connects to the FTP server
public override void Connect()
CreateDirectoryIfNotExists(string)
Creates a directory if it doesn't exist
public override void CreateDirectoryIfNotExists(string directoryName)
Parameters
directoryNamestringName of the directory to create
Debug(string, string, params object[])
Debug method with custom message
public override void Debug(string what, string text, params object[] args)
Parameters
whatstringType of debug information
textstringDebug message text
argsobject[]Optional format arguments
DebugActualFolder()
Debugs the current working directory
public override void DebugActualFolder()
DebugAllEntries()
Debugs all directory entries
public override void DebugAllEntries()
DebugDirChmod(string)
Debugs directory permissions
public override void DebugDirChmod(string directory)
Parameters
directorystringDirectory path
DeleteRecursively(List<string>, string, int, List<DirectoriesToDeleteFluentFtp>)
Deletes directory recursively
public override void DeleteRecursively(List<string> excludedDirectories, string directoryName, int depth, List<DirectoriesToDeleteFluentFtp> directoriesToDelete)
Parameters
excludedDirectoriesList<string>Directories to exclude from deletion
directoryNamestringName of the directory to delete
depthintRecursion depth
directoriesToDeleteList<DirectoriesToDeleteFluentFtp>List of directories to delete
DeleteRemoteFile(string)
Deletes a remote file
public override bool DeleteRemoteFile(string fileName)
Parameters
fileNamestringName of the file to delete
Returns
- bool
True if successful
Dispose()
Disposes the FTP client. IDisposable cannot be here - since it is in _sunamo, it must be internal. Therefore it is here as internal override.
public override void Dispose()
Download(string, string, bool)
Downloads a file from remote to local
public override bool Download(string remoteFileName, string localFileName, bool isDeleteLocalIfExists)
Parameters
remoteFileNamestringRemote file name
localFileNamestringLocal file name
isDeleteLocalIfExistsboolWhether to delete local file if it exists
Returns
- bool
True if successful
GetFSEntriesListRecursively(List<string>)
Gets filesystem entries list recursively
public override Dictionary<string, List<string>>? GetFSEntriesListRecursively(List<string> excludedDirectories)
Parameters
Returns
- Dictionary<string, List<string>>
Dictionary of directories and their contents
GetFileSize(string)
Gets the size of a file
public override long GetFileSize(string fileName)
Parameters
fileNamestringName of the file
Returns
- long
File size in bytes
GoToPath(string)
Navigates to specified path. In FluentFTP this is not strictly necessary but maintained for interface compatibility.
public override void GoToPath(string remotePath)
Parameters
remotePathstringPath on the hosting server
GoToUpFolder()
Navigates to parent folder
public override void GoToUpFolder()
GoToUpFolderForce()
Forces navigation to parent folder
public override void GoToUpFolderForce()
ListDirectoryDetails()
Lists directory details
public override List<string>? ListDirectoryDetails()
Returns
LoginIfIsNot(bool)
Logs in if not already logged in
public override void LoginIfIsNot(bool isStartup)
Parameters
isStartupboolWhether this is a startup login
Mkdir(string)
Creates a directory
public override bool Mkdir(string directoryName)
Parameters
directoryNamestringName of the directory
Returns
- bool
True if successful
RenameRemoteFile(string, string)
Renames a remote file
public override void RenameRemoteFile(string oldFileName, string newFileName)
Parameters
Rmdir(List<string>, string)
Removes a directory
public override bool Rmdir(List<string> excludedDirectories, string directoryName)
Parameters
excludedDirectoriesList<string>Directories to exclude from operation
directoryNamestringName of the directory to remove
Returns
- bool
True if successful
TestBasicFunctionality()
Tests basic FTP functionality
public void TestBasicFunctionality()
UploadFile(string)
Uploads a file to the server
public override Task UploadFile(string path)
Parameters
pathstringLocal file path