示例#1
0
 public void GetFile(string remoteFile, string localFile, bool failIfExists)
 {
     if (WININET.FtpGetFile(_hConnect, remoteFile, localFile, failIfExists, 0x80, 2, IntPtr.Zero) == 0)
     {
         Error();
     }
 }
示例#2
0
        /// <summary>
        /// Downloads a file from the FTP server to the local system
        /// </summary>
        /// <exception cref="FtpException">If the file does not exist.</exception>
        /// <param name="remoteFile">A <see cref="String"/> representing the full or relative path to the file to download.</param>
        /// <param name="localFile">A <see cref="String"/> representing the local file path to save the file.</param>
        /// <param name="failIfExists">A <see cref="Boolean"/> that determines whether an existing local file should be overwritten.</param>
        public void GetFile(string remoteFile, string localFile, bool failIfExists)
        {
            int ret = WININET.FtpGetFile(_hConnect,
                                         remoteFile,
                                         localFile,
                                         failIfExists,
                                         WINAPI.FILE_ATTRIBUTE_NORMAL,
                                         WININET.FTP_TRANSFER_TYPE_BINARY,
                                         IntPtr.Zero);

            if (ret == 0)
            {
                Error();
            }
        }