Exemple #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            //Enregistrer les modifs
            string date = calendrier.SelectionRange.Start.ToString("yyyy-MM-dd");

            if (File.Exists(adresseDossier + date))
            {
                //File.WriteAllText(adresseDossier + date, richTextBox1.Text);
                byte[] cipher = CipherTools.Encrypt(Encoding.Unicode.GetBytes(richTextBox1.Text), pwd, salt);
                string result = String.Empty;
                foreach (byte c in cipher)
                {
                    result += c.ToString() + " ";
                }
                File.WriteAllText(adresseDossier + date, result);
            }
        }
Exemple #2
0
        private void buttonNouveau_Click(object sender, EventArgs e)
        {
            //Creer
            string date = calendrier.SelectionRange.Start.ToString("yyyy-MM-dd");

            if (!String.IsNullOrEmpty(pwd))
            {
                if (!File.Exists(adresseDossier + date))
                {
                    File.Create(adresseDossier + date).Close();
                    if (richTextBox1.Text.Length > 0)
                    {
                        //File.AppendAllText(adresseDossier + date, richTextBox1.Text);
                        byte[] cipher = CipherTools.Encrypt(Encoding.Unicode.GetBytes(richTextBox1.Text), pwd, salt);
                        string result = String.Empty;
                        foreach (byte c in cipher)
                        {
                            result += c.ToString() + " ";
                        }
                        File.AppendAllText(adresseDossier + date, result);
                    }
                }
            }
        }