internal protected virtual void InvokeOnAccount(FtpUserAccountArgs e) { if (this.OnAccount != null) this.OnAccount(this, e); }
public static void Cmd_ACCT(Object sender, CommandEventArgs e) { FtpSession lSession = (FtpSession)e.Session; if (lSession.State == FtpState.AccountRequired) { if (e.Parameters.Length != 1) { e.Connection.WriteLine("501 Syntax error in parameters or arguments."); } else { FtpUserAccountArgs lEventArgs = new FtpUserAccountArgs(e.Session, e.Connection, e.Server); lEventArgs.AccountName = e.Parameters[0]; try { ((FtpServer)e.Server).InvokeOnAccount(lEventArgs); } catch (FtpException ex) { e.Connection.WriteLine(ex.ToString()); return; } catch { e.Connection.WriteLine("500 Internal Error"); return; } if (lEventArgs.LoginOk) { e.Connection.WriteLine("230 User logged in, proceed."); lSession.State = FtpState.LoggedIn; } else { lSession.State = FtpState.Start; e.Connection.WriteLine("530 Unable to login"); } } } else { e.Connection.WriteLine("503 Bad sequence of commands."); } }