using SwanCSharp.Sockets;
using System;
using System.Collections.Generic;
using System.Text;

namespace FileClient2
{
    class Program
    {
        static void Main(string[] args)
        {
            DownloadFile();
            UploadFile();
        }

        private static void DownloadFile()
        {
            FileClient lobjFileClient = new FileClient();
            lobjFileClient.TransmissionResult += new FileClient.TransmissionResultEventHandler(lobjFileClient_TransmissionResult);
            lobjFileClient.DownloadFile("test.txt", "", "192.168.0.15", 18000);
        }

        private static void UploadFile()
        {
            FileClient lobjFileClient = new FileClient();
            lobjFileClient.TransmissionResult += new FileClient.TransmissionResultEventHandler(lobjFileClient_TransmissionResult);
            lobjFileClient.UploadFile("test.txt","","192.168.0.15", 18000);
        }

        private static void lobjFileClient_TransmissionResult(string pstrFileName, Boolean pblnDownloaded, Boolean pblnTransmissionResult)
        {
            if (pblnTransmissionResult)
            {
                if (pblnDownloaded)
                {
                    Console.WriteLine("The file '" + pstrFileName + "' is downloaded successfully");
                }
                else
                {
                    Console.WriteLine("The file '" + pstrFileName + "' is uploaded successfully");
                }
            }
            else
            {
                if (pblnDownloaded)
                {
                    Console.WriteLine("The file '" + pstrFileName + "' is downloaded successfully");
                }
                else
                {
                    Console.WriteLine("The file '" + pstrFileName + "' is uploaded successfully");
                }
            }
        }
    }
}