Show / Hide Table of Contents

    Class FtpStateMachine<TStatus>

    A base class for a state machine that's triggered by FTP commands.

    Inheritance
    Object
    FtpStateMachine<TStatus>
    FtpLoginStateMachine
    Implements
    IFtpStateMachine<TStatus>
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: FubarDev.FtpServer
    Assembly: FubarDev.FtpServer.Abstractions.dll
    Syntax
    public abstract class FtpStateMachine<TStatus> : IFtpStateMachine<TStatus> where TStatus : Enum
    Type Parameters
    Name Description
    TStatus

    The status type.

    Constructors

    | Improve this Doc View Source

    FtpStateMachine(IFtpConnection, IEnumerable<FtpStateMachine<TStatus>.Transition>, TStatus)

    Initializes a new instance of the FtpStateMachine<TStatus> class.

    Declaration
    protected FtpStateMachine(IFtpConnection connection, IEnumerable<FtpStateMachine<TStatus>.Transition> transitions, TStatus initialStatus)
    Parameters
    Type Name Description
    IFtpConnection connection

    The FTP connection.

    IEnumerable<FtpStateMachine.Transition<>> transitions

    The supported transitions.

    TStatus initialStatus

    The initial status.

    Properties

    | Improve this Doc View Source

    Connection

    Gets the connection this state machine belongs to.

    Declaration
    public IFtpConnection Connection { get; }
    Property Value
    Type Description
    IFtpConnection
    | Improve this Doc View Source

    Status

    Gets the current status.

    Declaration
    public TStatus Status { get; }
    Property Value
    Type Description
    TStatus

    Methods

    | Improve this Doc View Source

    ExecuteAsync(FtpCommand, CancellationToken)

    Executes the given FTP command.

    Declaration
    public Task<IFtpResponse? > ExecuteAsync(FtpCommand ftpCommand, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    FtpCommand ftpCommand

    The FTP command to execute.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<Nullable<IFtpResponse>>

    The task returning the response.

    | Improve this Doc View Source

    ExecuteCommandAsync(FtpCommand, CancellationToken)

    Execute the command. All status checks are already done.

    Declaration
    protected abstract Task<IFtpResponse? > ExecuteCommandAsync(FtpCommand ftpCommand, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    FtpCommand ftpCommand

    The FTP command to execute.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<Nullable<IFtpResponse>>

    The task returning the response.

    | Improve this Doc View Source

    GetPossibleTransitions(TStatus)

    Get all possible transitions for a given status.

    Declaration
    protected IReadOnlyCollection<FtpStateMachine<TStatus>.Transition> GetPossibleTransitions(TStatus status)
    Parameters
    Type Name Description
    TStatus status

    The status value to get the transitions for.

    Returns
    Type Description
    IReadOnlyCollection<FtpStateMachine.Transition<>>

    The possible transitions for the given status.

    | Improve this Doc View Source

    OnStatusChanged(TStatus, TStatus)

    Called when the status was updated.

    Declaration
    protected virtual void OnStatusChanged(TStatus from, TStatus to)
    Parameters
    Type Name Description
    TStatus from

    The previous status.

    TStatus to

    The new status.

    | Improve this Doc View Source

    Reset()

    Resets the state machine to the initial status.

    Declaration
    public virtual void Reset()
    | Improve this Doc View Source

    SetStatus(TStatus)

    Sets the status to a new value.

    Declaration
    protected void SetStatus(TStatus status)
    Parameters
    Type Name Description
    TStatus status

    The new status value.

    | Improve this Doc View Source

    T(String)

    Translates a message using the current catalog of the active connection.

    Declaration
    protected string T(string message)
    Parameters
    Type Name Description
    String message

    The message to translate.

    Returns
    Type Description
    String

    The translated message.

    | Improve this Doc View Source

    T(String, Object[])

    Translates a message using the current catalog of the active connection.

    Declaration
    [StringFormatMethod("message")]
    protected string T(string message, params object[] args)
    Parameters
    Type Name Description
    String message

    The message to translate.

    Object[] args

    The format arguments.

    Returns
    Type Description
    String

    The translated message.

    Implements

    IFtpStateMachine<TStatus>
    • Improve this Doc
    • View Source
    Back to top
    Copyright © 2018 Fubar Development Junker
    Generated by DocFX
    Creative Commons License
    FluentMigrator Documentation by FluentMigrator Project is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.