Exemplo n.º 1
0
        private int Downloader(string sourcePath, string targetPath)
        {
            int result = 1;

            try
            {
                NetworkCredential GetCredential = new NetworkCredential();
                Settings          settings      = new Settings(ENServerType.FTP, GetCredential, ENConfigFlags.None);
                var fileDownloader = FileDownloader.Create(settings);
                Uri uri            = new Uri(sourcePath);
                fileDownloader.AddFile(uri, targetPath);
                fileDownloader.Download();
            }
            catch (Exception ex)
            {
                result = 0;
            }

            return(result);
        }