예제 #1
0
        private static void Start()
        {
            Console.Title = "Akarr's steambot";

            Console.ForegroundColor = ConsoleColor.White;

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            config = new Config();
            if (!config.LoadConfig())
            {
                Console.WriteLine("Config file (config.cfg) can't be found or is corrupted ! Bot can't start.");
                Console.ReadKey();
                return;
            }

            PrintWelcomeMessage();

            Updater updater = new Updater(config.DisableAutoUpdate, BUILD_VERSION);

            LoadModules();

            Task.WaitAll(updater.Update());

            httpsrv = new HTTPServer(config.WebinterfacePort);
            httpsrv.Listen();

            if (config.DisplayLocation)
            {
                SendLocation();
            }

            steambotManager = new Manager(config);
            threadManager   = new Thread(new ThreadStart(steambotManager.Start));
            threadManager.CurrentUICulture = new CultureInfo("en-US");
            threadManager.Start();

            AttemptLoginBot(config.SteamUsername, config.SteamPassword, config.SteamAPIKey);

            while (steambotManager.OnlineBots.Count < 1)
            {
                Thread.Sleep(TimeSpan.FromSeconds(3));
            }

            steambotManager.SelectFirstBot();

            string command = "";

            do
            {
                Console.Write("> ");
                command = Console.ReadLine();
                steambotManager.Command(command);
            } while(command != "quit");

            httpsrv.Stop();
            steambotManager.Stop();
        }
예제 #2
0
        private static void AttemptLoginBot(string username, string password, string api)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            string hidenAPI = api.Substring(api.Length - 10) + "**********";
            string data     = String.Format("Username : {0}  Password : X  API : {1}", username, hidenAPI);

            Console.WriteLine(data);
            Console.ForegroundColor = ConsoleColor.White;
            logininfo = new LoginInfo(username, password, api);

            if (!steambotManager.Auth(logininfo))
            {
                steambotManager.Stop();
            }
        }