/// <summary> /// Default constructor. /// </summary> /// <param name="session">Reference to pop3 session.</param> /// <param name="userName">Username.</param> /// <param name="passwData">Password data.</param> /// <param name="data">Authentication specific data(as tag).</param> /// <param name="authType">Authentication type.</param> public AuthUser_EventArgs(FTP_Session session,string userName,string passwData,string data,AuthType authType) { m_pSession = session; m_UserName = userName; m_PasswData = passwData; m_Data = data; m_AuthType = authType; }
/// <summary> /// Default constructor. /// </summary> /// <param name="session">Reference to pop3 session.</param> /// <param name="userName">Username.</param> /// <param name="passwData">Password data.</param> /// <param name="data">Authentication specific data(as tag).</param> /// <param name="authType">Authentication type.</param> public AuthUser_EventArgs(FTP_Session session, string userName, string passwData, string data, AuthType authType) { m_pSession = session; m_UserName = userName; m_PasswData = passwData; m_Data = data; m_AuthType = authType; }
internal FileSysEntry_EventArgs OnGetDirInfo(FTP_Session session, string dir) { FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, dir, ""); if (this.GetDirInfo != null) { this.GetDirInfo(this, oArg); } return(oArg); }
internal bool OnDeleteFile(FTP_Session session, string file) { FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, file, ""); if (this.DeleteFile != null) { this.DeleteFile(this, oArg); } return(oArg.Validated); }
/// <summary> /// Authenticates user. /// </summary> /// <param name="session">Reference to current pop3 session.</param> /// <param name="userName">User name.</param> /// <param name="passwData"></param> /// <param name="data"></param> /// <param name="authType"></param> /// <returns></returns> internal virtual bool OnAuthUser(FTP_Session session, string userName, string passwData, string data, AuthType authType) { AuthUser_EventArgs oArg = new AuthUser_EventArgs(session, userName, passwData, data, authType); if (this.AuthUser != null) { this.AuthUser(this, oArg); } return(oArg.Validated); }
internal bool OnDeleteDir(FTP_Session session, string dir) { FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, dir, ""); if (this.DeleteDir != null) { this.DeleteDir(this, oArg); } return(oArg.Validated); }
internal bool OnRenameDirFile(FTP_Session session, string from, string to) { FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, from, to); if (this.RenameDirFile != null) { this.RenameDirFile(this, oArg); } return(oArg.Validated); }
internal Stream OnStoreFile(FTP_Session session, string file) { FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, file, ""); if (this.StoreFile != null) { this.StoreFile(this, oArg); } return(oArg.FileStream); }
/// <summary> /// Initialize and start new session here. Session isn't added to session list automatically, /// session must add itself to server session list by calling AddSession(). /// </summary> /// <param name="socket">Connected client socket.</param> /// <param name="bindInfo">BindInfo what accepted socket.</param> protected override void InitNewSession(Socket socket, IPBindInfo bindInfo) { string sessionID = Guid.NewGuid().ToString(); SocketEx socketEx = new SocketEx(socket); if (LogCommands) { socketEx.Logger = new SocketLogger(socket, this.SessionLog); socketEx.Logger.SessionID = sessionID; } FTP_Session session = new FTP_Session(sessionID, socketEx, bindInfo, this); }
/// <summary> /// Default constructor. /// </summary> /// <param name="name"></param> /// <param name="newName"></param> /// <param name="session"></param> public FileSysEntry_EventArgs(FTP_Session session,string name,string newName) { m_Name = name; m_NewName = newName; m_DsDirInfo = new DataSet(); DataTable dt = m_DsDirInfo.Tables.Add("DirInfo"); dt.Columns.Add("Name"); dt.Columns.Add("Date",typeof(DateTime)); dt.Columns.Add("Size",typeof(long)); dt.Columns.Add("IsDirectory",typeof(bool)); }
/// <summary> /// Default constructor. /// </summary> /// <param name="name"></param> /// <param name="newName"></param> /// <param name="session"></param> public FileSysEntry_EventArgs(FTP_Session session, string name, string newName) { m_Name = name; m_NewName = newName; m_DsDirInfo = new DataSet(); DataTable dt = m_DsDirInfo.Tables.Add("DirInfo"); dt.Columns.Add("Name"); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Size", typeof(long)); dt.Columns.Add("IsDirectory", typeof(bool)); }
/// <summary> /// Default constructor. /// </summary> /// <param name="session">Owner FTP session.</param> /// <param name="stream">Data connection data stream.</param> /// <param name="read_write">Specifies if data read from remote endpoint or written to it.</param> /// <exception cref="ArgumentNullException">Is raised when <b>session</b> or <b>stream</b> is null reference.</exception> public DataConnection(FTP_Session session,Stream stream,bool read_write) { if(session == null){ throw new ArgumentNullException("session"); } if(stream == null){ throw new ArgumentNullException("stream"); } m_pSession = session; m_pStream = stream; m_Read_Write = read_write; }
internal bool OnFileExists(FTP_Session session, string file) { // Remove last / file = file.Substring(0, file.Length - 1); FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, file, ""); if (this.FileExists != null) { this.FileExists(this, oArg); } return(oArg.Validated); }
/// <summary> /// Cleans up any resources being used. /// </summary> public void Dispose() { if(m_IsDisposed){ return; } m_IsDisposed = true; // Reset session PASV cached data. if(m_pSession.m_pPassiveSocket != null){ m_pSession.m_pPassiveSocket.Close(); m_pSession.m_pPassiveSocket = null; } m_pSession.m_PassiveMode = false; m_pSession = null; if(m_pStream != null){ m_pStream.Dispose(); m_pStream = null; } if(m_pSocket != null){ m_pSocket.Close(); m_pSocket = null; } }
internal bool OnDeleteFile(FTP_Session session,string file) { FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,file,""); if(this.DeleteFile != null){ this.DeleteFile(this,oArg); } return oArg.Validated; }
internal Stream OnStoreFile(FTP_Session session,string file) { FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,file,""); if(this.StoreFile != null){ this.StoreFile(this,oArg); } return oArg.FileStream; }
internal FileSysEntry_EventArgs OnGetDirInfo(FTP_Session session,string dir) { FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,dir,""); if(this.GetDirInfo != null){ this.GetDirInfo(this,oArg); } return oArg; }
/// <summary> /// /// </summary> /// <param name="socket"></param> protected override void InitNewSession(Socket socket) { SocketLogger logger = new SocketLogger(socket, this.SessionLog); FTP_Session session = new FTP_Session(socket, this, Guid.NewGuid().ToString(), logger); }
/// <summary> /// Authenticates user. /// </summary> /// <param name="session">Reference to current pop3 session.</param> /// <param name="userName">User name.</param> /// <param name="passwData"></param> /// <param name="data"></param> /// <param name="authType"></param> /// <returns></returns> internal virtual bool OnAuthUser(FTP_Session session,string userName,string passwData,string data,AuthType authType) { AuthUser_EventArgs oArg = new AuthUser_EventArgs(session,userName,passwData,data,authType); if(this.AuthUser != null){ this.AuthUser(this,oArg); } return oArg.Validated; }
internal bool OnDeleteDir(FTP_Session session,string dir) { FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,dir,""); if(this.DeleteDir != null){ this.DeleteDir(this,oArg); } return oArg.Validated; }
internal bool OnFileExists(FTP_Session session,string file) { // Remove last / file = file.Substring(0,file.Length - 1); FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,file,""); if(this.FileExists != null){ this.FileExists(this,oArg); } return oArg.Validated; }
/// <summary> /// Initialize and start new session here. Session isn't added to session list automatically, /// session must add itself to server session list by calling AddSession(). /// </summary> /// <param name="socket">Connected client socket.</param> /// <param name="bindInfo">BindInfo what accepted socket.</param> protected override void InitNewSession(Socket socket,IPBindInfo bindInfo) { string sessionID = Guid.NewGuid().ToString(); SocketEx socketEx = new SocketEx(socket); if(LogCommands){ socketEx.Logger = new SocketLogger(socket,this.SessionLog); socketEx.Logger.SessionID = sessionID; } FTP_Session session = new FTP_Session(sessionID,socketEx,bindInfo,this); }
internal bool OnRenameDirFile(FTP_Session session,string from,string to) { FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,from,to); if(this.RenameDirFile != null){ this.RenameDirFile(this,oArg); } return oArg.Validated; }