DeploymentCatalog
uses WebClient
under the hood, but doesn't seem to expose it in any way.
There's a copy of the source here (couldn't find it on CodePlex for some reason). The URI is used by the WebClient
to perform an asynchronous download. On completion, the response is used to create a collection of assemblies using Package.LoadPackagedAssemblies
. Composition is performed using those assemblies.
Some of the relevant code:
//the download
this.WebClient.OpenReadCompleted += new OpenReadCompletedEventHandler(HandleOpenReadCompleted);
this.WebClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(HandleDownloadProgressChanged);
this.WebClient.OpenReadAsync(Uri, this);
//composition on completion of async download
var assemblies = Package.LoadPackagedAssemblies(e.Result);
this.DiscoverParts(assemblies);
You could create a custom catalog that does the same thing but provides an AddHeader method, or exposes the WebClient
, or whatever.