상속: ConfigFrame
예제 #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(_config);

            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();
        }
예제 #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(_config);

            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);
        }
예제 #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);
        }
예제 #4
0
        /// <summary>
        /// Reloads the configuration file (path). If file is not present, it will generate a new one.
        /// </summary>
        /// <returns>A RootConfig object.</returns>
        public DefaultConfig Reload(DefaultConfig config)
        {
            if (!File.Exists(config.Path))
            {
                File.WriteAllText(config.Path, config.SerializeToJson());
            }

            config = JsonConvert.DeserializeObject <DefaultConfig>(File.ReadAllText(config.Path));

            return(config);
        }
        /// <summary>
        /// Reloads the configuration file (path). If file is not present, it will generate a new one.
        /// </summary>
        /// <returns>A RootConfig object.</returns>
        public DefaultConfig Reload(DefaultConfig config)
        {
            if (!File.Exists(config.Path))
            {
                File.WriteAllText(config.Path, config.SerializeToJson());
            }

            config = JsonConvert.DeserializeObject<DefaultConfig>(File.ReadAllText(config.Path));

            return config;
        }
        /// <summary>
        /// Reloads the configuration file (path). If file is not present, it will generate a new one.
        /// </summary>
        /// <returns>A RootConfig object.</returns>
        public DefaultConfig Reload()
        {
            var config = new DefaultConfig();
            if (!File.Exists(_path))
            {
                File.WriteAllText(_path, config.SerializeToJson());
            }

            config = JsonConvert.DeserializeObject<DefaultConfig>(File.ReadAllText(_path));

            return config;
        }
예제 #7
0
        /// <summary>
        /// Reloads the configuration file (path). If file is not present, it will generate a new one.
        /// </summary>
        /// <returns>A RootConfig object.</returns>
        public DefaultConfig Reload()
        {
            var config = new DefaultConfig();

            if (!File.Exists(_path))
            {
                File.WriteAllText(_path, config.SerializeToJson());
            }

            config = JsonConvert.DeserializeObject <DefaultConfig>(File.ReadAllText(_path));

            return(config);
        }
예제 #8
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();
        }
예제 #9
0
        /// <summary>
        /// Reloads the configuration file (path). If file is not present, it will generate a new one.
        /// </summary>
        /// <returns>A RootConfig object.</returns>
        public DefaultConfig Reload()
        {
            var defaultConfig = new DefaultConfig();

            if (!File.Exists(_path))
            {
                File.WriteAllText(_path, defaultConfig.SerializeToXml());
            }

            using (var sr = new StreamReader(_path))
            {
                defaultConfig =
                    (DefaultConfig)
                    new XmlSerializer(typeof(DefaultConfig)).Deserialize(sr);
            }

            return(defaultConfig);
        }
        /// <summary>
        /// Reloads the configuration file (path). If file is not present, it will generate a new one.
        /// </summary>
        /// <returns>A RootConfig object.</returns>
        public DefaultConfig Reload(DefaultConfig config)
        {
            DefaultConfig defaultConfig = new DefaultConfig(config.Path);

            if (!File.Exists(config.Path))
            {
                File.WriteAllText(config.Path, defaultConfig.SerializeToXml());
            }

            using (var sr = new StreamReader(config.Path))
            {
                defaultConfig =
                    (DefaultConfig)
                        new XmlSerializer(typeof (DefaultConfig)).Deserialize(sr);
            }

            return defaultConfig;
        }
예제 #11
0
 /// <summary>
 /// Writes the changes made to the config.
 /// </summary>
 /// <param name="towrite"></param>
 public void WriteChanges(DefaultConfig towrite)
 {
     File.WriteAllText(_path, towrite.SerializeToXml());
 }
예제 #12
0
 /// <summary>
 /// Writes the changes made to the config.
 /// </summary>
 /// <param name="towrite"></param>
 public void WriteChanges(DefaultConfig towrite)
 {
     File.WriteAllText(_path, JsonConvert.SerializeObject(towrite));
 }
 /// <summary>
 /// Writes the changes made to the config.
 /// </summary>
 /// <param name="towrite"></param>
 public void WriteChanges(DefaultConfig towrite)
 {
     File.WriteAllText(towrite.Path, JsonConvert.SerializeObject(towrite));
 }
 /// <summary>
 /// Writes the changes made to the config.
 /// </summary>
 /// <param name="towrite"></param>
 public void WriteChanges(DefaultConfig towrite)
 {
     File.WriteAllText(towrite.Path, towrite.SerializeToXml());
 }