Beispiel #1
0
 /// <summary>
 /// Raises <see cref="FileDeleted"/> event.
 /// </summary>
 /// <param name="file">A <see cref="FtpFile"/> file.</param>
 protected void OnFileDeleted(FtpFile file)
 {
     if ((object)FileDeleted != null)
     {
         FileDeleted(this, new EventArgs <FtpFile>(file));
     }
 }
Beispiel #2
0
        /// <summary>
        /// Creates a new data stream for remote file in directory.
        /// </summary>
        /// <param name="newFileName">New remote file name.</param>
        /// <returns>Output data stream for new remote file.</returns>
        public FtpOutputDataStream CreateFileStream(string newFileName)
        {
            InitHashtable();

            FtpDataStream stream = m_session.ControlChannel.GetPassiveDataStream(TransferDirection.Upload);

            try
            {
                m_session.ControlChannel.STOR(newFileName);

                FtpFile newFile = new FtpFile(this, newFileName);

                m_files[newFileName] = newFile;

                return((FtpOutputDataStream)stream);
            }
            catch
            {
                stream.Close();
                throw;
            }
        }