Example #1
0
        /// <summary>
        /// Gets the file info at the specified path.
        /// </summary>
        /// <param name="path">The path of the file.</param>
        /// <returns>
        /// An <see cref="IFileInfo"/> of the file from the specified path.
        /// </returns>
        public IFileInfo GetFileInfo(string path)
        {
            path.ThrowIfNull(() => path);

            path = FtpFileSystem.NormalizePath(path);
            FlagFtp.FtpFileInfo file = this.client.GetFileInfo(new Uri(path));

            return(new FtpFileInfo(file.FullName, file.LastWriteTime, file.Length, this.client));
        }
Example #2
0
        /// <summary>
        /// Deletes the specified FTP file.
        /// </summary>
        /// <param name="file">The file to delete.</param>
        public void DeleteFile(FtpFileInfo file)
        {
            if (file == null)
                throw new ArgumentNullException("file");

            this.DeleteFile(file.Uri);
        }
Example #3
0
        /// <summary>
        /// Opens the specified file for write access.
        /// </summary>
        /// <param name="file">The file to open.</param>
        /// <returns>
        /// A <see cref="System.IO.Stream"/> to write to the file.
        /// </returns>
        public Stream OpenWrite(FtpFileInfo file)
        {
            if (file == null)
                throw new ArgumentNullException("file");

            return this.OpenWrite(file.Uri);
        }
Example #4
0
        /// <summary>
        /// Opens the specified file for read access.
        /// </summary>
        /// <param name="file">The file to open.</param>
        /// <returns>
        /// An FTP stream to read from the file.
        /// </returns>
        public FtpStream OpenRead(FtpFileInfo file)
        {
            if (file == null)
                throw new ArgumentNullException("file");

            return new FtpStream(this.CreateClient().OpenRead(file.Uri), file.Length);
        }