コード例 #1
0
ファイル: UI.cs プロジェクト: gclarobatista/OhmzaoBot
        private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) // ENCRIPTA DADOS USER E ESCREVE FICHEIRO
        {
            string paraEncriptar = $"{textBox3.Text};{textBox4.Text};{textBox5.Text}";
            string encriptada    = Encriptação.Encrypt(paraEncriptar);

            string path = "account.txt";

            if (!File.Exists(path))
            {
                File.Create(path).Dispose();
            }

            using (var tw = new StreamWriter(path))
            {
                tw.WriteLine(encriptada);
            }
        }
コード例 #2
0
ファイル: UI.cs プロジェクト: gclarobatista/OhmzaoBot
        private void CarregarDadosConta()
        {
            string path       = "account.txt";
            string encriptada = string.Empty;

            if (File.Exists(path))
            {
                using (var streamReader = new StreamReader(path))
                {
                    encriptada = streamReader.ReadLine();
                }

                string desencriptada = string.Empty;
                if (encriptada.Length > 0)
                {
                    desencriptada = Encriptação.Decrypt(encriptada);
                    string[] dados = desencriptada.Split(';');
                    textBox3.Text = dados[0]; //preenche user
                    textBox4.Text = dados[1]; //preenche pass
                    textBox5.Text = dados[2]; // preenche server
                }
            }
        }