Allow reconnection logic to run for initial connection. Also bail out of AccountHasAccess without a steamid

pull/8/head
Ryan Kistner 12 years ago
parent fdba42da77
commit a0a1db448a

@ -104,7 +104,7 @@ namespace DepotDownloader
static bool AccountHasAccess( uint depotId ) static bool AccountHasAccess( uint depotId )
{ {
if ( steam3 == null || (steam3.Licenses == null && steam3.steamUser.SteamID.AccountType != EAccountType.AnonUser) ) if (steam3 == null || steam3.steamUser.SteamID == null || (steam3.Licenses == null && steam3.steamUser.SteamID.AccountType != EAccountType.AnonUser))
return false; return false;
IEnumerable<uint> licenseQuery; IEnumerable<uint> licenseQuery;

@ -43,6 +43,7 @@ namespace DepotDownloader
bool authenticatedUser; bool authenticatedUser;
bool bConnected; bool bConnected;
bool bConnecting;
bool bAborted; bool bAborted;
DateTime connectTime; DateTime connectTime;
@ -62,6 +63,7 @@ namespace DepotDownloader
this.authenticatedUser = details.Username != null; this.authenticatedUser = details.Username != null;
this.credentials = new Credentials(); this.credentials = new Credentials();
this.bConnected = false; this.bConnected = false;
this.bConnecting = false;
this.bAborted = false; this.bAborted = false;
this.AppTickets = new Dictionary<uint, byte[]>(); this.AppTickets = new Dictionary<uint, byte[]>();
@ -283,6 +285,7 @@ namespace DepotDownloader
{ {
bAborted = false; bAborted = false;
bConnected = false; bConnected = false;
bConnecting = true;
this.connectTime = DateTime.Now; this.connectTime = DateTime.Now;
this.steamClient.Connect(); this.steamClient.Connect();
} }
@ -300,6 +303,7 @@ namespace DepotDownloader
steamClient.Disconnect(); steamClient.Disconnect();
bConnected = false; bConnected = false;
bConnecting = false;
bAborted = true; bAborted = true;
} }
@ -322,6 +326,7 @@ namespace DepotDownloader
private void ConnectedCallback(SteamClient.ConnectedCallback connected) private void ConnectedCallback(SteamClient.ConnectedCallback connected)
{ {
Console.WriteLine(" Done!"); Console.WriteLine(" Done!");
bConnecting = false;
bConnected = true; bConnected = true;
if ( !authenticatedUser ) if ( !authenticatedUser )
{ {
@ -339,7 +344,7 @@ namespace DepotDownloader
private void DisconnectedCallback(SteamClient.DisconnectedCallback disconnected) private void DisconnectedCallback(SteamClient.DisconnectedCallback disconnected)
{ {
if (!bConnected || bAborted) if ((!bConnected && !bConnecting) || bAborted)
return; return;
Console.WriteLine("Reconnecting"); Console.WriteLine("Reconnecting");

Loading…
Cancel
Save