Пример #1
0
        public LocationResultSet send()
        {
            FTPUtils ftputils = new FTPUtils((FTPCredentialsConfig)config);

            ftputils.Progress += progressHandler;
            LocationResultSet result = ftputils.sendFile();

            return(result);
        }
Пример #2
0
        public LocationConnectionResultSet connect()
        {
            FTPUtils ftputils = new FTPUtils((FTPCredentialsConfig)config);

            ftputils.Progress += progressHandler;
            LocationConnectionResultSet result = ftputils.testConnection();

            return(result);
        }
Пример #3
0
        public void demoFTP()
        {
            FTPCredentialsConfig config = new FTPCredentialsConfig();

            config.host                  = "cspeitch.com";
            config.port                  = 22;
            config.username              = "";
            config.password              = "";
            config.sourcePath            = "D:\\MyStuff\\DSC_0133.JPG";
            config.locationPath          = "/home/cspeitch/eikona";
            config.SshHostKeyFingerprint = "";
            config.useSFTP               = true;

            FTPUtils ftp = new FTPUtils(config);

            /*
             * FTPConnectionResultSet res = ftp.testConnection();
             * Console.WriteLine("Was Succesful: "+res.wasSuccessful);
             * Console.WriteLine("Error Message: " + res.errorMessage);
             * Console.WriteLine("SSH fingerprint: "+res.sshHostKeyFingerprint);*/

            //ftp.sendFile();
            ftp.startSession();
            List <RemoteFileInfo> files = ftp.getDirectoryListing("/", false, false);

            foreach (RemoteFileInfo file in files)
            {
                Console.WriteLine(file.IsDirectory + " " + file.Name);
            }
            Console.WriteLine();
            files = ftp.getDirectoryListing("/home/cspeitch", false, false);
            foreach (RemoteFileInfo file in files)
            {
                Console.WriteLine(file.IsDirectory + " " + file.Name);
            }
            Console.WriteLine();
            files = ftp.getDirectoryListing("/home/cspeitch/animeapp", false, false);
            foreach (RemoteFileInfo file in files)
            {
                Console.WriteLine(file.IsDirectory + " " + file.Name);
            }
            Console.WriteLine();
            ftp.disposeSession();
        }
Пример #4
0
        public void demoFTP()
        {
            FTPCredentialsConfig config = new FTPCredentialsConfig();

            config.host                  = "cspeitch.com";
            config.port                  = 22;
            config.username              = "";
            config.password              = "";
            config.sourcePath            = "D:\\MyStuff\\DSC_0133.JPG";
            config.locationPath          = "/home/cspeitch/eikona";
            config.SshHostKeyFingerprint = "";
            config.useSFTP               = true;

            FTPUtils ftp = new FTPUtils(config);

            ftp.startSession();
            List <RemoteFileInfo> files = ftp.getDirectoryListing("/", false, false);

            foreach (RemoteFileInfo file in files)
            {
                Console.WriteLine(file.IsDirectory + " " + file.Name);
            }
            Console.WriteLine();
            files = ftp.getDirectoryListing("/home/cspeitch", false, false);
            foreach (RemoteFileInfo file in files)
            {
                Console.WriteLine(file.IsDirectory + " " + file.Name);
            }
            Console.WriteLine();
            files = ftp.getDirectoryListing("/home/cspeitch/animeapp", false, false);
            foreach (RemoteFileInfo file in files)
            {
                Console.WriteLine(file.IsDirectory + " " + file.Name);
            }
            Console.WriteLine();
            ftp.disposeSession();
        }