Table of Contents

Class FtpBase

Namespace
SunamoFtp.Base
Assembly
SunamoFtp.dll
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

remFileName string

Remote file name on FTP server

locFileName string

Local file path to save to

ExistsFolder(string)

Checks if folder exists in current FTP directory

public bool ExistsFolder(string folder)

Parameters

folder string

Folder 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

directoryName string

Directory 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

foldersToSkip List<string>

List of folder names to skip during traversal

visitedFolders List<string>

List of already visited folder paths to avoid infinite loops

result Dictionary<string, List<string>>

Dictionary to collect filesystem entries mapped by directory path

folderName string

Folder 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

text string

Status message

args object[]

Additional 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

path string

Path 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

filePath string

Local 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

filePath string

Local file path to upload

actualFtpPath string

Target FTP folder path

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

path string

Local source file path to upload

uploadPath string

Target FTP upload path

Returns

bool

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

files List<string>

List of local file paths to upload

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

localFolder string

Local source folder path

isFtpClass bool

Indicates if called from FTP class (requires GoToPath to restore)

working IWorking

Working 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

localFolder string

Local folder path to upload

working IWorking

Working 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

localFolder string

Local folder path to upload

remoteFolder string

Remote 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

sourceFolder string

Local source folder path

isRecursive bool

Whether to recursively upload subfolders

working IWorking

Working 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

Event Type

Action<object, object[]>