Esempio n. 1
0
        public void DownloadFile()
        {
            var url      = "ftp://localhost/10.2.0.1";
            var fileName = "single-line.txt";

            var appData  = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var localDir = Path.Combine(appData, "Tester");
            var saveAs   = Path.Combine(localDir, fileName);

            if (!Directory.Exists(localDir))
            {
                Directory.CreateDirectory(localDir);
            }
            if (!File.Exists(saveAs))
            {
                File.Delete(saveAs);
            }

            var filePath = string.Format("{0}/{1}", url, fileName);

            FileSystem.Download(filePath, saveAs);

            Assert.IsTrue(File.Exists(saveAs));
            Assert.AreEqual(14, new FileInfo(saveAs).Length);
        }
Esempio n. 2
0
        public void Download_ftp()
        {
            var        util = new FtpUtilities();
            FileStream FS   = File.Create("README.txt");

            util.Download("ftp://www.nic.funet.fi/pub/unix/OpenBSD/README", FS);
            FS.Close();
        }//http://www.nic.funet.fi/pub/unix/OpenBSD/README