From 9a92d8b203a89c35553695ee1d251d5d5f867852 Mon Sep 17 00:00:00 2001 From: azuisleet Date: Fri, 9 Dec 2011 02:38:29 -0700 Subject: [PATCH] Refactor: EServerType to ESteam2ServerType Added Steam3 CS server selection --- DepotDownloader/ContentDownloader.cs | 25 ++++++++++++------------- DepotDownloader/ServerCache.cs | 6 +++--- DepotDownloader/Steam3Session.cs | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index e2de45ad..16d4d045 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -202,24 +202,23 @@ namespace DepotDownloader private static void DownloadSteam3( ContentServerClient.Credentials credentials, int depotId, int depotVersion, int cellId, ulong depot_manifest, string installDir ) { Console.Write("Finding content servers..."); -/* IPEndPoint contentServer = GetAnyStorageServer(); - if (contentServer == null) + List serverList = steam3.steamClient.GetServersOfType(EServerType.ServerTypeCS); + + List cdnServers = null; + + foreach(var endpoint in serverList) { - Console.WriteLine("\nError: Unable to find any content servers"); - return; - } -*/ + cdnServers = CDNClient.FetchServerList(new CDNClient.ClientEndPoint(endpoint.Address.ToString(), endpoint.Port), cellId); - // find a proper bootstrap... - CDNClient.ClientEndPoint contentServer1 = new CDNClient.ClientEndPoint("63.237.208.106", 80); - List cdnServers = CDNClient.FetchServerList(contentServer1, cellId); + if (cdnServers != null && cdnServers.Count > 0) + break; + } - if (cdnServers.Count == 0) + if (cdnServers == null || cdnServers.Count == 0) { - Console.WriteLine("CS server returned 0 servers, not sure why this happens."); - cdnServers.Add(contentServer1); -// return; + Console.WriteLine("Unable to find any steam3 content servers"); + return; } Console.WriteLine(" Done!"); diff --git a/DepotDownloader/ServerCache.cs b/DepotDownloader/ServerCache.cs index e9abc2fd..a0cee389 100644 --- a/DepotDownloader/ServerCache.cs +++ b/DepotDownloader/ServerCache.cs @@ -27,8 +27,8 @@ namespace DepotDownloader foreach ( IPEndPoint gdServer in GeneralDSClient.GDServers ) { - BuildServer( gdServer, ConfigServers, EServerType.ConfigServer ); - BuildServer( gdServer, CSDSServers, EServerType.CSDS ); + BuildServer( gdServer, ConfigServers, ESteam2ServerType.ConfigServer ); + BuildServer( gdServer, CSDSServers, ESteam2ServerType.CSDS ); } Console.WriteLine( " Done!" ); @@ -55,7 +55,7 @@ namespace DepotDownloader } } - private static void BuildServer( IPEndPoint gdServer, ServerList list, EServerType type ) + private static void BuildServer( IPEndPoint gdServer, ServerList list, ESteam2ServerType type ) { try { diff --git a/DepotDownloader/Steam3Session.cs b/DepotDownloader/Steam3Session.cs index 9426f684..096ec52e 100644 --- a/DepotDownloader/Steam3Session.cs +++ b/DepotDownloader/Steam3Session.cs @@ -31,7 +31,7 @@ namespace DepotDownloader public ReadOnlyCollection AppInfo { get; private set; } - SteamClient steamClient; + public SteamClient steamClient; SteamUser steamUser; SteamApps steamApps;