示例#1
0
 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));
     }
 }
示例#2
0
        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);
        }
示例#3
0
 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;
 }