public async Task ApplyPatchFromWeb(string patchPath, string targetPath, string applicationDirPath, IProgress <DirectoryPatcherProgressReport> progress, CancellationToken cancellationToken, string instructionsHash) { Contract.Assert(UpdateServerHandler.GetUpdateServers().Count > 0); WebPatchPath = patchPath; await UpdateServerSelector.SelectHosts(UpdateServerHandler.GetUpdateServers()); var bestHost = UpdateServerSelector.Hosts.Dequeue(); Console.WriteLine("#######HOST: {0}", bestHost.Uri); await ApplyPatchFromWebDownloadTask(bestHost, targetPath, applicationDirPath, progress, cancellationToken, instructionsHash); }
public async Task ApplyPatchFromWeb(string[] baseUrls, string patchPath, string targetPath, string applicationDirPath, IProgress <DirectoryPatcherProgressReport> progress, CancellationToken cancellationToken, string instructions_hash) { Contract.Assert(baseUrls.Length > 0); WebPatchPath = patchPath; var hosts = baseUrls.Select(url => new Uri(url)).ToArray(); Selector = new UpdateServerSelector(); await Selector.SelectHosts(hosts); string bestHost; lock (Selector.Hosts) bestHost = Selector.Hosts.Dequeue().ToString(); Console.WriteLine("#######HOST: {0}", bestHost); await ApplyPatchFromWeb(bestHost + WebPatchPath, targetPath, applicationDirPath, progress, cancellationToken, instructions_hash); }