Beispiel #1
0
        public void SaveSettings(string apiKey, string accountId)
        {
            string password = null;

            while (true)
            {
                password = InputPassword();

                if (password != null || password != string.Empty)
                {
                    break;
                }

                _logger.AddLogEntry("User inserted invalid password upon saving settings.");
                Console.WriteLine("We need a valid password.");
            }

            var encryptedSettings = _encrypt.AesEncrypt(apiKey + ":" + accountId, password);

            using (var sw = new StreamWriter(Path.Join(_dirPath, "Settings.txt"), false))
            {
                sw.WriteLine(encryptedSettings);
            }

            _logger.AddLogEntry("Saved settings to settings file.");
        }