Remove Steam3Session.Credentials

pull/474/head
Pavel Djundik 2 years ago
parent 93de24c7f5
commit 0f00ea592e

@ -25,7 +25,6 @@ namespace DepotDownloader
public static DownloadConfig Config = new();
private static Steam3Session steam3;
private static Steam3Session.Credentials steam3Credentials;
private static CDNClientPool cdnPool;
private const string DEFAULT_DOWNLOAD_DIR = "depots";
@ -298,9 +297,7 @@ namespace DepotDownloader
}
);
steam3Credentials = steam3.WaitForCredentials();
if (!steam3Credentials.IsValid)
if (!steam3.WaitForCredentials())
{
Console.WriteLine("Unable to get steam3 credentials.");
return false;

@ -13,16 +13,7 @@ namespace DepotDownloader
{
class Steam3Session
{
public class Credentials
{
public bool LoggedOn { get; set; }
public ulong SessionToken { get; set; }
public bool IsValid
{
get { return LoggedOn; }
}
}
public bool IsLoggedOn { get; private set; }
public ReadOnlyCollection<SteamApps.LicenseListCallback.License> Licenses
{
@ -61,9 +52,6 @@ namespace DepotDownloader
// input
readonly SteamUser.LogOnDetails logonDetails;
// output
readonly Credentials credentials = new();
static readonly TimeSpan STEAM3_TIMEOUT = TimeSpan.FromSeconds(30);
@ -91,7 +79,6 @@ namespace DepotDownloader
this.callbacks.Subscribe<SteamClient.ConnectedCallback>(ConnectedCallback);
this.callbacks.Subscribe<SteamClient.DisconnectedCallback>(DisconnectedCallback);
this.callbacks.Subscribe<SteamUser.LoggedOnCallback>(LogOnCallback);
this.callbacks.Subscribe<SteamUser.SessionTokenCallback>(SessionTokenCallback);
this.callbacks.Subscribe<SteamApps.LicenseListCallback>(LicenseListCallback);
Console.Write("Connecting to Steam3...");
@ -124,14 +111,14 @@ namespace DepotDownloader
return bAborted;
}
public Credentials WaitForCredentials()
public bool WaitForCredentials()
{
if (credentials.IsValid || bAborted)
return credentials;
if (IsLoggedOn || bAborted)
return IsLoggedOn;
WaitUntilCallback(() => { }, () => { return credentials.IsValid; });
WaitUntilCallback(() => { }, () => IsLoggedOn);
return credentials;
return IsLoggedOn;
}
public void RequestAppInfo(uint appId, bool bForce = false)
@ -685,7 +672,7 @@ namespace DepotDownloader
Console.WriteLine(" Done!");
this.seq++;
credentials.LoggedOn = true;
IsLoggedOn = true;
if (ContentDownloader.Config.CellID == 0)
{
@ -694,12 +681,6 @@ namespace DepotDownloader
}
}
private void SessionTokenCallback(SteamUser.SessionTokenCallback sessionToken)
{
Console.WriteLine("Got session token!");
credentials.SessionToken = sessionToken.SessionToken;
}
private void LicenseListCallback(SteamApps.LicenseListCallback licenseList)
{
if (licenseList.Result != EResult.OK)

Loading…
Cancel
Save