public event ExtendedAsyncCompletedEventHandler<TResult> GetLastWriteTimeCompleted
Shows how to use GetLastWriteTimeAsync method to asynchrnously get modification time of a file on an FTP server (Task-based approach).
using System; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... // Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("test", "test"); // ... // Get modified date and time of the remote file '/test.dat'. DateTime modifiedDateTime = await client.GetLastWriteTimeAsync("/test.dat"); // ... Console.WriteLine("Modified date and time of '/test.dat' is: {0}", modifiedDateTime); // Disconnect. client.Disconnect();
Shows how to use GetLastWriteTimeAsync method to asynchrnously get modification time of a file on an FTP server (Event-based approach).
using System; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... static void Main() { // Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("test", "test"); // ... // Register an event handler. client.GetLastWriteTimeCompleted += client_GetLastWriteTimeCompleted; // Get modified date and time of the remote file '/test.dat'. client.GetLastWriteTimeAsync("/test.dat"); // ... // Disconnect. client.Disconnect(); } static void client_GetLastWriteTimeCompleted(object sender, ExtendedAsyncCompletedEventArgs<DateTime> e) { // Ftp client = (Ftp)sender; if (e.Error != null) Console.WriteLine("Error: " + e.Error.ToString()); else { DateTime modifiedDateTime = e.Result; Console.WriteLine("Modified date and time of '/test.dat' is: {0}", modifiedDateTime); } }
Shows how to use GetLastWriteTimeAsync method to asynchrnously get modification time of a file on an SFTP server (Task-based approach).
using System; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... // Create a new class instance. Sftp client = new Sftp(); // Connect to the SFTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("test", "test"); // ... // Get modified date and time of the remote file '/test.dat'. DateTime modifiedDateTime = await client.GetLastWriteTimeAsync("/test.dat"); // ... Console.WriteLine("Modified date and time of '/test.dat' is: {0}", modifiedDateTime); // Disconnect. client.Disconnect();
Shows how to use GetLastWriteTimeAsync method to asynchrnously get modification time of a file on an SFTP server (Event-based approach).
using System; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... static void Main() { // Create a new class instance. Sftp client = new Sftp(); // Connect to the SFTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("test", "test"); // ... // Register an event handler. client.GetLastWriteTimeCompleted += client_GetLastWriteTimeCompleted; // Get modified date and time of the remote file '/test.dat'. client.GetLastWriteTimeAsync("/test.dat"); // ... // Disconnect. client.Disconnect(); } static void client_GetLastWriteTimeCompleted(object sender, ExtendedAsyncCompletedEventArgs<DateTime> e) { // Sftp client = (Sftp)sender; if (e.Error != null) Console.WriteLine("Error: " + e.Error.ToString()); else { DateTime modifiedDateTime = e.Result; Console.WriteLine("Modified date and time of '/test.dat' is: {0}", modifiedDateTime); } }