123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- using System;
- namespace System.Net.FtpClient {
- /// <summary>
- /// 定义要使用的加密类型
- /// </summary>
- public enum FtpEncryptionMode {
- /// <summary>
- /// 纯文本.
- /// </summary>
- None,
- /// <summary>
- /// 从连接开始使用加密,端口990
- /// Encryption is used from the start of the connection, port 990
- /// </summary>
- Implicit,
- /// <summary>
- /// 连接以纯文本开始,并在服务器问候后立即使用AUTH命令启用加密。
- /// Connection starts in plain text and encryption is enabled
- /// with the AUTH command immediately after the server greeting.
- /// </summary>
- Explicit
- }
- /// <summary>
- /// 服务器响应的响应类型
- /// The type of response the server responded with
- /// </summary>
- public enum FtpResponseType : int {
- /// <summary>
- /// No response
- /// </summary>
- None = 0,
- /// <summary>
- /// Success
- /// </summary>
- PositivePreliminary = 1,
- /// <summary>
- /// Successs
- /// </summary>
- PositiveCompletion = 2,
- /// <summary>
- /// Succcess
- /// </summary>
- PositiveIntermediate = 3,
- /// <summary>
- /// Temporary failure
- /// </summary>
- TransientNegativeCompletion = 4,
- /// <summary>
- /// Permanent failure
- /// </summary>
- PermanentNegativeCompletion = 5
- }
-
- /// <summary>
- /// Server features
- /// </summary>
- [Flags]
- public enum FtpCapability : int {
- /// <summary>
- /// This server said it doesn't support anything!
- /// </summary>
- NONE = 0,
- /// <summary>
- /// Supports the MLST command
- /// </summary>
- MLSD = 1,
- /// <summary>
- /// Supports the SIZE command
- /// </summary>
- SIZE = 2,
- /// <summary>
- /// Supports the MDTM command
- /// </summary>
- MDTM = 4,
- /// <summary>
- /// Supports download/upload stream resumes
- /// </summary>
- REST = 8,
- /// <summary>
- /// Supports UTF8
- /// </summary>
- UTF8 = 16,
- /// <summary>
- /// PRET Command used in distributed ftp server software DrFTPD
- /// </summary>
- PRET = 32,
- /// <summary>
- /// Server supports the MFMT command for setting the
- /// modifid date of an object on the server
- /// </summary>
- MFMT = 64,
- /// <summary>
- /// Server supports the MFCT command for setting the
- /// created date of an object on the server
- /// </summary>
- MFCT = 128,
- /// <summary>
- /// Server supports the MFF command for setting certain facts
- /// about file sytem objects. If you need this command, it would
- /// probably be handy to query FEAT your self and have a look at
- /// the FtpReply.InfoMessages property to see which facts the server
- /// allows you to modify.
- /// </summary>
- MFF = 256,
- /// <summary>
- /// Server supports the STAT command
- /// </summary>
- STAT = 512,
- /// <summary>
- /// Support for the HASH command
- /// </summary>
- HASH = 1024,
- /// <summary>
- /// Support for the non-standard MD5 command
- /// </summary>
- MD5 = 2048,
- /// <summary>
- /// Support for the non-standard XMD5 command
- /// </summary>
- XMD5 = 4096,
- /// <summary>
- /// Support for the non-standard XCRC command
- /// </summary>
- XCRC = 8192,
- /// <summary>
- /// Support for the non-standard XSHA1 command
- /// </summary>
- XSHA1 = 16384,
- /// <summary>
- /// Support for the non-standard XSHA256 command
- /// </summary>
- XSHA256 = 32768,
- /// <summary>
- /// Support for the non-standard XSHA512 command
- /// </summary>
- XSHA512 = 65536
- }
- /// <summary>
- /// Different types of hashing algorithms for computing checksums.
- /// </summary>
- [Flags]
- public enum FtpHashAlgorithm : int {
- /// <summary>
- /// HASH command is not supported
- /// </summary>
- NONE = 0,
- /// <summary>
- /// SHA-1
- /// </summary>
- SHA1 = 1,
- /// <summary>
- /// SHA-256
- /// </summary>
- SHA256 = 2,
- /// <summary>
- /// SHA-512
- /// </summary>
- SHA512 = 4,
- /// <summary>
- /// MD5
- /// </summary>
- MD5 = 8,
- /// <summary>
- /// CRC
- /// </summary>
- CRC = 16
- }
- /// <summary>
- /// IP Versions to allow when connecting
- /// to a server.
- /// </summary>
- [Flags]
- public enum FtpIpVersion : int {
- /// <summary>
- /// Internet Protocol Version 4
- /// </summary>
- IPv4 = 1,
- /// <summary>
- /// Internet Protocol Version 6
- /// </summary>
- IPv6 = 2,
- /// <summary>
- /// Allow any supported version
- /// </summary>
- ANY = IPv4 | IPv6
- }
- /// <summary>
- /// 数据连接类型
- /// Data connection type
- /// </summary>
- public enum FtpDataConnectionType {
- /// <summary>
- /// 这种类型的数据连接的尝试使用EPSV命令
- ///如果服务器不支持EPSV它属于回放弃,除非你是通过IPv6连接之前
- /// PASV命令
- ///在这种情况下,不支持PASV命令。
- /// </summary>
- AutoPassive,
- /// <summary>
- ///被动数据连接。 EPSV是一个更好的
- ///如果支持选项。被动连接
- ///连接到由服务器dicated的IP地址
- ///其可以是或可以不是由客户端可访问的
- ///例如NAT设备后面的服务器可能
- ///其本地网络上得到的IP地址,该地址
- ///是不可访问的客户端。请注意,IPv6的
- ///不支持这种类型的数据连接。 如果你
- ///要求PASV并通过IPv6 EPSV连接会
- ///自动在它的位置被使用。
- /// </summary>
- PASV,
- /// <summary>
- ///同PASV除由服务器提供的主机被忽略
- ///和数据conncetion是到同一个地址时,该控制
- ///连接被连接到。这在情景如在
- ///服务器在提供私人/不可路由的网络地址
- /// PASV响应。这是功能上等同于EPSV除了一些
- ///服务器可能无法实现EPSV命令。请注意,IPv6的
- ///不支持这种类型的数据连接。 如果你
- ///要求PASV并通过IPv6 EPSV连接会
- ///自动在它的位置被使用。
- /// </summary>
- PASVEX,
- /// <summary>
- ///被动扩展的数据连接,推荐。 作品
- ///相同,除了与服务器的PASV连接
- ///没有规定以连接到一个IP地址,而不是
- ///被动连接去使用相同的地址
- ///在控制连接。这种类型的数据连接的
- ///支持IPv4和IPv6。
- /// </summary>
- EPSV,
- /// <summary>
- ///这种类型的数据连接的尝试使用EPRT命令
- ///如果服务器不支持EPRT它属于回放弃,除非你是通过IPv6连接之前
- /// PORT命令
- ///在这种情况下不支持PORT命令。
- /// </summary>
- AutoActive,
- /// <summary>
- ///有效的数据连接,不推荐,除非
- ///你有使用这种类型的具体原因。
- ///创建客户端上的监听套接字其中
- ///需要在客户端系统上的防火墙例外
- ///连接到时以及客户端网络
- ///客户端的网络之外的服务器。 此外
- ///使用的接口的IP地址,连接到
- ///服务器是服务器被告知连接到地址
- ///,如果后面的NAT设备,可能无法访问
- ///服务器。这种类型的数据连接的不支持
- ///通过了IPv6。如果指定端口,并通过IPv6连接
- /// EPRT将自动替代使用。
- /// </summary>
- PORT,
- /// <summary>
- ///扩展有效的数据连接,不推荐
- ///除非你有使用此特定的原因
- ///类型。创建客户端上的监听套接字
- ///这需要在客户端防火墙例外
- ///连接到时以及客户端网络
- ///客户端的网络之外的服务器。服务器
- ///连接到IP地址它看到客户正在添加
- ///而来。这种类型的数据连接的支持IPv4和IPv6。
- /// </summary>
- EPRT
- }
- /// <summary>
- /// 数据传输类型
- /// Type of data transfer to do
- /// </summary>
- public enum FtpDataType {
- /// <summary>
- /// ASCII transfer
- /// </summary>
- ASCII,
- /// <summary>
- /// Binary transfer
- /// </summary>
- Binary
- }
- /// <summary>
- /// Type of file system of object
- /// </summary>
- public enum FtpFileSystemObjectType {
- /// <summary>
- /// A file
- /// </summary>
- File,
- /// <summary>
- /// A directory
- /// </summary>
- Directory,
- /// <summary>
- /// A symbolic link
- /// </summary>
- Link
- }
-
- /// <summary>
- /// Types of file permissions
- /// </summary>
- [Flags]
- public enum FtpPermission : uint {
- /// <summary>
- /// No access
- /// </summary>
- None = 0,
- /// <summary>
- /// Executable
- /// </summary>
- Execute = 1,
- /// <summary>
- /// Writeable
- /// </summary>
- Write = 2,
- /// <summary>
- /// Readable
- /// </summary>
- Read = 4
- }
- /// <summary>
- /// Types of special UNIX permissions
- /// </summary>
- [Flags]
- public enum FtpSpecialPermissions : int {
- /// <summary>
- /// No special permissions are set
- /// </summary>
- None = 0,
- /// <summary>
- /// Sticky bit is set
- /// </summary>
- Sticky = 1,
- /// <summary>
- /// SGID bit is set
- /// </summary>
- SetGroupID = 2,
- /// <summary>
- /// SUID bit is set
- /// </summary>
- SetUserID = 4
- }
-
- /// <summary>
- /// Flags that can dicate how a file listing is performed
- /// </summary>
- [Flags]
- public enum FtpListOption {
- /// <summary>
- /// Load the modify date using MDTM when it could not
- /// be parsed from the server listing. This only pertains
- /// to servers that do not implement the MLSD command.
- /// </summary>
- Modify = 1,
- /// <summary>
- /// Load the file size using the SIZE command when it
- /// could not be parsed from the server listing. This
- /// only pertains to servers that do not support the
- /// MLSD command.
- /// </summary>
- Size = 2,
- /// <summary>
- /// Combines the Modify and Size flags
- /// </summary>
- SizeModify = Modify | Size,
- /// <summary>
- /// Show hidden/dot files. This only pertains to servers
- /// that do not support the MLSD command. This option
- /// makes use the non standard -a parameter to LIST to
- /// tell the server to show hidden files. Since it's a
- /// non-standard option it may not always work. MLSD listings
- /// have no such option and whether or not a hidden file is
- /// shown is at the discretion of the server.
- /// </summary>
- AllFiles = 4,
- /// <summary>
- /// Force the use of the NLST command even if MLSD
- /// is supported by the server
- /// </summary>
- ForceList = 8,
- /// <summary>
- /// Use the NLST command instead of LIST for a reliable file listing
- /// </summary>
- NameList = 16,
- /// <summary>
- /// Combines the ForceList and NameList flags
- /// </summary>
- ForceNameList = ForceList | NameList,
- /// <summary>
- /// Try to dereference symbolic links
- /// </summary>
- DerefLinks = 32,
- /// <summary>
- /// Sets the ForceList flag and uses `LS' instead of `LIST' as the
- /// command for getting a directory listing. This option overrides
- /// ForceNameList and ignores the AllFiles flag.
- /// </summary>
- UseLS = 64 | ForceList,
- /// <summary>
- /// Adds the -r option to the list command. Some servers may not
- /// support this feature.
- /// </summary>
- Recursive = 128,
- /// <summary>
- /// Do not retrieve path when no path is supplied to GetListing(),
- /// instead just execute LIST with no path argument.
- /// </summary>
- NoPath = 256
- }
- }
|