Class FtpBase
public abstract class FtpBase : FtpAbstract
- Inheritance
-
FtpBase
- Derived
- Inherited Members
- Extension Methods
Constructors
FtpBase()
IK, OOP.
public FtpBase()
Methods
Download(string, string)
Downloads a file from FTP server to local filesystem (deletes local file if exists)
public void Download(string remFileName, string locFileName)
Parameters
ExistsFolder(string)
Checks if folder exists in current FTP directory
public bool ExistsFolder(string folder)
Parameters
folderstringFolder name (without path)
Returns
- bool
True if folder exists in current directory
GetActualPath()
Gets the current FTP path including host and port
public string GetActualPath()
Returns
- string
Full FTP path
GetActualPath(string)
Gets the FTP path for specified directory/file name appended to current path
public string GetActualPath(string directoryName)
Parameters
directoryNamestringDirectory or file name (not full path)
Returns
- string
Full FTP path including the specified name
GetFSEntriesListRecursively(List<string>, List<string>, Dictionary<string, List<string>>, string)
Recursively gets all filesystem entries from FTP server starting from specified folder. This is an internal method - call the 1-parameter overload instead.
public void GetFSEntriesListRecursively(List<string> foldersToSkip, List<string> visitedFolders, Dictionary<string, List<string>> result, string folderName)
Parameters
foldersToSkipList<string>List of folder names to skip during traversal
visitedFoldersList<string>List of already visited folder paths to avoid infinite loops
resultDictionary<string, List<string>>Dictionary to collect filesystem entries mapped by directory path
folderNamestringFolder name to start traversal from
OnNewStatus(string, params object[])
Raises the NewStatus event with specified message and parameters
public static void OnNewStatus(string text, params object[] args)
Parameters
OnNewStatusNewFolder()
Triggers status update notification for new folder navigation
public void OnNewStatusNewFolder()
OnUploadingNewStatus(string)
Triggers status update notification for file upload using safe method
public void OnUploadingNewStatus(string path)
Parameters
pathstringPath being uploaded
UploadFile(string)
Uploads file to current FTP directory. You must navigate to target folder before calling this method.
public void UploadFile(string filePath)
Parameters
filePathstringLocal source file path
UploadFile(string, string)
Uploads file to specified FTP folder path (allows uploading to different folder than current)
public bool UploadFile(string filePath, string actualFtpPath)
Parameters
Returns
- bool
True if file was uploaded successfully
UploadFileMain(string, string)
Upload file by FtpWebRequest OK STOR To upload a file to current folder and specify only file name on disk, use UploadFile method.
public virtual bool UploadFileMain(string path, string uploadPath)
Parameters
Returns
UploadFiles(List<string>)
Uploads only files that don't already exist in the current directory on FTP server
public bool UploadFiles(List<string> files)
Parameters
Returns
- bool
True if all files were uploaded successfully
UploadFolder(string, bool, IWorking)
Uploads a local folder to FTP server. After calling this method in FTP class, you must call GoToUpFolder to return to previous directory.
public bool UploadFolder(string localFolder, bool isFtpClass, IWorking working)
Parameters
localFolderstringLocal source folder path
isFtpClassboolIndicates if called from FTP class (requires GoToPath to restore)
workingIWorkingWorking state tracker to allow cancellation
Returns
- bool
True if folder was uploaded successfully
UploadFolderRek(string, IWorking)
Recursively uploads a local folder and all its contents to current FTP directory
public bool UploadFolderRek(string localFolder, IWorking working)
Parameters
localFolderstringLocal folder path to upload
workingIWorkingWorking state tracker to allow cancellation
Returns
- bool
True if all files and folders were uploaded successfully
UploadFolderRek(string, string)
Recursively uploads a local folder and all its contents to specified remote folder
public bool UploadFolderRek(string localFolder, string remoteFolder)
Parameters
localFolderstringLocal folder path to upload
remoteFolderstringRemote FTP folder path to upload to
Returns
- bool
True if all files and folders were uploaded successfully
UploadFolderShared(string, bool, IWorking)
Shared method for uploading folder to FTP server (used by both recursive and non-recursive variants)
public bool UploadFolderShared(string sourceFolder, bool isRecursive, IWorking working)
Parameters
sourceFolderstringLocal source folder path
isRecursiveboolWhether to recursively upload subfolders
workingIWorkingWorking state tracker to allow cancellation
Returns
- bool
True if folder was uploaded successfully
Events
NewStatus
Event raised when FTP operation status changes
public static event Action<object, object[]> NewStatus