Table of Contents

Class FtpAbstract

Namespace
SunamoFtp.Base
Assembly
SunamoFtp.dll

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

int

FolderSizeRecursive

Total folder size calculated recursively

public ulong FolderSizeRecursive { get; set; }

Property Value

ulong

IsInitialLogin

Indicates if this is startup phase

protected bool IsInitialLogin { get; set; }

Property Value

bool

IsLoggedIn

Indicates whether user is logged in

public bool IsLoggedIn { get; set; }

Property Value

bool

MainWindow

Extended FTP client interface for application-specific operations

public IFtpClientExt MainWindow { get; set; }

Property Value

IFtpClientExt

MaxExceptionCount

Maximum allowed exception count before operation is canceled

protected int MaxExceptionCount { get; set; }

Property Value

int

PathSelector

Path selector for managing FTP paths. Public only for Ftp class.

public PathSelector PathSelector { get; set; }

Property Value

PathSelector

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

bool

RemoteHost

Remote host address

public string RemoteHost { get; set; }

Property Value

string

RemotePass

Password for user authentication (sent with PASS command)

public string RemotePass { get; set; }

Property Value

string

RemotePort

Remote server port number

public int RemotePort { get; set; }

Property Value

int

RemoteUser

Username attempting to login (used with USER command)

public string RemoteUser { get; set; }

Property Value

string

Methods

ChdirLite(string)

Changes current directory on FTP server (lightweight version)

public abstract void ChdirLite(string directoryName)

Parameters

directoryName string

Directory 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

directoryName string

Directory 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

foldersToSkip List<string>

List of folder names to skip during deletion

directoryName string

Root directory name to start deletion from

depth int

Current recursion depth level

directoriesToDelete List<DirectoriesToDeleteFtp>

List to collect directories marked for deletion

DeleteRemoteFile(string)

Deletes a file from the FTP server

public abstract bool DeleteRemoteFile(string fileName)

Parameters

fileName string

File 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

remFileName string

Remote file name on FTP server

locFileName string

Local file path to save to

isDeleteLocalIfExists bool

Whether 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

foldersToSkip List<string>

List of folder names to skip during traversal

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

filename string

File 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

remoteFolder string

Remote 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

List<string>

List of directory entry details

LoginIfIsNot(bool)

Performs login to FTP server if not already logged in

public abstract void LoginIfIsNot(bool isInitialLogin)

Parameters

isInitialLogin bool

Indicates if this is initial startup login

Mkdir(string)

Creates a directory on the FTP server

public abstract bool Mkdir(string directoryName)

Parameters

directoryName string

Directory 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

oldFileName string

Current file name

newFileName string

New file name

Rmdir(List<string>, string)

Removes a directory from the FTP server

public abstract bool Rmdir(List<string> foldersToSkip, string directoryName)

Parameters

foldersToSkip List<string>

List of folder names to skip during deletion

directoryName string

Directory name to remove

Returns

bool

True if directory was removed successfully

SetRemoteHost(string)

Sets remote host address

public void SetRemoteHost(string remoteHost)

Parameters

remoteHost string

Remote host address

SetRemotePass(string)

Sets remote password

public void SetRemotePass(string remotePass)

Parameters

remotePass string

Password

SetRemotePort(int)

Sets remote server port

public void SetRemotePort(int remotePort)

Parameters

remotePort int

Port number

SetRemoteUser(string)

Sets remote username

public void SetRemoteUser(string remoteUser)

Parameters

remoteUser string

Username

WriteDebugLog(string, string, params object[])

Debug output method for logging FTP operations

public abstract void WriteDebugLog(string context, string text, params object[] args)

Parameters

context string

Operation or context identifier

text string

Message format string

args object[]

Format arguments