public void HandleBotCommand(string command) { try { if (command == "linkauth") { //LinkMobileAuth(); } else if (command == "getauth") { try { Log.Success("Generated Steam Guard code: " + SteamGuardAccount.GenerateSteamGuardCode()); } catch (NullReferenceException) { Log.Error("Unable to generate Steam Guard code."); } } else if (command == "unlinkauth") { if (SteamGuardAccount == null) { Log.Error("Mobile authenticator is not active on this bot."); } else if (SteamGuardAccount.DeactivateAuthenticator()) { Log.Success("Deactivated authenticator on this account."); } else { Log.Error("Failed to deactivate authenticator on this account."); } } else { GetUserHandler(SteamClient.SteamID).OnBotCommand(command); } } catch (ObjectDisposedException e) { // Writing to console because odds are the error was caused by a disposed Log. Console.WriteLine(string.Format("Exception caught in BotCommand Thread: {0}", e)); if (!this.IsRunning) { Console.WriteLine("The Bot is no longer running and could not write to the Log. Try Starting this bot first."); } } catch (Exception e) { Console.WriteLine(string.Format("Exception caught in BotCommand Thread: {0}", e)); } }
string GetMobileAuthCode() { var authFile = Path.Combine("authfiles", String.Format("{0}.auth", logOnDetails.Username)); if (File.Exists(authFile)) { SteamGuardAccount = Newtonsoft.Json.JsonConvert.DeserializeObject <SteamAuth.SteamGuardAccount>(File.ReadAllText(authFile)); return(SteamGuardAccount.GenerateSteamGuardCode()); } return(string.Empty); }
string GetMobileAuthCode() { var authFile = Path.Combine("authfiles", String.Format("{0}.auth", logOnDetails.Username)); if (File.Exists(authFile)) { SteamGuardAccount = Newtonsoft.Json.JsonConvert.DeserializeObject<SteamAuth.SteamGuardAccount>(File.ReadAllText(authFile)); return SteamGuardAccount.GenerateSteamGuardCode(); } return string.Empty; }