private void OnConnected(SteamClient.ConnectedCallback callback) { Console.WriteLine("Connected to Steam! Logging in '{0}'...", username); if (File.Exists("sentry.bin")) { // if we have a saved sentry file, read and sha-1 hash it byte[] sentryFile = File.ReadAllBytes("sentry.bin"); sentryHash = CryptoHelper.SHAHash(sentryFile); } String loginKey = IniModel.GetSteamLoginKey(); SteamUser.LogOnDetails logonDetails = new SteamUser.LogOnDetails(); logonDetails.Username = username; logonDetails.Password = password; logonDetails.LoginKey = loginKey; logonDetails.LoginID = LoginID; logonDetails.AuthCode = authCode; logonDetails.TwoFactorCode = twoFactorAuth; logonDetails.SentryFileHash = sentryHash; logonDetails.ShouldRememberPassword = true; try { steamUser.LogOn(logonDetails); }catch (ArgumentException) { isRunning = false; } }
private void timer1_Tick(object sender, EventArgs e) { Console.WriteLine("Steam.isConnected(): " + Program.steam.isConnected()); Console.WriteLine("Steam.isRunning: " + Program.steam.isRunning); Network.SessionCall(); if (IniModel.GetSteamLoginKey() != null && Program.steam.isConnected() == false && settings == null) { timer1.Stop(); SteamConnErr steamConnErr = new SteamConnErr(); steamConnErr.ShowDialog(); OnGameChangedEvent(this, null); timer1.Start(); } tasks.RunPsnTask(UpdateActivityModel); }
private void Loader_Shown(object sender, EventArgs e) { this.Visible = false; updater.run(); String AccessToken = null; String PSNRefreshToken = IniModel.GetPSNRefreshToken(); if (PSNRefreshToken == null) { this.Hide(); PSN login = new PSN(); login.ShowDialog(); PSNRefreshToken = IniModel.GetPSNRefreshToken(); } try { AccessToken = Platforms.PSN.AuthWithRefreshToken(PSNRefreshToken)[0]; } catch (Exception) { MessageBox.Show("Unable to connect PlayStation Network.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(-1); } if (IniModel.GetSteamUsername() != null && IniModel.GetSteamLoginKey() != null) { Program.steam.manager.Subscribe <SteamUser.LoggedOnCallback>(OnLoggedOn); Program.steam.manager.Subscribe <SteamClient.DisconnectedCallback>(OnDisconnected); Program.steam.Connect(IniModel.GetSteamUsername(), null); } /*else * { * this.Hide(); * SteamLogin steamLogin = new SteamLogin(); * steamLogin.ShowDialog(); * }*/ Program.AccessToken = AccessToken; this.Hide(); OnPS OnPSClient = new OnPS(); OnPSClient.ShowDialog(); }