Table of Contents

Class PathSelector

Namespace
SunamoFtp.Base
Assembly
SunamoFtp.dll

Manages path navigation and tokenization for FTP operations

public class PathSelector
Inheritance
PathSelector
Inherited Members
Extension Methods

Constructors

PathSelector(string)

Initializes path selector with initial directory. Works with both \ and / delimiters.

public PathSelector(string initialDirectory)

Parameters

initialDirectory string

Initial directory path (e.g., C:, www, or any root folder)

Fields

IndexZero

Index of the first valid token (0 for relative paths, 1 for absolute paths)

public int IndexZero

Field Value

int

Tokens

List of path Tokens split by delimiter

public List<string> Tokens

Field Value

List<string>

Properties

ActualPath

Gets or sets the current path as a delimited string

public string ActualPath { get; set; }

Property Value

string

CanGoToUpFolder

Indicates whether it's possible to navigate to parent folder

public bool CanGoToUpFolder { get; }

Property Value

bool

Delimiter

Path delimiter character (\ for Windows paths, / for FTP paths)

public string Delimiter { get; }

Property Value

string

FirstToken

First token in the path (e.g., drive letter for Windows, root folder for FTP)

public string FirstToken { get; }

Property Value

string

Methods

AddToken(string)

Adds a new token to the end of the current path

public void AddToken(string token)

Parameters

token string

Token to add

DivideToTokens(string)

Splits a path string into individual tokens using the configured delimiter

public List<string> DivideToTokens(string path)

Parameters

path string

Path string to divide

Returns

List<string>

List of path tokens

GetLastToken()

Gets the last token in the current path

public string GetLastToken()

Returns

string

Last path token

RemoveLastToken()

Removes the last token from path with validation (throws if at root level)

public void RemoveLastToken()

Exceptions

Exception

Thrown when attempting to go above root folder

RemoveLastTokenForce()

Removes the last token from path without validation (forced removal)

public void RemoveLastTokenForce()