public UpdatePassword()
        {
            InitializeComponent();
            info = (fileCreation.ReadFromFile
                        (MainWindow.loggedInUser.fileLocation));

            foreach (string inf in info)
            {
                string stringSplit = "nEpABaiGaIrNeKoNec!!jaXociuumirat:))";

                string[] split = inf.Split(new string[] { stringSplit }, StringSplitOptions.None);

                if (split[1].Contains("NaujasLainasRRR"))
                {
                    split[1] = split[1].Replace("NaujasLainasRRR", "\r");
                }
                if (split[1].Contains("NaujasLainasNNN"))
                {
                    split[1] = split[1].Replace("NaujasLainasNNN", "\n");
                }
                split[1] = passwordHashing.EncryptingAndDecryptingPasswordWithDES(split[1], false);
                dataGridView.Rows.Add(split);
            }
            dataGridView.Columns[1].Visible = false;
        }
Ejemplo n.º 2
0
        private void createButton_Click(object sender, EventArgs e)
        {
            PasswordHashing passwordHashing = new PasswordHashing();
            FileCreation    fileCreation    = new FileCreation();

            try
            {
                Validation();
                List <string> info = new List <string>();
                info.Add(loginNameBox.Text);
                info.Add(passwordHashing.
                         EncryptingAndDecryptingPasswordWithDES(passwordBox.Text, true));
                if (urlBox.Text != "")
                {
                    info.Add(urlBox.Text);
                }
                if (moreInfoBox.Text != "")
                {
                    info.Add(moreInfoBox.Text);
                }
                fileCreation.WriteToFile(MainWindow.loggedInUser.fileLocation, info);

                MessageBox.Show("New password is successfully added!");

                loginNameBox.Text = "";
                passwordBox.Text  = "";
                urlBox.Text       = "";
                moreInfoBox.Text  = "";
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }