3 Star 3 Fork 1

joylei / NFly.BitsTransfer

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

NFly.BitsTransfer

A .Net wrapper library for Windows Background Intelligent Transfer Service (BITS)

DEMO

DEMO

Features

  • Download Single File
  • Download Folder
  • Progress report
  • Estimated downloading time
  • Estimated downloading speed

Usage

var jobName = "YOUR_JOB_NAME"
var job = BitsJob.GetJob(jobName);

//remove existing job
if(job!=null){
  job.Cancel();  
}

//create job
job = BitsJob.Create(jobName);
job.Pause();
job.AddFile("REMOTE_FILE", "PATH_OF_LOCAL_FILE");

//watch progress
job.OnProgress += progress =>{
  var status = job.State;
  if(status == BitsJob.BG_JOB_STATE.BG_JOB_STATE_TRANSFERRED){
    //files transferred, mark job as completed
    job.Complete();

    Console.WriteLine("Job completed, you can access downloaded files now.");
    return;
  }

  Console.WriteLine("----");
  Console.WriteLine("BytesTotal: {0}",progress.BytesTotal);
  Console.WriteLine("BytesTransferred: {0}",progress.BytesTransferred);
  Console.WriteLine("Bytes Per Second: {0}",progress.EstimatedSpeed);
  Console.WriteLine("Remaining Seconds: {0}",progress.EstimatedTimeRemaining);
};

//pause job
job.Pause();

//resume job
job.Resume();

Repository Comments ( 0 )

Sign in to post a comment

About

A .Net wrapper library for Windows Background Intelligent Transfer Service (BITS) expand collapse
C#
MIT
Cancel

Releases

No release

NFly.BitsTransfer

Contributors

All

Activities

Load More
can not load any more
C#
1
https://git.oschina.net/wowin/NFly.BitsTransfer.git
git@git.oschina.net:wowin/NFly.BitsTransfer.git
wowin
NFly.BitsTransfer
NFly.BitsTransfer
master

Search