예제 #1
0
        public bool DownloadFile(DownloadMethod method, string remoteFileLocation, string localPath)
        {
            try
            {
                remoteFileLocation = WebHelper.RemoveTrailingBackslash(remoteFileLocation);

                var localFileFullPath = FileHelper.AddJpgExt(FileHelper.GenerateLocalPathToFile(remoteFileLocation, localPath));
                switch (method)
                {
                case DownloadMethod.WebClientAsync:
                    return(DownloadFileWebClientAsync(remoteFileLocation, localFileFullPath));

                case DownloadMethod.PostSharp:
                    return(DownloadFileRestSharp(remoteFileLocation, localFileFullPath));

                case DownloadMethod.WebClient:
                    return(DownloadFileWebClient(remoteFileLocation, localFileFullPath));

                default:
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }