

Protected override WebResponse GetWebResponse( WebRequest request, IAsyncResult result ) Protected override WebRequest GetWebRequest( Uri address ) Public DownloadProgress ContentRangeTarget Private readonly CookieContainer cookies = new CookieContainer() Private readonly Dictionary cookies = new Dictionary() Private class CookieAwareWebClient : WebClient Web client that preserves cookies (needed for Google Drive)

Return ( int) ( ( ( double) BytesReceived / TotalBytesToReceive ) * 100 ) Public long BytesReceived, TotalBytesToReceive Custom download progress reporting (needed for Google Drive) Public delegate void DownloadProgressChangedEventHandler( object sender, DownloadProgress progress ) Private const int GOOGLE_DRIVE_MAX_DOWNLOAD_ATTEMPT = 3 an NID cookie is returned instead of a download_warning cookie In the worst case, it is necessary to send 3 download requests to the Drive address Private const string GOOGLE_DRIVE_DOMAIN2 = " " Private const string GOOGLE_DRIVE_DOMAIN = " " Public class FileDownloader : IDisposable This callback is triggered for both DownloadFile and DownloadFileAsyncįileDownloader.DownloadFileCompleted += ( sender, e ) => Console.WriteLine( "Download completed" ) This callback is triggered for DownloadFileAsync onlyįileDownloader.DownloadProgressChanged += ( sender, e ) => Console.WriteLine( "Progress changed " + e.BytesReceived + " " + e.TotalBytesToReceive ) FileDownloader fileDownloader = new FileDownloader()
