private async void OnServerList(SteamClient.ServerListCallback callback) { IList <CDNClient.Server> serverList; try { serverList = await CDNClient.FetchServerListAsync(maxServers : 30); } catch (Exception e) { if (CDNServers.Count == 0) { ErrorReporter.Notify("Depot Downloader", e); } return; } CDNServers = new List <string>(); foreach (var server in serverList) { // akamai.cdn.steampipe.steamcontent.com returns 404 Not Found unnecessarily if (server.Type == "CDN" && !server.Host.Contains("cdn.")) { CDNServers.Add(server.Host); } } }
private async void OnServerList(SteamClient.ServerListCallback callback) { IList <CDNClient.Server> serverList; try { serverList = await CDNClient.FetchServerListAsync(maxServers : 60); } catch (Exception e) { if (CDNServers.Count == 0) { ErrorReporter.Notify("Depot Downloader", e); } return; } CDNServers = new List <string>(); foreach (var server in serverList) { if (server.Type == "CDN" && server.Host.StartsWith("valve")) { CDNServers.Add(server.Host); } } }
private async void OnServerList(SteamClient.ServerListCallback callback) { IList <CDNClient.Server> serverList; try { serverList = await CDNClient.FetchServerListAsync(maxServers : 60); } catch (Exception e) { ErrorReporter.Notify("Depot Downloader", e); return; } CDNServers = new List <string>(); foreach (var server in serverList) { if (server.Type == "CDN" && (server.Host.StartsWith("valve") || server.Host.StartsWith("cache"))) { Log.WriteDebug("Depot Processor", "Adding {0} to CDN server list", server.Host); CDNServers.Add(server.Host); } else { Log.WriteDebug("Depot Processor", "Skipping {0}, not added to CDN server list", server.Host); } } Log.WriteDebug("Depot Processor", "Finished adding CDN servers, added {0} out of {1}", CDNServers.Count, serverList.Count); }
public async Task <KeyValuePair <CDNClient, CDNClient.Server> > GetConnectionForAppAsync(uint appId) { CDNClient client = new CDNClient(Client, await RequestAppTicket(appId)); var serverList = await client.FetchServerListAsync(); var server = serverList.Where(x => x.Type == "CDN").OrderBy(x => x.WeightedLoad).First(); await client.ConnectAsync(server); return(new KeyValuePair <CDNClient, CDNClient.Server>(client, server)); }
private async Task <IList <CDNClient.Server> > FetchBootstrapServerListAsync() { CDNClient bootstrap = new CDNClient(steamSession.steamClient); while (true) { try { var cdnServers = await bootstrap.FetchServerListAsync(cellId : (uint)ContentDownloader.Config.CellID).ConfigureAwait(false); if (cdnServers != null) { return(cdnServers); } } catch (Exception ex) { Console.WriteLine("Failed to retrieve content server list: {0}", ex.Message); } } }
private async Task <IList <CDNClient.Server> > FetchBootstrapServerListAsync() { CDNClient bootstrap = new CDNClient(steamSession.steamClient); while (!shutdownToken.IsCancellationRequested) { try { var cdnServers = await bootstrap.FetchServerListAsync(cellId : (uint)ContentDownloader.Config.CellID).ConfigureAwait(false); if (cdnServers != null) { return(cdnServers); } } catch (Exception ex) { Logger.Error("Failed to retrieve content server list: {0}", ex.Message); } } return(null); }
async private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } try { ConfigItem item = datagridConfigs.Rows[e.RowIndex].DataBoundItem as ConfigItem; if (item != null) { if (item.URL == "") { var callback = await steamWorkshop.RequestInfo(241100, item.Details.publishedfileid); var itemInfo = callback.Items.FirstOrDefault(); var ticket = await steamClient.GetHandler <SteamApps>().GetAppOwnershipTicket(241100); var decryptKey = await steamClient.GetHandler <SteamApps>().GetDepotDecryptionKey(241100, 241100); var cdn = new CDNClient(steamClient, ticket.Ticket); // var servers = cdn.FetchServerList(); var servers = await cdn.FetchServerListAsync(); int i = 0; foreach (CDNClient.Server server in servers) { Log.w($"Server{i}: {server}"); ++i; } await cdn.ConnectAsync(servers.First()); await cdn.AuthenticateDepotAsync(241100, decryptKey.DepotKey); var manifest = await cdn.DownloadManifestAsync(241100, itemInfo.ManifestID); manifest.DecryptFilenames(decryptKey.DepotKey); if (manifest.Files.Count == 0) { MessageBox.Show("Steam Refused Download Request"); return; } var chunk = cdn.DownloadDepotChunkAsync(241100, manifest.Files.First().Chunks.First()); if (saveFileDialog1.ShowDialog() == DialogResult.OK) { using (var wc = new WebClient()) { using (var io = saveFileDialog1.OpenFile()) { io.Write(chunk.Result.Data, 0, chunk.Result.Data.Length); MessageBox.Show($"Download Done!\nSaved {saveFileDialog1.FileName}"); Log.w($"Downloaded {saveFileDialog1.FileName}"); } } } } else { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { using (var wc = new WebClient()) { wc.DownloadFile(new Uri(item.URL), saveFileDialog1.FileName); MessageBox.Show("Download Done!"); } } } } } catch (TaskCanceledException) { MessageBox.Show("Timeout! This can happen if you're using anonymous account and trying to download."); } catch (Exception ex) { MessageBox.Show($"Error Downloading Config: {ex.ToString()}"); } }