private static void Main() { Console.Title = "Exchange Bot by sne4kyFox"; Console.WriteLine("Welcome to the exchange bot!"); Console.WriteLine( "By using this software you agree to the terms in \"license.txt\"."); _config = ConfigHandler.Reload(); ConfigErrorResult errors = _config.CheckForErrors(); if (!errors.Valid) { Console.WriteLine(errors.ErrorMessage); Console.ReadLine(); Environment.Exit(-1); } Console.WriteLine("Attempting web login..."); _account = Web.RetryDoLogin(TimeSpan.FromSeconds(5), 10, _config.Username, _config.Password, _config.SteamMachineAuth); if (!string.IsNullOrEmpty(_account.SteamMachineAuth)) { _config.SteamMachineAuth = _account.SteamMachineAuth; ConfigHandler.WriteChanges(_config); } Console.WriteLine("Login was successful!"); PollOffers(); }
public ConfigErrorResult CheckForErrors() { var result = new ConfigErrorResult(true); if (string.IsNullOrWhiteSpace(Username)) result.AddError("<Username></Username> tag is empty."); if (string.IsNullOrWhiteSpace(Password)) result.AddError("<Password></Password> tag is empty."); if (string.IsNullOrWhiteSpace(ApiKey)) result.AddError("<ApiKey></ApiKey> tag is empty. An API key can be retrieved from https://www.steamcommunity.com/dev/apikey"); return result; }
public ConfigErrorResult CheckForErrors() { var result = new ConfigErrorResult(true); if (string.IsNullOrWhiteSpace(Username)) { result.AddError("<Username></Username> tag is empty."); } if (string.IsNullOrWhiteSpace(Password)) { result.AddError("<Password></Password> tag is empty."); } if (string.IsNullOrWhiteSpace(ApiKey)) { result.AddError("<ApiKey></ApiKey> tag is empty. An API key can be retrieved from https://www.steamcommunity.com/dev/apikey"); } return(result); }