private void ConnectToSteam(String username, String password, String authCode)
{
Logger.Get().Log("Retrieving Steam instance...");
Steam3 tmpSteam;
if (SteamInstances.HasInstance(username))
{
Logger.Get().Log("Loaded existing instance");
}
else
{
Logger.Get().Log("Creating new instance");
}
tmpSteam = SteamInstances.GetInstance(username);
tmpSteam.AddHandler(this);
if (tmpSteam.LoggedIn)
{
Logger.Get().Log("Instance already online, checking credentials...");
if (tmpSteam.Authorize(username, password))
{
Logger.Get().Log("User logged in");
this.steam = tmpSteam;
IsAuthorized = true;
Send(Protocol.Server.LoggedIn);
return;
}
else
{
Logger.Get().Log("Invalid credentials");
connection.Disconnect();
return;
}
}
Logger.Get().Log("Connecting to Steam");
this.steam = tmpSteam;
steam.Connect(username, password, authCode);
Logger.Get().Log("Starting callback thread");
}