예제 #1
0
 /// <summary>
 /// FTP request constructor.
 /// </summary>
 /// <param name="encoding">Text encoding object to use.</param>
 /// <param name="command">FTP request command.</param>
 /// <param name="arguments">Parameters for the request</param>
 internal FtpsRequest(Encoding encoding, FtpsCmd command, params string[] arguments)
 {
     _encoding  = encoding;
     _command   = command;
     _arguments = arguments;
     _text      = BuildCommandText();
 }
예제 #2
0
 /// <summary>
 /// FTP request constructor.
 /// </summary>
 /// <param name="encoding">Text encoding object to use.</param>
 /// <param name="command">FTP request command.</param>
 internal FtpsRequest(Encoding encoding, FtpsCmd command) : this(encoding, command, null)
 {
 }
 /// <summary>
 /// Linearly searches for the specified object based on the feature 'name' parameter value
 /// and returns true if an object with the name is found; otherwise false.  Search is case insensitive.
 /// </summary>
 /// <param name="name">The name of the FtpFeature to locate in the collection.</param>
 /// <param name="arguments">The argument for the FtpFeature to locate in the collection.</param>
 /// <returns>True if the name if found; otherwise false.</returns>
 public bool Contains(FtpsCmd name, string arguments)
 {
     return(Contains(name.ToString(), arguments));
 }
예제 #4
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public FtpsRequest()
 {
     _encoding = Encoding.UTF8;
     _command  = new FtpsCmd();
     _text     = string.Empty;
 }
 /// <summary>
 /// Linearly searches for the specified object based on the feature 'name' parameter value
 /// and returns the corresponding object with the name is found; otherwise null.  Search is case insensitive.
 /// </summary>
 /// <param name="name">The name of the FtpFeature to locate in the collection.</param>
 /// <returns>FtpFeature object if the name if found; otherwise null.</returns>
 public FtpsFeature Find(FtpsCmd name)
 {
     return(Find(name.ToString()));
 }
 /// <summary>
 /// Linearly searches for the specified object based on the feature 'name' parameter value
 /// and returns true if an object with the name is found; otherwise false.  Search is case insensitive.
 /// </summary>
 /// <param name="name">The name of the FtpFeature to locate in the collection.</param>
 /// <returns>True if the name if found; otherwise false.</returns>
 public bool Contains(FtpsCmd name)
 {
     return(Contains(name.ToString()));
 }
예제 #7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="command">Enumerated FTP command.</param>
 public FtpsCommandNotSupportedException(string message, FtpsCmd command)
     : this(message, command.ToString())
 {
 }
 /// <summary>
 /// Gets an FtpFeature from the FtpFeatureCollection list based on name.
 /// </summary>
 /// <param name="name">Name of the feature.</param>
 /// <returns>FtpFeature object.</returns>
 public FtpsFeature this[FtpsCmd name]
 {
     get { return(Find(name)); }
 }
예제 #9
0
 /// <summary>
 /// FTP request constructor.
 /// </summary>
 /// <param name="encoding">Text encoding object to use.</param>
 /// <param name="command">FTP request command.</param>
 internal FtpsRequest(Encoding encoding, FtpsCmd command)
     : this(encoding, command, null)
 {
 }
예제 #10
0
 /// <summary>
 /// FTP request constructor.
 /// </summary>
 /// <param name="encoding">Text encoding object to use.</param>
 /// <param name="command">FTP request command.</param>
 /// <param name="arguments">Parameters for the request</param>
 internal FtpsRequest(Encoding encoding, FtpsCmd command, params string[] arguments)
 {
     _encoding = encoding;
     _command = command;
     _arguments = arguments;
     _text = BuildCommandText();
 }
예제 #11
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public FtpsRequest()
 {
     _encoding = Encoding.UTF8;
     _command = new FtpsCmd();
     _text = string.Empty;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Exception message text.</param>
 /// <param name="command">Enumerated FTP command.</param>
 public FtpsCommandNotSupportedException(string message, FtpsCmd command)
     : this(message, command.ToString())
 {  
 }
예제 #13
0
        /// <summary>
        /// Set the date and time for a specific file or directory on the server using a specific FTP command.
        /// </summary>
        /// <param name="path">The path or name of the file or directory.</param>
        /// <param name="dateTime">New date to set on the file or directory.</param>
        /// <param name="cmd">MFCT or MFMT command to use</param>
        private void SetDateTime(string path, DateTime dateTime, FtpsCmd cmd)
        {
            if (String.IsNullOrEmpty(path))
                throw new ArgumentException("must have a value", "path");

            if (cmd != FtpsCmd.Mfmt && cmd != FtpsCmd.Mfct)
                throw new ArgumentOutOfRangeException("cmd", "only Mfmt and Mfct options are supported");

            if (!base.Features.Contains(cmd))
                throw new FtpsCommandNotSupportedException("Cannot set date time of file.", cmd);
                        
            // replay format: MFMT [YYMMDDHHMMSS] [filename]

            string dateTimeArg = dateTime.ToString("yyyyMMddHHmmss");

            try
            {
                base.SendRequest(new FtpsRequest(base.Encoding, cmd, dateTimeArg, path));
            }
            catch (FtpsException fex)
            {
                throw new FtpsException(String.Format("An error occurred when setting a file date and time for '{0}'.", path), fex);
            }
        }