Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        private static void Main()
        {
            Console.Title = "Confirmer by sne4kyFox";
            Console.WriteLine("This program will accept any and ALL mobile auth confirmations, use with extreme caution.");
            Console.WriteLine(
                "By using this software you agree to the terms in \"license.txt\".");

            _config = ConfigHandler.Reload();

            if (string.IsNullOrEmpty(_config.ApiKey))
            {
                Console.WriteLine("Fatal error: API key is missing. Please fill in the API key field in \"configuration.xml\"");
                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!");
            while (!File.Exists("account.maFile"))
            {
                SteamAuthLogin();
            }
            var sgAccount = JsonConvert.DeserializeObject <SteamGuardAccount>(File.ReadAllText("account.maFile"));

            AcceptConfirmationsLoop(sgAccount);
        }
Ejemplo n.º 3
0
        //load config
        static void LoadConfig()
        {
            _config = ConfigHandler.Reload(_config);

            if (!string.IsNullOrEmpty(_config.ApiKey))
            {
                return;
            }
            Console.WriteLine("Fatal error: API key is missing. Please fill in the API key field in \"configuration.xml\"");
            Console.ReadLine();
            Environment.Exit(-1);
        }
Ejemplo n.º 4
0
        private static void Main()
        {
            Console.Title = "Donation Bot by sne4kyFox";
            Console.WriteLine("Welcome to the donation bot!");
            Console.WriteLine(
                "By using this software you agree to the terms in \"license.txt\".");

            _config = ConfigHandler.Reload(_config);

            if (string.IsNullOrEmpty(_config.ApiKey))
            {
                Console.WriteLine("Fatal error: API key is missing. Please fill in the API key field in \"configuration.xml\"");
                Console.ReadLine();
                Environment.Exit(-1);
            }

            _apiKey = _config.ApiKey;

            if (string.IsNullOrEmpty(_config.Username) || string.IsNullOrEmpty(_config.Password))
            {
                Console.WriteLine("Please input your username and password.");

                Console.Write("Username: "******"Password: "******"Attempting web login...");

            _account = Web.RetryDoLogin(TimeSpan.FromSeconds(5), 10, _user, _pass, _config.SteamMachineAuth);

            if (!string.IsNullOrEmpty(_account.SteamMachineAuth))
            {
                _config.SteamMachineAuth = _account.SteamMachineAuth;
                ConfigHandler.WriteChanges(_config);
            }

            Console.WriteLine("Login was successful!");

            PollOffers();
        }
Ejemplo n.º 5
0
        private void LoadingScreen_Loaded(object sender, RoutedEventArgs e)
        {
            #region config
            DefaultConfig config = ConfigHandler.Reload(new DefaultConfig("configuration.xml"));
            if (string.IsNullOrEmpty(config.ApiKey))
            {
                ComplainQuit("API key is missing. Please fill in the API key field in \"configuration.xml\"");
            }
            if (string.IsNullOrEmpty(config.Username) || string.IsNullOrEmpty(config.Password))
            {
                ComplainQuit(
                    "Username or Password missing. Please fill in their respective fields in \"configuration.xml\"");
            }
            #endregion

            #region login
            Task.Run(() =>
            {
                Account account = Web.RetryDoLogin(TimeSpan.FromSeconds(5), 10, config.Username, config.Password, config.SteamMachineAuth, new UserInputOutputHandler());

                if (!string.IsNullOrEmpty(account.SteamMachineAuth))
                {
                    config.SteamMachineAuth = account.SteamMachineAuth;
                    ConfigHandler.WriteChanges(config);
                }

                Dispatcher.Invoke(() =>
                {
                    _mainWindow = new FriendsListWindow(account, config.ApiKey);
                    _mainWindow.OnLoadingFinished += MainWindow_LoadingFinished;
                    _mainWindow.Closed            += MainWindow_Closed;
                    var loginThread = new Thread(() =>
                    {
                        _mainWindow.LoginAndGoOnline();
                    });
                    loginThread.Start();
                });
            });
            #endregion
        }