Class ContentDownloader
Simple HTTP content downloader implementation
Inheritance
System.Object
ContentDownloader
Namespace: Microsoft.PackageGraph.Storage.Local
Assembly: package-graph-microsoft-update.dll
Syntax
public class ContentDownloader
Methods
| Improve this Doc View SourceDownloadToFile(String, IContentFile, CancellationToken)
Downloads a single file belonging to an update package. Supports resuming a partial download
Declaration
public void DownloadToFile(string destinationFilePath, IContentFile updateFile, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | destinationFilePath | Download destination file. |
IContentFile | updateFile | The update file to download. |
System.Threading.CancellationToken | cancellationToken | Cancellation token |
DownloadToStream(Stream, IContentFile, Int64, CancellationToken)
Downloads the specified URL to the destination file stream
Declaration
public void DownloadToStream(Stream destination, IContentFile updateFile, long startOffset, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | destination | The file stream to write content to |
IContentFile | updateFile | The update to download |
System.Int64 | startOffset | Offset to resume download at |
System.Threading.CancellationToken | cancellationToken | Cancellation token |
DownloadToStream(String, Stream, CancellationToken)
Downloads data to a stream
Declaration
public static bool DownloadToStream(string source, Stream destination, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | Data source URL |
System.IO.Stream | destination | Target stream |
System.Threading.CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
System.Boolean | True on success, false otherwise |
Events
| Improve this Doc View SourceOnDownloadProgress
Provides progress notifications during download
Declaration
public event EventHandler<ContentOperationProgress> OnDownloadProgress
Event Type
Type | Description |
---|---|
System.EventHandler<ContentOperationProgress> |