using System.Text;
using Limilabs.FTP.Client;

namespace UploadDownload
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (Ftp client = new Ftp())
            {
                client.Connect("ftp.example.org");
                client.Login("username", "password");

                // Upload the 'test.zip' file to the current folder on the server 
                client.Upload("test.zip", @"c:\test.zip");

                // Upload the 'index.html' file to the specified folder on the server 
                client.Upload("/wwwroot/index.html", @"c:\index.html");

                // Download the 'test.zip' file from the current folder on the server 
                client.Download("test.zip", @"c:\test2.zip");

                // Download the 'index.html' file from the specified folder on the server 
                client.Download("/wwwroot/index.html", @"c:\index.html");

                // upload in memory text 
                const string message = "Hello from Ftp.dll";
                byte[] data = Encoding.Default.GetBytes(message);
                client.Upload("message.txt", data);

                client.Close();
            }
        }
    } ;
}
