DepotDownloader: Added anonymous download support

pull/8/head
Ryan Kistner 13 years ago
parent eb64860ae8
commit 6a5a329ddf

@ -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<CDNClient.ClientEndPoint> cdnEndpoints = cdnServers.Where((ep) => { return ep.Type == "CDN"; }).ToList();
List<CDNClient.ClientEndPoint> csEndpoints = cdnServers.Where((ep) => { return ep.Type == "CS"; }).ToList();
List<CDNClient> cdnClients = new List<CDNClient>();
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())
{

@ -36,12 +36,12 @@ namespace DepotDownloader
public Dictionary<uint, bool> 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<SteamApps.AppOwnershipTicketCallback, JobID> 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();

Loading…
Cancel
Save