Class FtpNet
- Namespace
- SunamoFtp.FtpClients
- Assembly
- SunamoFtp.dll
FTP client implementation using FtpWebRequest
public class FtpNet : FtpBase
- Inheritance
-
FtpNet
- Inherited Members
- Extension Methods
Methods
ChdirLite(string)
Changes current directory on FTP server (lightweight version without full navigation)
public override void ChdirLite(string directoryName)
Parameters
directoryNamestringDirectory name to change to
Connect()
Establishes connection to the FTP server (not implemented)
public override void Connect()
CreateDirectoryIfNotExists(string)
OK MKD Creates directory if it does not exist
public override void CreateDirectoryIfNotExists(string directoryName)
Parameters
directoryNamestring
DebugActualFolder()
isDebug output for current folder path (not implemented)
public override void DebugActualFolder()
DeleteRecursively(List<string>, string, int, List<DirectoriesToDeleteFtp>)
Recursively deletes directory and its contents using DELE and RMD commands
public override void DeleteRecursively(List<string> foldersToSkip, string directoryName, int i, List<DirectoriesToDeleteFtp> directoriesToDelete)
Parameters
foldersToSkipList<string>List of folder names to skip during deletion
directoryNamestringRoot directory name to start deletion from
iintCurrent recursion depth level
directoriesToDeleteList<DirectoriesToDeleteFtp>
DeleteRemoteFile(string)
OK DELE Deletes remote file with specified name.
public override bool DeleteRemoteFile(string fileName)
Parameters
fileNamestring
Returns
Download(string, string, bool)
Downloads file from FTP server using RETR command. If local file exists and deleteLocalIfExists is true, deletes it first.
public override bool Download(string remFileName, string locFileName, bool deleteLocalIfExists)
Parameters
remFileNamestringRemote file name to download
locFileNamestringLocal file path to save to
deleteLocalIfExistsboolWhether to delete local file if it already exists
Returns
- bool
True if download was successful
GetFSEntriesListRecursively(List<string>)
OK LIST This is entry method, do not call GetFSEntriesListRecursively with 5 parameters even though it has same name Returns files and folders, but note that folders are always after files
public override Dictionary<string, List<string>> GetFSEntriesListRecursively(List<string> foldersToSkip)
Parameters
Returns
GetFileList(string)
OK NLST Returns only file names, without folders or links If not logged in, log in using login method Vytvořím objekt Socket metodou CreateDataSocket ze které budu přidávat znaky Zavolám příkaz NLST s A1, Skrz objekt Socket získám bajty, které okamžitě přidávám do řetězce Odpověď získám M ReadReply a G
public List<string> GetFileList(string mask)
Parameters
maskstring
Returns
GetFileSize(string)
OK SIZE Sends SIZE command. If not logged in, logs in.
public override long GetFileSize(string fileName)
Parameters
fileNamestring
Returns
GoToPath(string)
Navigates to specified path on FTP server, creating directories as needed
public override void GoToPath(string remoteFolder)
Parameters
remoteFolderstringRemote folder path to navigate to
GoToUpFolder()
OK
public override void GoToUpFolder()
GoToUpFolderForce()
OK Tuto metodu nepoužívej, protože fakticky způsobuje neošetřenou výjimku, pokud již cesta bude skutečně / a a nebude moci se přesunout nikde výš
public override void GoToUpFolderForce()
ListDirectoryDetails()
OK LIST Returns folders, files and links
public override List<string> ListDirectoryDetails()
Returns
LoginIfIsNot(bool)
Performs login to FTP server if not already logged in
public override void LoginIfIsNot(bool isInitialLogin)
Parameters
isInitialLoginboolIndicates if this is initial startup login
Mkdir(string)
OK MKD Vytvoří v akt. složce A1 adresář A1 příkazem MKD
public override bool Mkdir(string directoryName)
Parameters
directoryNamestring
Returns
RenameRemoteFile(string, string)
RENAME Pošlu příkaz RNFR A1 a když bude odpoveď 350, tak RNTO
public override void RenameRemoteFile(string oldFileName, string newFileName)
Parameters
Rmdir(List<string>, string)
Removes empty directory from FTP server using RMD command. Can only be called when directory is known to be empty, otherwise returns error 550.
public override 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
WriteDebugLog(string, string, params object[])
isDebug output method for logging FTP operations (not implemented)
public override void WriteDebugLog(string context, string text, params object[] args)