Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
 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 **********");
     }
 }