internal virtual void SetState(ITransferState newState) { lock (this) { State = DecorateForLogging(newState); State.Context = this; State.OnStateEnter(); } }
public TFtpTransfer(ITransferChannel connection, string filename, ITransferState initialState) { ProposedOptions = TransferOptionSet.NewDefaultSet(); Filename = filename; RetryCount = 5; SetState(initialState); Connection = connection; Connection.OnCommandReceived += Connection_OnCommandReceived; Connection.OnError += Connection_OnError; Connection.Open(); Timer = new Timer(Timer_OnTimer, null, 500, 500); }
public TftpTransfer(ITransferChannel connection, String filename, ITransferState initialState) { this.ProposedOptions = TransferOptionSet.NewDefaultSet(); this.Filename = filename; this.RetryCount = 5; this.SetState(initialState); this.connection = connection; this.connection.OnCommandReceived += new TftpCommandHandler(connection_OnCommandReceived); this.connection.OnError += new TftpChannelErrorHandler(connection_OnError); this.connection.Open(); this.timer = new Timer(timer_OnTimer, null, 500, 500); }
protected virtual ITransferState DecorateForLogging(ITransferState state) { return(TFtpTrace.Enabled ? new LoggingStateDecorator(state, this) : state); }
public LoggingStateDecorator(ITransferState decoratee, TftpTransfer transfer) { this.decoratee = decoratee; this.transfer = transfer; }
protected override ITransferState DecorateForLogging(ITransferState state) { return(state); }