Skip to content

aalitor/AltoMultiThreadDownloadManager-master

Repository files navigation

AltoMultiThreadDownloadManager-master

Download accelerator library and demo. You can make your own Download Accelerator like IDM, FlashGet etc. using this library.

This library provides multithreading download over Http. Using multithreading download speed can be 8x much faster.

Features:

  • Dynamic partition: If one thread completes, one of the active threads is divided into 2 and thread count remains the same.
  • All cases handled: Download cases such as Resume-Not-Supported, Unknown-Content-Length, Expired url cases handled in library side.
  • Pause, resume support
  • Chunked download support over Google Drive or other sites using chunked stream
  • Download informations provided: Resumeability, Content-Size, Speed, Progress, ServerFileName
  • Due to event based download management is so easy
  • Native messaging methods are provided in library
  • Chrome extension is included to messaging and capturing downloads

What's next:

FTP download will be supported when it is ready

Code sample


void InitAndStart()
{
	var url = "http://ipv4.download.thinkbroadband.com/100MB.zip";
	var saveFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
	var saveFileName = "default.unknown";
	var chunkFilesFolder = Environment.GetFolderPath(Environment.SpecialFolder.AppData);
	var nofMaxThread = 8;
	var downloader = new HttpMultiThreadDownloader(url, saveFolder, saveFileName, chunkFilesFolder, nofMaxThread);
	downloader.ProgressChanged += downloader_DownloadInfoReceived;
	downloader.DownloadInfoReceived += downloader_ProgressChanged;
	downloader.Completed += downloader_Completed;
	downloader.StatusChanged += downloader_StatusChanged;
	downloader.Start();
}
void downloader_DownloadInfoReceived(object sender, EventArgs e)
{
	var downloader = (MultiThreadDownloadOrganizer)sender;
	//You can change the save filename after informations received
	downloader.SaveFileName = downloader.Info.ServerFileName;
	lblContentSize.Text = downloader.Info.ContentSize.ToHumanReadableSize();
	lblServerFileName.Text = downloader.Info.ServerFileName;
	lblResumeability.Text = downloader.Info.AcceptRanges ? "Yes" : "No";
	lblNofActiveThreads.Text = downloader.NofActiveThreads.ToString();
}
void downloader_StatusChanged(object sender, StatusChangedEventArgs e)
{
	switch(e.CurrentStatus)
	{
		case Status.Stopped:
			//all threads stopped
			//disable pause button
			break;
		case Status.Downloading:
			//disable resume button
			break;
	}
}
void downloader_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
	progressBar1.Value = (int)e.Progress;
	lblSpeed.Text = downloader.Speed.ToHumanReadableSize() + "/s";
}
void downloader_Completed(object sender, EventArgs e)
{
	MessageBox.Show("Download Completed");
}

Demo Application using native messaging

About

Download accelerator library and demo

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages