IFtpClient.cs 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. using System.IO;
  2. using System.Text;
  3. using System.Security.Cryptography.X509Certificates;
  4. namespace System.Net.FtpClient
  5. {
  6. /// <summary>
  7. /// FTP Control Connection. Speaks the FTP protocol with the server and
  8. /// provides facilities for performing basic transactions.
  9. ///
  10. /// Debugging problems with FTP transactions is much easier to do when
  11. /// you can see exactly what is sent to the server and the reply
  12. /// System.Net.FtpClient gets in return. Please review the Debug example
  13. /// below for information on how to add TraceListeners for capturing
  14. /// the convorsation between System.Net.FtpClient and the server.
  15. /// </summary>
  16. /// <example>The following example illustrates how to assist in debugging
  17. /// System.Net.FtpClient by getting a transaction log from the server.
  18. /// <code source="..\Examples\Debug.cs" lang="cs" />
  19. /// </example>
  20. /// <example>The following example demonstrates adding a custom file
  21. /// listing parser in the event that you encounter a list format
  22. /// not already supported.
  23. /// <code source="..\Examples\CustomParser.cs" lang="cs" />
  24. /// </example>
  25. /// <example>The following example demonstrates how to validate
  26. /// a SSL certificate when using SSL/TLS.
  27. /// <code source="..\Examples\ValidateCertificate.cs" lang="cs" />
  28. /// </example>
  29. /// <example>The following example demonsrates how to download a file.
  30. /// <code source="..\Examples\OpenRead.cs" lang="cs" />
  31. /// </example>
  32. /// <example>The following example demonstrates how to download a file
  33. /// using a URI object.
  34. /// <code source="..\Examples\OpenReadURI.cs" lang="cs" />
  35. /// </example>
  36. /// <example>The following example demonstrates how to upload a file.
  37. /// <code source="..\Examples\OpenWrite.cs" lang="cs" />
  38. /// </example>
  39. /// <example>The following example demonstrates how to upload a file
  40. /// using a URI object.
  41. /// <code source="..\Examples\OpenWriteURI.cs" lang="cs" />
  42. /// </example>
  43. /// <example>The following example demonstrates how to append to a file.
  44. /// <code source="..\Examples\OpenAppend.cs" lang="cs" />
  45. /// </example>
  46. /// <example>The following example demonstrates how to append to a file
  47. /// using a URI object.
  48. /// <code source="..\Examples\OpenAppendURI.cs" lang="cs" />
  49. /// </example>
  50. /// <example>The following example demonstrates how to get a file
  51. /// listing from the server.
  52. /// <code source="..\Examples\GetListing.cs" lang="cs" />
  53. /// </example>
  54. public interface IFtpClient : IDisposable
  55. {
  56. /// <summary>
  57. /// Gets a value indicating if this object has already been disposed.
  58. /// </summary>
  59. bool IsDisposed { get; }
  60. /// <summary>
  61. /// Flags specifying which versions of the internet protocol to
  62. /// support when making a connection. All addresses returned during
  63. /// name resolution are tried until a successful connection is made.
  64. /// You can fine tune which versions of the internet protocol to use
  65. /// by adding or removing flags here. I.e., setting this property
  66. /// to FtpIpVersion.IPv4 will cause the connection process to
  67. /// ignore IPv6 addresses. The default value is ANY version.
  68. /// </summary>
  69. FtpIpVersion InternetProtocolVersions { get; set; }
  70. /// <summary>
  71. /// Gets or sets the length of time in miliseconds
  72. /// that must pass since the last socket activity
  73. /// before calling Poll() on the socket to test for
  74. /// connectivity. Setting this interval too low will
  75. /// have a negative impact on perfomance. Setting this
  76. /// interval to 0 disables Poll()'ing all together.
  77. /// The default value is 15 seconds.
  78. /// </summary>
  79. int SocketPollInterval { get; set; }
  80. /// <summary>
  81. /// Gets or sets a value indicating whether a test should be performed to
  82. /// see if there is stale (unrequested data) sitting on the socket. In some
  83. /// cases the control connection may time out but before the server closes
  84. /// the connection it might send a 4xx response that was unexpected and
  85. /// can cause synchronization errors with transactions. To avoid this
  86. /// problem the Execute() method checks to see if there is any data
  87. /// available on the socket before executing a command. On Azure hosting
  88. /// platforms this check can cause an exception to be thrown. In order
  89. /// to work around the exception you can set this property to false
  90. /// which will skip the test entirely however doing so eliminates the
  91. /// best effort attempt of detecting such scenarios. See this thread
  92. /// for more details about the Azure problem:
  93. /// https://netftp.codeplex.com/discussions/535879
  94. /// </summary>
  95. bool StaleDataCheck { get; set; }
  96. /// <summary>
  97. /// Gets a value indicating if the connection is alive
  98. /// </summary>
  99. bool IsConnected { get; }
  100. /// <summary>
  101. /// When this value is set to true (default) the control connection
  102. /// is cloned and a new connection the server is established for the
  103. /// data channel operation. This is a thread safe approach to make
  104. /// asynchronous operations on a single control connection transparent
  105. /// to the developer.
  106. /// </summary>
  107. bool EnableThreadSafeDataConnections { get; set; }
  108. /// <summary>
  109. /// Gets or sets the text encoding being used when talking with the server. The default
  110. /// value is Encoding.ASCII however upon connection, the client checks
  111. /// for UTF8 support and if it's there this property is switched over to
  112. /// Encoding.UTF8. Manually setting this value overrides automatic detection
  113. /// based on the FEAT list; if you change this value it's always used
  114. /// regardless of what the server advertises, if anything.
  115. /// </summary>
  116. Encoding Encoding { get; set; }
  117. /// <summary>
  118. /// The server to connect to
  119. /// </summary>
  120. string Host { get; set; }
  121. /// <summary>
  122. /// The port to connect to. If this value is set to 0 (Default) the port used
  123. /// will be determined by the type of SSL used or if no SSL is to be used it
  124. /// will automatically connect to port 21.
  125. /// </summary>
  126. int Port { get; set; }
  127. /// <summary>
  128. /// Credentials used for authentication
  129. /// </summary>
  130. NetworkCredential Credentials { get; set; }
  131. /// <summary>
  132. /// Gets or sets a value that controls the maximum depth
  133. /// of recursion that DereferenceLink() will follow symbolic
  134. /// links before giving up. You can also specify the value
  135. /// to be used as one of the overloaded parameters to the
  136. /// DereferenceLink() method. The default value is 20. Specifying
  137. /// -1 here means inifinitly try to resolve a link. This is
  138. /// not recommended for obvious reasons (stack overflow).
  139. /// </summary>
  140. int MaximumDereferenceCount { get; set; }
  141. /// <summary>
  142. /// Client certificates to be used in SSL authentication process
  143. /// </summary>
  144. X509CertificateCollection ClientCertificates { get; }
  145. /// <summary>
  146. /// Data connection type, default is AutoPassive which tries
  147. /// a connection with EPSV first and if it fails then tries
  148. /// PASV before giving up. If you know exactly which kind of
  149. /// connection you need you can slightly increase performance
  150. /// by defining a speicific type of passive or active data
  151. /// connection here.
  152. /// </summary>
  153. FtpDataConnectionType DataConnectionType { get; set; }
  154. /// <summary>
  155. /// Disconnect from the server without sending QUIT. This helps
  156. /// work around IOExceptions caused by buggy connection resets
  157. /// when closing the control connection.
  158. /// </summary>
  159. bool UngracefullDisconnection { get; set; }
  160. /// <summary>
  161. /// Gets or sets the length of time in miliseconds to wait for a connection
  162. /// attempt to succeed before giving up. Default is 15000 (15 seconds).
  163. /// </summary>
  164. int ConnectTimeout { get; set; }
  165. /// <summary>
  166. /// Gets or sets the length of time wait in miliseconds for data to be
  167. /// read from the underlying stream. The default value is 15000 (15 seconds).
  168. /// </summary>
  169. int ReadTimeout { get; set; }
  170. /// <summary>
  171. /// Gets or sets the length of time in miliseconds for a data connection
  172. /// to be established before giving up. Default is 15000 (15 seconds).
  173. /// </summary>
  174. int DataConnectionConnectTimeout { get; set; }
  175. /// <summary>
  176. /// Gets or sets the length of time in miliseconds the data channel
  177. /// should wait for the server to send data. Default value is
  178. /// 15000 (15 seconds).
  179. /// </summary>
  180. int DataConnectionReadTimeout { get; set; }
  181. /// <summary>
  182. /// Gets or sets a value indicating if SocketOption.KeepAlive should be set on
  183. /// the underlying stream's socket. If the connection is alive, the option is
  184. /// adjusted in real-time. The value is stored and the KeepAlive option is set
  185. /// accordingly upon any new connections. The value set here is also applied to
  186. /// all future data streams. It has no affect on cloned control connections or
  187. /// data connections already in progress. The default value is false.
  188. /// </summary>
  189. bool SocketKeepAlive { get; set; }
  190. /// <summary>
  191. /// Gets the server capabilties represented by flags
  192. /// </summary>
  193. FtpCapability Capabilities { get; }
  194. /// <summary>
  195. /// Get the hash types supported by the server, if any. This
  196. /// is a recent extension to the protocol that is not fully
  197. /// standardized and is not guarateed to work. See here for
  198. /// more details:
  199. /// http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
  200. /// </summary>
  201. FtpHashAlgorithm HashAlgorithms { get; }
  202. /// <summary>
  203. /// Type of SSL to use, or none. Default is none. Explicit is TLS, Implicit is SSL.
  204. /// </summary>
  205. FtpEncryptionMode EncryptionMode { get; set; }
  206. /// <summary>
  207. /// Indicates if data channel transfers should be encrypted. Only valid if EncryptionMode
  208. /// property is not equal to FtpSslMode.None.
  209. /// </summary>
  210. bool DataConnectionEncryption { get; set; }
  211. /// <summary>
  212. /// Gets the type of system/server that we're
  213. /// connected to.
  214. /// </summary>
  215. string SystemType { get; }
  216. /// <summary>
  217. /// Event is fired to validate SSL certificates. If this event is
  218. /// not handled and there are errors validating the certificate
  219. /// the connection will be aborted.
  220. /// </summary>
  221. /// <example><code source="..\Examples\ValidateCertificate.cs" lang="cs" /></example>
  222. event FtpSslValidation ValidateCertificate;
  223. /// <summary>
  224. /// Performs a bitwise and to check if the specified
  225. /// flag is set on the Capabilities enum property.
  226. /// </summary>
  227. /// <param name="cap">The capability to check for</param>
  228. /// <returns>True if the feature was found</returns>
  229. bool HasFeature(FtpCapability cap);
  230. /// <summary>
  231. /// Executes a command
  232. /// </summary>
  233. /// <param name="command">The command to execute with optional format place holders</param>
  234. /// <param name="args">Format parameters to the command</param>
  235. /// <returns>The servers reply to the command</returns>
  236. /// <example><code source="..\Examples\Execute.cs" lang="cs" /></example>
  237. FtpReply Execute(string command, params object[] args);
  238. /// <summary>
  239. /// Executes a command
  240. /// </summary>
  241. /// <param name="command">The command to execute</param>
  242. /// <returns>The servers reply to the command</returns>
  243. /// <example><code source="..\Examples\Execute.cs" lang="cs" /></example>
  244. FtpReply Execute(string command);
  245. /// <summary>
  246. /// Performs an asynchronouse execution of the specified command
  247. /// </summary>
  248. /// <param name="command">The command to execute</param>
  249. /// <param name="callback">The AsyncCallback method</param>
  250. /// <param name="state">State object</param>
  251. /// <returns>IAsyncResult</returns>
  252. /// <example><code source="..\Examples\BeginExecute.cs" lang="cs" /></example>
  253. IAsyncResult BeginExecute(string command, AsyncCallback callback, object state);
  254. /// <summary>
  255. /// Ends an asynchronous command
  256. /// </summary>
  257. /// <param name="ar">IAsyncResult returned from BeginExecute</param>
  258. /// <returns>FtpReply object (never null).</returns>
  259. /// <example><code source="..\Examples\BeginExecute.cs" lang="cs" /></example>
  260. FtpReply EndExecute(IAsyncResult ar);
  261. /// <summary>
  262. /// Connect to the server. Throws ObjectDisposedException if this object has been disposed.
  263. /// </summary>
  264. /// <example><code source="..\Examples\Connect.cs" lang="cs" /></example>
  265. void Connect();
  266. /// <summary>
  267. /// Initiates a connection to the server
  268. /// </summary>
  269. /// <param name="callback">AsyncCallback method</param>
  270. /// <param name="state">State object</param>
  271. /// <returns>IAsyncResult</returns>
  272. /// <example><code source="..\Examples\BeginConnect.cs" lang="cs" /></example>
  273. IAsyncResult BeginConnect(AsyncCallback callback, object state);
  274. /// <summary>
  275. /// Ends an asynchronous connection attempt to the server
  276. /// </summary>
  277. /// <param name="ar">IAsyncResult returned from BeginConnect()</param>
  278. /// <example><code source="..\Examples\BeginConnect.cs" lang="cs" /></example>
  279. void EndConnect(IAsyncResult ar);
  280. /// <summary>
  281. /// Disconnect from the server
  282. /// </summary>
  283. void Disconnect();
  284. /// <summary>
  285. /// Initiates a disconnection on the server
  286. /// </summary>
  287. /// <param name="callback">AsyncCallback method</param>
  288. /// <param name="state">State object</param>
  289. /// <returns>IAsyncResult</returns>
  290. /// <example><code source="..\Examples\BeginDisconnect.cs" lang="cs" /></example>
  291. IAsyncResult BeginDisconnect(AsyncCallback callback, object state);
  292. /// <summary>
  293. /// Ends a call to BeginDisconnect
  294. /// </summary>
  295. /// <param name="ar">IAsyncResult returned from BeginDisconnect</param>
  296. /// <example><code source="..\Examples\BeginConnect.cs" lang="cs" /></example>
  297. void EndDisconnect(IAsyncResult ar);
  298. /// <summary>
  299. /// Opens the specified file for reading
  300. /// </summary>
  301. /// <param name="path">The full or relative path of the file</param>
  302. /// <returns>A stream for reading the file on the server</returns>
  303. /// <example><code source="..\Examples\OpenRead.cs" lang="cs" /></example>
  304. Stream OpenRead(string path);
  305. /// <summary>
  306. /// Opens the specified file for reading
  307. /// </summary>
  308. /// <param name="path">The full or relative path of the file</param>
  309. /// <param name="type">ASCII/Binary</param>
  310. /// <returns>A stream for reading the file on the server</returns>
  311. /// <example><code source="..\Examples\OpenRead.cs" lang="cs" /></example>
  312. Stream OpenRead(string path, FtpDataType type);
  313. /// <summary>
  314. /// Opens the specified file for reading
  315. /// </summary>
  316. /// <param name="path">The full or relative path of the file</param>
  317. /// <param name="restart">Resume location</param>
  318. /// <returns>A stream for reading the file on the server</returns>
  319. /// <example><code source="..\Examples\OpenRead.cs" lang="cs" /></example>
  320. Stream OpenRead(string path, long restart);
  321. /// <summary>
  322. /// Opens the specified file for reading
  323. /// </summary>
  324. /// <param name="path">The full or relative path of the file</param>
  325. /// <param name="type">ASCII/Binary</param>
  326. /// <param name="restart">Resume location</param>
  327. /// <returns>A stream for reading the file on the server</returns>
  328. /// <example><code source="..\Examples\OpenRead.cs" lang="cs" /></example>
  329. Stream OpenRead(string path, FtpDataType type, long restart);
  330. /// <summary>
  331. /// Opens the specified file for reading
  332. /// </summary>
  333. /// <param name="path">The full or relative path of the file</param>
  334. /// <param name="callback">Async Callback</param>
  335. /// <param name="state">State object</param>
  336. /// <returns>IAsyncResult</returns>
  337. /// <example><code source="..\Examples\BeginOpenRead.cs" lang="cs" /></example>
  338. IAsyncResult BeginOpenRead(string path, AsyncCallback callback, object state);
  339. /// <summary>
  340. /// Opens the specified file for reading
  341. /// </summary>
  342. /// <param name="path">The full or relative path of the file</param>
  343. /// <param name="type">ASCII/Binary</param>
  344. /// <param name="callback">Async Callback</param>
  345. /// <param name="state">State object</param>
  346. /// <returns>IAsyncResult</returns>
  347. /// <example><code source="..\Examples\BeginOpenRead.cs" lang="cs" /></example>
  348. IAsyncResult BeginOpenRead(string path, FtpDataType type, AsyncCallback callback, object state);
  349. /// <summary>
  350. /// Opens the specified file for reading
  351. /// </summary>
  352. /// <param name="path">The full or relative path of the file</param>
  353. /// <param name="restart">Resume location</param>
  354. /// <param name="callback">Async Callback</param>
  355. /// <param name="state">State object</param>
  356. /// <returns>IAsyncResult</returns>
  357. /// <example><code source="..\Examples\BeginOpenRead.cs" lang="cs" /></example>
  358. IAsyncResult BeginOpenRead(string path, long restart, AsyncCallback callback, object state);
  359. /// <summary>
  360. /// Opens the specified file for reading
  361. /// </summary>
  362. /// <param name="path">The full or relative path of the file</param>
  363. /// <param name="type">ASCII/Binary</param>
  364. /// <param name="restart">Resume location</param>
  365. /// <param name="callback">Async Callback</param>
  366. /// <param name="state">State object</param>
  367. /// <returns>IAsyncResult</returns>
  368. /// <example><code source="..\Examples\BeginOpenRead.cs" lang="cs" /></example>
  369. IAsyncResult BeginOpenRead(string path, FtpDataType type, long restart, AsyncCallback callback, object state);
  370. /// <summary>
  371. /// Ends a call to BeginOpenRead()
  372. /// </summary>
  373. /// <param name="ar">IAsyncResult returned from BeginOpenRead()</param>
  374. /// <returns>A readable stream</returns>
  375. /// <example><code source="..\Examples\BeginOpenRead.cs" lang="cs" /></example>
  376. Stream EndOpenRead(IAsyncResult ar);
  377. /// <summary>
  378. /// Opens the specified file for writing
  379. /// </summary>
  380. /// <param name="path">Full or relative path of the file</param>
  381. /// <returns>A stream for writing to the file on the server</returns>
  382. /// <example><code source="..\Examples\OpenWrite.cs" lang="cs" /></example>
  383. Stream OpenWrite(string path);
  384. /// <summary>
  385. /// Opens the specified file for writing
  386. /// </summary>
  387. /// <param name="path">Full or relative path of the file</param>
  388. /// <param name="type">ASCII/Binary</param>
  389. /// <returns>A stream for writing to the file on the server</returns>
  390. /// <example><code source="..\Examples\OpenWrite.cs" lang="cs" /></example>
  391. Stream OpenWrite(string path, FtpDataType type);
  392. /// <summary>
  393. /// Opens the specified file for writing
  394. /// </summary>
  395. /// <param name="path">Full or relative path of the file</param>
  396. /// <param name="callback">Async callback</param>
  397. /// <param name="state">State object</param>
  398. /// <returns>IAsyncResult</returns>
  399. /// <example><code source="..\Examples\BeginOpenWrite.cs" lang="cs" /></example>
  400. IAsyncResult BeginOpenWrite(string path, AsyncCallback callback, object state);
  401. /// <summary>
  402. /// Opens the specified file for writing
  403. /// </summary>
  404. /// <param name="path">Full or relative path of the file</param>
  405. /// <param name="type">ASCII/Binary</param>
  406. /// <param name="callback">Async callback</param>
  407. /// <param name="state">State object</param>
  408. /// <returns>IAsyncResult</returns>
  409. /// <example><code source="..\Examples\BeginOpenWrite.cs" lang="cs" /></example>
  410. IAsyncResult BeginOpenWrite(string path, FtpDataType type, AsyncCallback callback, object state);
  411. /// <summary>
  412. /// Ends a call to BeginOpenWrite()
  413. /// </summary>
  414. /// <param name="ar">IAsyncResult returned from BeginOpenWrite()</param>
  415. /// <returns>A writable stream</returns>
  416. /// <example><code source="..\Examples\BeginOpenWrite.cs" lang="cs" /></example>
  417. Stream EndOpenWrite(IAsyncResult ar);
  418. /// <summary>
  419. /// Opens the specified file to be appended to
  420. /// </summary>
  421. /// <param name="path">The full or relative path to the file to be opened</param>
  422. /// <returns>A stream for writing to the file on the server</returns>
  423. /// <example><code source="..\Examples\OpenAppend.cs" lang="cs" /></example>
  424. Stream OpenAppend(string path);
  425. /// <summary>
  426. /// Opens the specified file to be appended to
  427. /// </summary>
  428. /// <param name="path">The full or relative path to the file to be opened</param>
  429. /// <param name="type">ASCII/Binary</param>
  430. /// <returns>A stream for writing to the file on the server</returns>
  431. /// <example><code source="..\Examples\OpenAppend.cs" lang="cs" /></example>
  432. Stream OpenAppend(string path, FtpDataType type);
  433. /// <summary>
  434. /// Opens the specified file for writing
  435. /// </summary>
  436. /// <param name="path">Full or relative path of the file</param>
  437. /// <param name="callback">Async callback</param>
  438. /// <param name="state">State object</param>
  439. /// <returns>IAsyncResult</returns>
  440. /// <example><code source="..\Examples\BeginOpenAppend.cs" lang="cs" /></example>
  441. IAsyncResult BeginOpenAppend(string path, AsyncCallback callback, object state);
  442. /// <summary>
  443. /// Opens the specified file for writing
  444. /// </summary>
  445. /// <param name="path">Full or relative path of the file</param>
  446. /// <param name="type">ASCII/Binary</param>
  447. /// <param name="callback">Async callback</param>
  448. /// <param name="state">State object</param>
  449. /// <returns>IAsyncResult</returns>
  450. /// <example><code source="..\Examples\BeginOpenAppend.cs" lang="cs" /></example>
  451. IAsyncResult BeginOpenAppend(string path, FtpDataType type, AsyncCallback callback, object state);
  452. /// <summary>
  453. /// Ends a call to BeginOpenAppend()
  454. /// </summary>
  455. /// <param name="ar">IAsyncResult returned from BeginOpenWrite()</param>
  456. /// <returns>A writable stream</returns>
  457. /// <example><code source="..\Examples\BeginOpenAppend.cs" lang="cs" /></example>
  458. Stream EndOpenAppend(IAsyncResult ar);
  459. /// <summary>
  460. /// Recursively dereferences a symbolic link. See the
  461. /// MaximumDereferenceCount property for controlling
  462. /// how deep this method will recurse before giving up.
  463. /// </summary>
  464. /// <param name="item">The symbolic link</param>
  465. /// <returns>FtpListItem, null if the link can't be dereferenced</returns>
  466. /// <example><code source="..\Examples\DereferenceLink.cs" lang="cs" /></example>
  467. FtpListItem DereferenceLink(FtpListItem item);
  468. /// <summary>
  469. /// Recursively dereferences a symbolic link
  470. /// </summary>
  471. /// <param name="item">The symbolic link</param>
  472. /// <param name="recMax">The maximum depth of recursion that can be performed before giving up.</param>
  473. /// <returns>FtpListItem, null if the link can't be dereferenced</returns>
  474. /// <example><code source="..\Examples\DereferenceLink.cs" lang="cs" /></example>
  475. FtpListItem DereferenceLink(FtpListItem item, int recMax);
  476. /// <summary>
  477. /// Derefence a FtpListItem object asynchronously
  478. /// </summary>
  479. /// <param name="item">The item to derefence</param>
  480. /// <param name="recMax">Maximum recursive calls</param>
  481. /// <param name="callback">AsyncCallback</param>
  482. /// <param name="state">State Object</param>
  483. /// <returns>IAsyncResult</returns>
  484. /// <example><code source="..\Examples\BeginDereferenceLink.cs" lang="cs" /></example>
  485. IAsyncResult BeginDereferenceLink(FtpListItem item, int recMax, AsyncCallback callback, object state);
  486. /// <summary>
  487. /// Derefence a FtpListItem object asynchronously. See the
  488. /// MaximumDereferenceCount property for controlling
  489. /// how deep this method will recurse before giving up.
  490. /// </summary>
  491. /// <param name="item">The item to derefence</param>
  492. /// <param name="callback">AsyncCallback</param>
  493. /// <param name="state">State Object</param>
  494. /// <returns>IAsyncResult</returns>
  495. /// <example><code source="..\Examples\BeginDereferenceLink.cs" lang="cs" /></example>
  496. IAsyncResult BeginDereferenceLink(FtpListItem item, AsyncCallback callback, object state);
  497. /// <summary>
  498. /// Ends a call to BeginDereferenceLink
  499. /// </summary>
  500. /// <param name="ar">IAsyncResult</param>
  501. /// <returns>FtpListItem, null if the link can't be dereferenced</returns>
  502. /// <example><code source="..\Examples\BeginDereferenceLink.cs" lang="cs" /></example>
  503. FtpListItem EndDereferenceLink(IAsyncResult ar);
  504. /// <summary>
  505. /// Returns information about a file system object. You should check the Capabilities
  506. /// flags for the FtpCapability.MLSD flag before calling this method. Failing to do
  507. /// so will result in an InvalidOperationException being thrown when the server
  508. /// does not support machine listings. Returns null if the server response can't
  509. /// be parsed or the server returns a failure completion code. The error for a failure
  510. /// is logged with FtpTrace. No exception is thrown on error because that would negate
  511. /// the usefullness of this method for checking for the existence of an object.
  512. /// </summary>
  513. /// <param name="path">The path of the object to retrieve information about</param>
  514. /// <returns>A FtpListItem object</returns>
  515. FtpListItem GetObjectInfo(string path);
  516. /// <summary>
  517. /// Returns information about a file system object. You should check the Capabilities
  518. /// flags for the FtpCapability.MLSD flag before calling this method. Failing to do
  519. /// so will result in an InvalidOperationException being thrown when the server
  520. /// does not support machine listings. Returns null if the server response can't
  521. /// be parsed or the server returns a failure completion code. The error for a failure
  522. /// is logged with FtpTrace. No exception is thrown on error because that would negate
  523. /// the usefullness of this method for checking for the existence of an object.
  524. /// </summary>
  525. /// <param name="path">Path of the item to retrieve information about</param>
  526. /// <param name="callback">Async Callback</param>
  527. /// <param name="state">State object</param>
  528. /// <returns>IAsyncResult</returns>
  529. IAsyncResult BeginGetObjectInfo(string path, AsyncCallback callback, object state);
  530. /// <summary>
  531. /// Ends a call to BeginGetObjectInfo
  532. /// </summary>
  533. /// <param name="ar">IAsyncResult returned from BeginGetObjectInfo</param>
  534. /// <returns>FtpListItem if the command succeeded, null if there was a problem.</returns>
  535. FtpListItem EndGetObjectInfo(IAsyncResult ar);
  536. /// <summary>
  537. /// Gets a file listing from the server. Each FtpListItem object returned
  538. /// contains information about the file that was able to be retrieved. If
  539. /// a DateTime property is equal to DateTime.MinValue then it means the
  540. /// date in question was not able to be retrieved. If the Size property
  541. /// is equal to 0 then it means the size of the object could also not
  542. /// be retrieved.
  543. /// </summary>
  544. /// <returns>An array of FtpListItem objects</returns>
  545. /// <example><code source="..\Examples\GetListing.cs" lang="cs" /></example>
  546. FtpListItem[] GetListing();
  547. /// <summary>
  548. /// Gets a file listing from the server. Each FtpListItem object returned
  549. /// contains information about the file that was able to be retrieved. If
  550. /// a DateTime property is equal to DateTime.MinValue then it means the
  551. /// date in question was not able to be retrieved. If the Size property
  552. /// is equal to 0 then it means the size of the object could also not
  553. /// be retrieved.
  554. /// </summary>
  555. /// <param name="path">The path of the directory to list</param>
  556. /// <returns>An array of FtpListItem objects</returns>
  557. /// <example><code source="..\Examples\GetListing.cs" lang="cs" /></example>
  558. FtpListItem[] GetListing(string path);
  559. /// <summary>
  560. /// Gets a file listing from the server. Each FtpListItem object returned
  561. /// contains information about the file that was able to be retrieved. If
  562. /// a DateTime property is equal to DateTime.MinValue then it means the
  563. /// date in question was not able to be retrieved. If the Size property
  564. /// is equal to 0 then it means the size of the object could also not
  565. /// be retrieved.
  566. /// </summary>
  567. /// <param name="path">The path of the directory to list</param>
  568. /// <param name="options">Options that dictacte how a list is performed and what information is gathered.</param>
  569. /// <returns>An array of FtpListItem objects</returns>
  570. /// <example><code source="..\Examples\GetListing.cs" lang="cs" /></example>
  571. FtpListItem[] GetListing(string path, FtpListOption options);
  572. /// <summary>
  573. /// Gets a file listing from the server asynchronously
  574. /// </summary>
  575. /// <param name="callback">AsyncCallback method</param>
  576. /// <param name="state">State object</param>
  577. /// <returns>IAsyncResult</returns>
  578. /// <example><code source="..\Examples\BeginGetListing.cs" lang="cs" /></example>
  579. IAsyncResult BeginGetListing(AsyncCallback callback, Object state);
  580. /// <summary>
  581. /// Gets a file listing from the server asynchronously
  582. /// </summary>
  583. /// <param name="path">The path to list</param>
  584. /// <param name="callback">AsyncCallback method</param>
  585. /// <param name="state">State object</param>
  586. /// <returns>IAsyncResult</returns>
  587. /// <example><code source="..\Examples\BeginGetListing.cs" lang="cs" /></example>
  588. IAsyncResult BeginGetListing(string path, AsyncCallback callback, Object state);
  589. /// <summary>
  590. /// Gets a file listing from the server asynchronously
  591. /// </summary>
  592. /// <param name="path">The path to list</param>
  593. /// <param name="options">Options that dictate how the list operation is performed</param>
  594. /// <param name="callback">AsyncCallback method</param>
  595. /// <param name="state">State object</param>
  596. /// <returns>IAsyncResult</returns>
  597. /// <example><code source="..\Examples\BeginGetListing.cs" lang="cs" /></example>
  598. IAsyncResult BeginGetListing(string path, FtpListOption options, AsyncCallback callback, Object state);
  599. /// <summary>
  600. /// Ends an asynchronous file listing
  601. /// </summary>
  602. /// <param name="ar">IAsyncResult return from BeginGetListing()</param>
  603. /// <returns>An array of items retrieved in the listing</returns>
  604. /// <example><code source="..\Examples\BeginGetListing.cs" lang="cs" /></example>
  605. FtpListItem[] EndGetListing(IAsyncResult ar);
  606. /// <summary>
  607. /// Returns a file/directory listing using the NLST command.
  608. /// </summary>
  609. /// <returns>A string array of file and directory names if any were returned.</returns>
  610. string[] GetNameListing();
  611. /// <summary>
  612. /// Returns a file/directory listing using the NLST command.
  613. /// </summary>
  614. /// <param name="path">The path of the directory to list</param>
  615. /// <returns>A string array of file and directory names if any were returned.</returns>
  616. /// <example><code source="..\Examples\GetNameListing.cs" lang="cs" /></example>
  617. string[] GetNameListing(string path);
  618. /// <summary>
  619. /// Asynchronously gets a list of file and directory names for the specified path.
  620. /// </summary>
  621. /// <param name="path">The path of the directory to list</param>
  622. /// <param name="callback">Async Callback</param>
  623. /// <param name="state">State object</param>
  624. /// <returns>IAsyncResult</returns>
  625. /// <example><code source="..\Examples\BeginGetNameListing.cs" lang="cs" /></example>
  626. IAsyncResult BeginGetNameListing(string path, AsyncCallback callback, object state);
  627. /// <summary>
  628. /// Asynchronously gets a list of file and directory names for the specified path.
  629. /// </summary>
  630. /// <param name="callback">Async Callback</param>
  631. /// <param name="state">State object</param>
  632. /// <returns>IAsyncResult</returns>
  633. /// <example><code source="..\Examples\BeginGetNameListing.cs" lang="cs" /></example>
  634. IAsyncResult BeginGetNameListing(AsyncCallback callback, object state);
  635. /// <summary>
  636. /// Ends a call to BeginGetNameListing()
  637. /// </summary>
  638. /// <param name="ar">IAsyncResult object returned from BeginGetNameListing</param>
  639. /// <returns>An array of file and directory names if any were returned.</returns>
  640. /// <example><code source="..\Examples\BeginGetNameListing.cs" lang="cs" /></example>
  641. string[] EndGetNameListing(IAsyncResult ar);
  642. /// <summary>
  643. /// Sets the work directory on the server
  644. /// </summary>
  645. /// <param name="path">The path of the directory to change to</param>
  646. /// <example><code source="..\Examples\SetWorkingDirectory.cs" lang="cs" /></example>
  647. void SetWorkingDirectory(string path);
  648. /// <summary>
  649. /// Asynchronously changes the working directory on the server
  650. /// </summary>
  651. /// <param name="path">The directory to change to</param>
  652. /// <param name="callback">Async Callback</param>
  653. /// <param name="state">State object</param>
  654. /// <returns>IAsyncResult</returns>
  655. /// <example><code source="..\Examples\BeginSetWorkingDirectory.cs" lang="cs" /></example>
  656. IAsyncResult BeginSetWorkingDirectory(string path, AsyncCallback callback, object state);
  657. /// <summary>
  658. /// Ends asynchronous directory change
  659. /// </summary>
  660. /// <param name="ar">IAsyncResult returned from BeginSetWorkingDirectory</param>
  661. /// <example><code source="..\Examples\BeginSetWorkingDirectory.cs" lang="cs" /></example>
  662. void EndSetWorkingDirectory(IAsyncResult ar);
  663. /// <summary>
  664. /// Gets the current working directory
  665. /// </summary>
  666. /// <returns>The current working directory, ./ if the response couldn't be parsed.</returns>
  667. /// <example><code source="..\Examples\GetWorkingDirectory.cs" lang="cs" /></example>
  668. string GetWorkingDirectory();
  669. /// <summary>
  670. /// Asynchronously retrieves the working directory
  671. /// </summary>
  672. /// <param name="callback">Async callback</param>
  673. /// <param name="state">State object</param>
  674. /// <returns>IAsyncResult</returns>
  675. /// <example><code source="..\Examples\BeginGetWorkingDirectory.cs" lang="cs" /></example>
  676. IAsyncResult BeginGetWorkingDirectory(AsyncCallback callback, object state);
  677. /// <summary>
  678. /// Ends an asynchronous call to retrieve the working directory
  679. /// </summary>
  680. /// <param name="ar">IAsyncResult returned from BeginGetWorkingDirectory</param>
  681. /// <returns>The current working directory</returns>
  682. /// <example><code source="..\Examples\BeginGetWorkingDirectory.cs" lang="cs" /></example>
  683. string EndGetWorkingDirectory(IAsyncResult ar);
  684. /// <summary>
  685. /// Gets the size of the file
  686. /// </summary>
  687. /// <param name="path">The full or relative path of the file</param>
  688. /// <returns>-1 if the command fails, otherwise the file size</returns>
  689. /// <example><code source="..\Examples\GetFileSize.cs" lang="cs" /></example>
  690. long GetFileSize(string path);
  691. /// <summary>
  692. /// Asynchronously retrieve the size of the specified file
  693. /// </summary>
  694. /// <param name="path">The full or relative path of the file</param>
  695. /// <param name="callback">Async callback</param>
  696. /// <param name="state">State object</param>
  697. /// <returns>IAsyncResult</returns>
  698. /// <example><code source="..\Examples\BeginGetFileSize.cs" lang="cs" /></example>
  699. IAsyncResult BeginGetFileSize(string path, AsyncCallback callback, object state);
  700. /// <summary>
  701. /// Ends a call to BeginGetFileSize()
  702. /// </summary>
  703. /// <param name="ar">IAsyncResult returned from BeginGetFileSize</param>
  704. /// <returns>The size of the file, -1 if there was a problem.</returns>
  705. /// <example><code source="..\Examples\BeginGetFileSize.cs" lang="cs" /></example>
  706. long EndGetFileSize(IAsyncResult ar);
  707. /// <summary>
  708. /// Gets the modified time of the file
  709. /// </summary>
  710. /// <param name="path">The full path to the file</param>
  711. /// <returns>The modified time, DateTime.MinValue if there was a problem</returns>
  712. /// <example><code source="..\Examples\GetModifiedTime.cs" lang="cs" /></example>
  713. DateTime GetModifiedTime(string path);
  714. /// <summary>
  715. /// Gets the modified time of the file
  716. /// </summary>
  717. /// <param name="path">The full path to the file</param>
  718. /// <param name="callback">Async callback</param>
  719. /// <param name="state">State object</param>
  720. /// <returns>IAsyncResult</returns>
  721. /// <example><code source="..\Examples\BeginGetModifiedTime.cs" lang="cs" /></example>
  722. IAsyncResult BeginGetModifiedTime(string path, AsyncCallback callback, object state);
  723. /// <summary>
  724. /// Ends a call to BeginGetModifiedTime()
  725. /// </summary>
  726. /// <param name="ar">IAsyncResult returned from BeginGetModifiedTime()</param>
  727. /// <returns>The modified time, DateTime.MinValue if there was a problem</returns>
  728. /// <example><code source="..\Examples\BeginGetModifiedTime.cs" lang="cs" /></example>
  729. DateTime EndGetModifiedTime(IAsyncResult ar);
  730. /// <summary>
  731. /// Deletes a file on the server
  732. /// </summary>
  733. /// <param name="path">The full or relative path to the file</param>
  734. /// <example><code source="..\Examples\DeleteFile.cs" lang="cs" /></example>
  735. void DeleteFile(string path);
  736. /// <summary>
  737. /// Asynchronously deletes a file from the server
  738. /// </summary>
  739. /// <param name="path">The full or relative path to the file</param>
  740. /// <param name="callback">Async callback</param>
  741. /// <param name="state">State object</param>
  742. /// <returns>IAsyncResult</returns>
  743. /// <example><code source="..\Examples\BeginDeleteFile.cs" lang="cs" /></example>
  744. IAsyncResult BeginDeleteFile(string path, AsyncCallback callback, object state);
  745. /// <summary>
  746. /// Ends a call to BeginDeleteFile
  747. /// </summary>
  748. /// <param name="ar">IAsyncResult returned from BeginDeleteFile</param>
  749. /// <example><code source="..\Examples\BeginDeleteFile.cs" lang="cs" /></example>
  750. void EndDeleteFile(IAsyncResult ar);
  751. /// <summary>
  752. /// Deletes the specified directory on the server.
  753. /// </summary>
  754. /// <param name="path">The full or relative path of the directory to delete</param>
  755. /// <example><code source="..\Examples\DeleteDirectory.cs" lang="cs" /></example>
  756. void DeleteDirectory(string path);
  757. /// <summary>
  758. /// Delets the specified directory on the server
  759. /// </summary>
  760. /// <param name="path">The full or relative path of the directory to delete</param>
  761. /// <param name="force">If the directory is not empty, remove its contents</param>
  762. /// <example><code source="..\Examples\DeleteDirectory.cs" lang="cs" /></example>
  763. void DeleteDirectory(string path, bool force);
  764. /// <summary>
  765. /// Deletes the specified directory on the server
  766. /// </summary>
  767. /// <param name="path">The full or relative path of the directory to delete</param>
  768. /// <param name="force">If the directory is not empty, remove its contents</param>
  769. /// <param name="options">FtpListOptions for controlling how the directory
  770. /// contents are retrieved with the force option is true. If you experience problems
  771. /// the file listing can be fine tuned through this parameter.</param>
  772. /// <example><code source="..\Examples\DeleteDirectory.cs" lang="cs" /></example>
  773. void DeleteDirectory(string path, bool force, FtpListOption options);
  774. /// <summary>
  775. /// Asynchronously removes a directory from the server
  776. /// </summary>
  777. /// <param name="path">The full or relative path of the directory to delete</param>
  778. /// <param name="callback">Async callback</param>
  779. /// <param name="state">State object</param>
  780. /// <returns>IAsyncResult</returns>
  781. /// <example><code source="..\Examples\BeginDeleteDirectory.cs" lang="cs" /></example>
  782. IAsyncResult BeginDeleteDirectory(string path, AsyncCallback callback, object state);
  783. /// <summary>
  784. /// Asynchronously removes a directory from the server
  785. /// </summary>
  786. /// <param name="path">The full or relative path of the directory to delete</param>
  787. /// <param name="force">If the directory is not empty, remove its contents</param>
  788. /// <param name="callback">Async callback</param>
  789. /// <param name="state">State object</param>
  790. /// <returns>IAsyncResult</returns>
  791. /// <example><code source="..\Examples\BeginDeleteDirectory.cs" lang="cs" /></example>
  792. IAsyncResult BeginDeleteDirectory(string path, bool force, AsyncCallback callback, object state);
  793. /// <summary>
  794. /// Asynchronously removes a directory from the server
  795. /// </summary>
  796. /// <param name="path">The full or relative path of the directory to delete</param>
  797. /// <param name="force">If the directory is not empty, remove its contents</param>
  798. /// <param name="options">FtpListOptions for controlling how the directory
  799. /// contents are retrieved with the force option is true. If you experience problems
  800. /// the file listing can be fine tuned through this parameter.</param>
  801. /// <param name="callback">Async callback</param>
  802. /// <param name="state">State object</param>
  803. /// <returns>IAsyncResult</returns>
  804. /// <example><code source="..\Examples\BeginDeleteDirectory.cs" lang="cs" /></example>
  805. IAsyncResult BeginDeleteDirectory(string path, bool force, FtpListOption options, AsyncCallback callback, object state);
  806. /// <summary>
  807. /// Ends a call to BeginDeleteDirectory()
  808. /// </summary>
  809. /// <param name="ar">IAsyncResult returned from BeginDeleteDirectory</param>
  810. /// <example><code source="..\Examples\BeginDeleteDirectory.cs" lang="cs" /></example>
  811. void EndDeleteDirectory(IAsyncResult ar);
  812. /// <summary>
  813. /// Tests if the specified directory exists on the server. This
  814. /// method works by trying to change the working directory to
  815. /// the path specified. If it succeeds, the directory is changed
  816. /// back to the old working directory and true is returned. False
  817. /// is returned otherwise and since the CWD failed it is assumed
  818. /// the working directory is still the same.
  819. /// </summary>
  820. /// <param name="path">The path of the directory</param>
  821. /// <returns>True if it exists, false otherwise.</returns>
  822. /// <example><code source="..\Examples\DirectoryExists.cs" lang="cs" /></example>
  823. bool DirectoryExists(string path);
  824. /// <summary>
  825. /// Checks if a directory exists on the server asynchronously.
  826. /// </summary>
  827. /// <returns>IAsyncResult</returns>
  828. /// <param name='path'>The full or relative path of the directory to check for</param>
  829. /// <param name='callback'>Async callback</param>
  830. /// <param name='state'>State object</param>
  831. /// <example><code source="..\Examples\BeginDirectoryExists.cs" lang="cs" /></example>
  832. IAsyncResult BeginDirectoryExists(string path, AsyncCallback callback, object state);
  833. /// <summary>
  834. /// Ends a call to BeginDirectoryExists
  835. /// </summary>
  836. /// <param name="ar">IAsyncResult returned from BeginDirectoryExists</param>
  837. /// <returns>True if the directory exists. False otherwise.</returns>
  838. /// <example><code source="..\Examples\BeginDirectoryExists.cs" lang="cs" /></example>
  839. bool EndDirectoryExists(IAsyncResult ar);
  840. /// <summary>
  841. /// Checks if a file exsts on the server by taking a
  842. /// file listing of the parent directory in the path
  843. /// and comparing the results the path supplied.
  844. /// </summary>
  845. /// <param name="path">The full or relative path to the file</param>
  846. /// <returns>True if the file exists</returns>
  847. /// <example><code source="..\Examples\FileExists.cs" lang="cs" /></example>
  848. bool FileExists(string path);
  849. /// <summary>
  850. /// Checks if a file exsts on the server by taking a
  851. /// file listing of the parent directory in the path
  852. /// and comparing the results the path supplied.
  853. /// </summary>
  854. /// <param name="path">The full or relative path to the file</param>
  855. /// <param name="options">Options for controling the file listing used to
  856. /// determine if the file exists.</param>
  857. /// <returns>True if the file exists</returns>
  858. /// <example><code source="..\Examples\FileExists.cs" lang="cs" /></example>
  859. bool FileExists(string path, FtpListOption options);
  860. /// <summary>
  861. /// Checks if a file exsts on the server by taking a
  862. /// file listing of the parent directory in the path
  863. /// and comparing the results the path supplied.
  864. /// </summary>
  865. /// <param name="path">The full or relative path to the file</param>
  866. /// <param name="callback">Async callback</param>
  867. /// <param name="state">State object</param>
  868. /// <returns>IAsyncResult</returns>
  869. /// <example><code source="..\Examples\BeginFileExists.cs" lang="cs" /></example>
  870. IAsyncResult BeginFileExists(string path, AsyncCallback callback, object state);
  871. /// <summary>
  872. /// Checks if a file exsts on the server by taking a
  873. /// file listing of the parent directory in the path
  874. /// and comparing the results the path supplied.
  875. /// </summary>
  876. /// <param name="path">The full or relative path to the file</param>
  877. /// <param name="options">Options for controling the file listing used to
  878. /// determine if the file exists.</param>
  879. /// <param name="callback">Async callback</param>
  880. /// <param name="state">State object</param>
  881. /// <returns>IAsyncResult</returns>
  882. /// <example><code source="..\Examples\BeginFileExists.cs" lang="cs" /></example>
  883. IAsyncResult BeginFileExists(string path, FtpListOption options, AsyncCallback callback, object state);
  884. /// <summary>
  885. /// Ends a call to BeginFileExists
  886. /// </summary>
  887. /// <param name="ar">IAsyncResult returned from BeginFileExists</param>
  888. /// <returns>True if the file exists</returns>
  889. /// <example><code source="..\Examples\BeginFileExists.cs" lang="cs" /></example>
  890. bool EndFileExists(IAsyncResult ar);
  891. /// <summary>
  892. /// Creates a directory on the server. If the preceding
  893. /// directories do not exist they are created.
  894. /// </summary>
  895. /// <param name="path">The full or relative path to the new directory</param>
  896. /// <example><code source="..\Examples\CreateDirectory.cs" lang="cs" /></example>
  897. void CreateDirectory(string path);
  898. /// <summary>
  899. /// Creates a directory on the server
  900. /// </summary>
  901. /// <param name="path">The full or relative path to the directory to create</param>
  902. /// <param name="force">Try to force all non-existant pieces of the path to be created</param>
  903. /// <example><code source="..\Examples\CreateDirectory.cs" lang="cs" /></example>
  904. void CreateDirectory(string path, bool force);
  905. /// <summary>
  906. /// Creates a directory asynchronously
  907. /// </summary>
  908. /// <param name="path">The full or relative path to the directory to create</param>
  909. /// <param name="callback">Async callback</param>
  910. /// <param name="state">State object</param>
  911. /// <returns>IAsyncResult</returns>
  912. /// <example><code source="..\Examples\BeginCreateDirectory.cs" lang="cs" /></example>
  913. IAsyncResult BeginCreateDirectory(string path, AsyncCallback callback, object state);
  914. /// <summary>
  915. /// Creates a directory asynchronously
  916. /// </summary>
  917. /// <param name="path">The full or relative path to the directory to create</param>
  918. /// <param name="force">Try to create the whole path if the preceding directories do not exist</param>
  919. /// <param name="callback">Async callback</param>
  920. /// <param name="state">State object</param>
  921. /// <returns>IAsyncResult</returns>
  922. /// <example><code source="..\Examples\BeginCreateDirectory.cs" lang="cs" /></example>
  923. IAsyncResult BeginCreateDirectory(string path, bool force, AsyncCallback callback, object state);
  924. /// <summary>
  925. /// Ends a call to BeginCreateDirectory
  926. /// </summary>
  927. /// <param name="ar">IAsyncResult returned from BeginCreateDirectory</param>
  928. /// <example><code source="..\Examples\BeginCreateDirectory.cs" lang="cs" /></example>
  929. void EndCreateDirectory(IAsyncResult ar);
  930. /// <summary>
  931. /// Renames an object on the remote file system.
  932. /// </summary>
  933. /// <param name="path">The full or relative path to the object</param>
  934. /// <param name="dest">The old or new full or relative path including the new name of the object</param>
  935. /// <example><code source="..\Examples\Rename.cs" lang="cs" /></example>
  936. void Rename(string path, string dest);
  937. /// <summary>
  938. /// Asynchronously renames an object on the server
  939. /// </summary>
  940. /// <param name="path">The full or relative path to the object</param>
  941. /// <param name="dest">The old or new full or relative path including the new name of the object</param>
  942. /// <param name="callback">Async callback</param>
  943. /// <param name="state">State object</param>
  944. /// <returns>IAsyncResult</returns>
  945. /// <example><code source="..\Examples\BeginRename.cs" lang="cs" /></example>
  946. IAsyncResult BeginRename(string path, string dest, AsyncCallback callback, object state);
  947. /// <summary>
  948. /// Ends a call to BeginRename
  949. /// </summary>
  950. /// <param name="ar">IAsyncResult returned from BeginRename</param>
  951. /// <example><code source="..\Examples\BeginRename.cs" lang="cs" /></example>
  952. void EndRename(IAsyncResult ar);
  953. /// <summary>
  954. /// Gets the currently selected hash algorith for the HASH
  955. /// command. This feature is experimental. See this link
  956. /// for details:
  957. /// http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
  958. /// </summary>
  959. /// <returns>The FtpHashType flag or FtpHashType.NONE if there was a problem.</returns>
  960. /// <example><code source="..\Examples\GetHashAlgorithm.cs" lang="cs" /></example>
  961. FtpHashAlgorithm GetHashAlgorithm();
  962. /// <summary>
  963. /// Asynchronously get the hash algorithm being used by the HASH command.
  964. /// </summary>
  965. /// <param name="callback">Async callback</param>
  966. /// <param name="state">State object</param>
  967. /// <returns>IAsyncResult</returns>
  968. IAsyncResult BeginGetHashAlgorithm(AsyncCallback callback, object state);
  969. /// <summary>
  970. /// Ends a call to BeginGetHashAlgorithm
  971. /// </summary>
  972. /// <param name="ar">IAsyncResult returned from BeginGetHashAlgorithm</param>
  973. FtpHashAlgorithm EndGetHashAlgorithm(IAsyncResult ar);
  974. /// <summary>
  975. /// Tells the server which hash algorith to use
  976. /// for the HASH command. If you specifiy an
  977. /// algorithm not listed in FtpClient.HashTypes
  978. /// a NotImplemented() exectpion will be thrown
  979. /// so be sure to query that list of Flags before
  980. /// selecting a hash algorithm. Support for the
  981. /// HASH command is experimental. Please see
  982. /// the following link for more details:
  983. /// http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
  984. /// </summary>
  985. /// <param name="type">Hash Algorithm</param>
  986. /// <example><code source="..\Examples\SetHashAlgorithm.cs" lang="cs" /></example>
  987. void SetHashAlgorithm(FtpHashAlgorithm type);
  988. /// <summary>
  989. /// Asynchronously sets the hash algorithm type to be used with the HASH command.
  990. /// </summary>
  991. /// <param name="type">Hash algorithm to use</param>
  992. /// <param name="callback">Async Callback</param>
  993. /// <param name="state">State object</param>
  994. /// <returns>IAsyncResult</returns>
  995. IAsyncResult BeginSetHashAlgorithm(FtpHashAlgorithm type, AsyncCallback callback, object state);
  996. /// <summary>
  997. /// Ends an asynchronous call to BeginSetHashAlgorithm
  998. /// </summary>
  999. /// <param name="ar">IAsyncResult returned from BeginSetHashAlgorithm</param>
  1000. void EndSetHashAlgorithm(IAsyncResult ar);
  1001. /// <summary>
  1002. /// Gets the hash of an object on the server using the
  1003. /// currently selected hash algorithm. Supported
  1004. /// algorithms, if any, are available in the HashAlgorithms
  1005. /// property. You should confirm that it's not equal
  1006. /// to FtpHashAlgorithm.NONE before calling this method
  1007. /// otherwise the server trigger a FtpCommandException()
  1008. /// due to a lack of support for the HASH command. You can
  1009. /// set the algorithm using the SetHashAlgorithm() method and
  1010. /// you can query the server for the current hash algorithm
  1011. /// using the GetHashAlgorithm() method.
  1012. ///
  1013. /// This feature is experimental and based on the following draft:
  1014. /// http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
  1015. /// </summary>
  1016. /// <param name="path">Full or relative path of the object to compute the hash for.</param>
  1017. /// <returns>The hash of the file.</returns>
  1018. /// <example><code source="..\Examples\GetHash.cs" lang="cs" /></example>
  1019. FtpHash GetHash(string path);
  1020. /// <summary>
  1021. /// Asynchronously retrieves the hash for the specified file
  1022. /// </summary>
  1023. /// <param name="path">The file you want the server to compute the hash for</param>
  1024. /// <param name="callback">AsyncCallback</param>
  1025. /// <param name="state">State object</param>
  1026. /// <returns>IAsyncResult</returns>
  1027. IAsyncResult BeginGetHash(string path, AsyncCallback callback, object state);
  1028. /// <summary>
  1029. /// Ends an asynchronous call to BeginGetHash
  1030. /// </summary>
  1031. /// <param name="ar">IAsyncResult returned from BeginGetHash</param>
  1032. void EndGetHash(IAsyncResult ar);
  1033. /// <summary>
  1034. /// Disables UTF8 support and changes the Encoding property
  1035. /// back to ASCII. If the server returns an error when trying
  1036. /// to turn UTF8 off a FtpCommandException will be thrown.
  1037. /// </summary>
  1038. void DisableUTF8();
  1039. }
  1040. }