示例#1
0
        internal FileSysEntry_EventArgs OnGetDirInfo(FTP_Session session, string dir)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, dir, "");

            if (GetDirInfo != null)
            {
                GetDirInfo(this, oArg);
            }
            return(oArg);
        }
示例#2
0
        internal bool OnRenameDirFile(FTP_Session session, string from, string to)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, from, to);

            if (RenameDirFile != null)
            {
                RenameDirFile(this, oArg);
            }

            return(oArg.Validated);
        }
示例#3
0
        internal bool OnDeleteDir(FTP_Session session, string dir)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, dir, "");

            if (DeleteDir != null)
            {
                DeleteDir(this, oArg);
            }

            return(oArg.Validated);
        }
示例#4
0
        internal Stream OnStoreFile(FTP_Session session, string file)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, file, "");

            if (StoreFile != null)
            {
                StoreFile(this, oArg);
            }

            return(oArg.FileStream);
        }
示例#5
0
        internal bool OnDeleteFile(FTP_Session session, string file)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, file, "");

            if (DeleteFile != null)
            {
                DeleteFile(this, oArg);
            }

            return(oArg.Validated);
        }
示例#6
0
        /// <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, SessionLog);
                socketEx.Logger.SessionID = sessionID;
            }
            FTP_Session session = new FTP_Session(sessionID, socketEx, bindInfo, this);
        }
示例#7
0
        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 (FileExists != null)
            {
                FileExists(this, oArg);
            }

            return(oArg.Validated);
        }
        /// <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_pSession = session;

            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));
        }
示例#9
0
        /// <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 (AuthUser != null)
            {
                AuthUser(this, oArg);
            }

            return(oArg.Validated);
        }
示例#10
0
        /// <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 (AuthUser != null)
            {
                AuthUser(this, oArg);
            }

            return oArg.Validated;
        }
示例#11
0
        internal bool OnDeleteFile(FTP_Session session, string file)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, file, "");
            if (DeleteFile != null)
            {
                DeleteFile(this, oArg);
            }

            return oArg.Validated;
        }
示例#12
0
        internal Stream OnStoreFile(FTP_Session session, string file)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, file, "");
            if (StoreFile != null)
            {
                StoreFile(this, oArg);
            }

            return oArg.FileStream;
        }
示例#13
0
        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 (FileExists != null)
            {
                FileExists(this, oArg);
            }

            return oArg.Validated;
        }
示例#14
0
        internal bool OnRenameDirFile(FTP_Session session, string from, string to)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, from, to);
            if (RenameDirFile != null)
            {
                RenameDirFile(this, oArg);
            }

            return oArg.Validated;
        }
示例#15
0
        internal bool OnDeleteDir(FTP_Session session, string dir)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, dir, "");
            if (DeleteDir != null)
            {
                DeleteDir(this, oArg);
            }

            return oArg.Validated;
        }
示例#16
0
 internal FileSysEntry_EventArgs OnGetDirInfo(FTP_Session session, string dir)
 {
     FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, dir, "");
     if (GetDirInfo != null)
     {
         GetDirInfo(this, oArg);
     }
     return oArg;
 }
        /// <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_pSession = session;

            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));
        }
示例#18
0
 /// <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, SessionLog);
         socketEx.Logger.SessionID = sessionID;
     }
     FTP_Session session = new FTP_Session(sessionID, socketEx, bindInfo, this);
 }