Class PathSelector
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
initialDirectorystringInitial 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
Tokens
List of path Tokens split by delimiter
public List<string> Tokens
Field Value
Properties
ActualPath
Gets or sets the current path as a delimited string
public string ActualPath { get; set; }
Property Value
CanGoToUpFolder
Indicates whether it's possible to navigate to parent folder
public bool CanGoToUpFolder { get; }
Property Value
Delimiter
Path delimiter character (\ for Windows paths, / for FTP paths)
public string Delimiter { get; }
Property Value
FirstToken
First token in the path (e.g., drive letter for Windows, root folder for FTP)
public string FirstToken { get; }
Property Value
Methods
AddToken(string)
Adds a new token to the end of the current path
public void AddToken(string token)
Parameters
tokenstringToken to add
DivideToTokens(string)
Splits a path string into individual tokens using the configured delimiter
public List<string> DivideToTokens(string path)
Parameters
pathstringPath string to divide
Returns
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()