public void TestMlsxItem(string line, string filename) { FtpsMlsxItemParser p = new FtpsMlsxItemParser(); FtpsItem item = p.ParseLine(line); Assert.AreEqual(filename, item.Name); Console.WriteLine(p.ToString()); }
public static ServerItem ToServerItem(this FtpsItem ftpsItem) { var serverItemType = ServerItemType.Other; switch (ftpsItem.ItemType) { case FtpItemType.Directory: serverItemType = ServerItemType.Directory; break; case FtpItemType.File: serverItemType = ServerItemType.File; break; } return(new ServerItem(ftpsItem.Name, ftpsItem.FullPath, ftpsItem.Size, ftpsItem.Modified, serverItemType)); }
public void TestGetFileInfo(string host, int port, FtpsSecurityProtocol protocol, string user, string pwd, ListingMethod method) { using (FtpsClient c = new FtpsClient(host, port, protocol)) { Debug.WriteLine("********** BEGINNING **********"); c.AlwaysAcceptServerCertificate = true; c.DirListingMethod = method; c.Open(user, pwd); Assert.IsTrue(c.IsConnected); // get information about the root directory FtpsItem m = c.GetFileInfo("."); if (m is FtpsMlsxItem) { Debug.Write(((FtpsMlsxItem)m).ToString()); } else { Debug.Write(m.ToString()); } Debug.WriteLine("********** ENDING **********"); } }