//[Fact] public void StreamResponses() { using (var cl = NewFtpClient()) { cl.EncryptionMode = FtpEncryptionMode.None; cl.ValidateCertificate += OnValidateCertificate; using (var s = (FtpDataStream)cl.OpenWrite("test.txt")) { var r = s.CommandStatus; FtpTrace.WriteLine(""); FtpTrace.WriteLine("Response to STOR:"); FtpTrace.WriteLine("Code: " + r.Code); FtpTrace.WriteLine("Message: " + r.Message); FtpTrace.WriteLine("Informational: " + r.InfoMessages); r = s.Close(); FtpTrace.WriteLine(""); FtpTrace.WriteLine("Response after close:"); FtpTrace.WriteLine("Code: " + r.Code); FtpTrace.WriteLine("Message: " + r.Message); FtpTrace.WriteLine("Informational: " + r.InfoMessages); } } }
//[Fact] public async Task TestUploadDownloadManyFilesAsync() { using (FtpClient cl = NewFtpClient()) { cl.EnableThreadSafeDataConnections = false; await cl.ConnectAsync(); // 100 K file for (int i = 0; i < 3; i++) { FtpTrace.WriteLine(" ------------- UPLOAD " + i + " ------------------"); await cl.UploadFileAsync(@"D:\Drivers\mb_driver_intel_bootdisk_irst_64_6series.exe", "/public_html/temp/small.txt"); } // 100 K file for (int i = 0; i < 3; i++) { FtpTrace.WriteLine(" ------------- DOWNLOAD " + i + " ------------------"); await cl.DownloadFileAsync(@"D:\Drivers\test\file" + i + ".exe", "/public_html/temp/small.txt"); } FtpTrace.WriteLine(" ------------- ALL DONE! ------------------"); } }
//[Fact] public void TestGetObjectInfo() { using (var client = NewFtpClient()) { FtpTrace.WriteLine(client.GetObjectInfo("/public_html/temp/README.md")); } }
static void TestGetObjectInfo() { using (FtpClient client = new FtpClient(m_host, m_user, m_pass)) { FtpTrace.WriteLine(client.GetObjectInfo("/public_html/temp/README.md")); } }
static void Main(string[] args) { FtpTrace.LogIP = false; FtpTrace.LogUserName = false; FtpTrace.AddListener(new ConsoleTraceListener()); FtpTrace.AddListener(new TextWriterTraceListener(@"C:\log_file.txt")); try { /*foreach (int i in connectionTypes) { * using (FtpClient cl = new FtpClient()) { * cl.Credentials = new NetworkCredential(m_user, m_pass); * cl.Host = m_host; * cl.EncryptionMode = FtpEncryptionMode.None; * cl.ValidateCertificate += new FtpSslValidation(cl_ValidateCertificate); * cl.DataConnectionType = (FtpDataConnectionType)i; * //cl.Encoding = System.Text.Encoding.Default; * cl.Connect(); * Upload(cl); * Download(cl); * Delete(cl); * } * }*/ //-------------------------------- // MISC //-------------------------------- //StreamResponses(); //TestServer(); //TestManualEncoding(); //TestServer(); //TestDisposeWithMultipleThreads(); //TestMODCOMP_PWD_Parser(); //TestDispose(); //TestHash(); //TestReset(); //TestUTF8(); //TestDirectoryWithDots(); //TestNameListing(); //TestNameListingFTPS(); // TestFileZillaKick(); //TestUnixList(); //TestNetBSDServer(); // TestConnectionFailure(); //TestFtpPath(); //TestListPath(); //TestListPathWithHttp11Proxy(); //TestFileExists(); //TestDeleteDirectory(); //TestMoveFiles(); //-------------------------------- // PARSING //-------------------------------- //TestUnixListParser(); //TestIISParser(); //TestOpenVMSParser(); //-------------------------------- // FILE LISTING //-------------------------------- //TestGetObjectInfo(); TestGetListing(); //TestGetMachineListing(); //GetPublicFTPServerListing(); //TestListSpacedPath(); //TestFilePermissions(); //-------------------------------- // UPLOAD / DOWNLOAD //-------------------------------- //TestUploadDownloadFile(); //TestUploadDownloadManyFiles(); //TestUploadDownloadZeroLenFile(); //TestUploadDownloadManyFiles2(); //TestUploadDownloadFile_UTF(); //TestUploadDownloadFile_ANSI(); //Async Tests #if (CORE || NETFX45) TestAsyncMethods(); #endif } catch (Exception ex) { FtpTrace.WriteLine(ex.ToString()); } FtpTrace.WriteLine("--DONE--"); // Console.ReadKey(); }