diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 95c0a7d4..b2554807 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -302,7 +302,7 @@ namespace DepotDownloader return DownloadSource.Steam2; KeyValue config = GetSteam3AppSection(appId, EAppInfoSection.Config); - int contenttype = config[appId.ToString()]["contenttype"].AsInteger(0); + int contenttype = config["contenttype"].AsInteger(0); // EContentDownloadSourceType? if (contenttype != 3) @@ -362,7 +362,7 @@ namespace DepotDownloader if (info == null) return String.Empty; - return info[appId.ToString()]["name"].AsString(); + return info["name"].AsString(); } else { @@ -668,10 +668,15 @@ namespace DepotDownloader List cdnEndpoints = cdnServers.Where((ep) => { return ep.Type == "CDN"; }).ToList(); List csEndpoints = cdnServers.Where((ep) => { return ep.Type == "CS"; }).ToList(); List cdnClients = new List(); + byte[] appTicket = steam3.AppTickets[(uint)depotId]; foreach (var server in csEndpoints) { - CDNClient client = new CDNClient(server, steam3.AppTickets[(uint)depotId]); + CDNClient client; + if (appTicket == null) + client = new CDNClient(server, (uint)depotId, steam3.steamUser.SteamID); + else + client = new CDNClient(server, appTicket); if (client.Connect()) { diff --git a/DepotDownloader/Steam3Session.cs b/DepotDownloader/Steam3Session.cs index d12e7c63..f8648355 100644 --- a/DepotDownloader/Steam3Session.cs +++ b/DepotDownloader/Steam3Session.cs @@ -36,12 +36,12 @@ namespace DepotDownloader public Dictionary AppInfoOverridesCDR { get; private set; } public SteamClient steamClient; - - SteamUser steamUser; + public SteamUser steamUser; SteamApps steamApps; CallbackManager callbacks; + bool authenticatedUser; bool bConnected; bool bAborted; DateTime connectTime; @@ -59,6 +59,7 @@ namespace DepotDownloader { this.logonDetails = details; + this.authenticatedUser = details.Username != null; this.credentials = new Credentials(); this.bConnected = false; this.bAborted = false; @@ -84,10 +85,13 @@ namespace DepotDownloader Console.Write( "Connecting to Steam3..." ); - FileInfo fi = new FileInfo(String.Format("{0}.sentryFile", logonDetails.Username)); - if(fi.Exists && fi.Length > 0) + if ( authenticatedUser ) { - logonDetails.SentryFileHash = Util.SHAHash(File.ReadAllBytes(fi.FullName)); + FileInfo fi = new FileInfo(String.Format("{0}.sentryFile", logonDetails.Username)); + if (fi.Exists && fi.Length > 0) + { + logonDetails.SentryFileHash = Util.SHAHash(File.ReadAllBytes(fi.FullName)); + } } Connect(); @@ -188,6 +192,13 @@ namespace DepotDownloader if (AppTickets.ContainsKey(appId) || bAborted) return; + + if ( !authenticatedUser ) + { + AppTickets[appId] = null; + return; + } + Action cbMethod = (appTicket, jobId) => { if (appTicket.Result != EResult.OK) @@ -282,7 +293,7 @@ namespace DepotDownloader { Console.WriteLine(" Done!"); bConnected = true; - if ( logonDetails.Username == null ) + if ( !authenticatedUser ) { Console.Write( "Logging anonymously into Steam3..." ); steamUser.LogOnAnonymous();