Exemple #1
0
        private void saveCredentials()
        {
            var credList = (from DataGridViewRow row in credDataView.Rows
                            select new Credentials
            {
                alias = row.Cells[0].Value?.ToString(), key = row.Cells[1].Value?.ToString(), secret = row.Cells[2].Value?.ToString()
            }).ToList();
            var savePath = Path.Combine(Main.GetFolderPath(), "Credentials.txt");


            try
            {
                using (TextWriter tw = new StreamWriter(savePath))
                {
                    tw.Write(StringCipher.encrypt(JsonConvert.SerializeObject(credList), StringCipher.getKey()));
                    MessageBox.Show(@"Credentials Saved");
                    _promptSave = false;
                }
            }
            catch (IOException e)
            {
                // something happened?
                MessageBox.Show(e.Message);
            }
        }
Exemple #2
0
        private void saveUrlBtn_Click(object sender, EventArgs e)
        {
            var savePath = Path.Combine(GetFolderPath(), "OneRosterURL.txt");

            try
            {
                using (TextWriter tw = new StreamWriter(savePath))
                {
                    tw.Write(StringCipher.encrypt(oneRosterUrl.Text.Trim(), StringCipher.getKey()));
                    MessageBox.Show(@"URL Saved");
                }
            }
            catch (IOException a)
            {
                // something happened?
                MessageBox.Show(a.Message);
            }
        }