示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Criptage hash   = new Criptage();
            string   Hashed = hash.Hash(passwordBox.Text);

            if (File.Exists(Environment.CurrentDirectory + "/pswrd"))
            {
                StreamReader rd    = new StreamReader(Environment.CurrentDirectory + "/pswrd");
                string       pswrd = rd.ReadLine();
                rd.Close();


                if (Hashed == pswrd)
                {
                    Form.ActiveForm.Hide();
                    Form1 f = new Form1();
                    f.Show();
                }
            }

            else
            {
                StreamWriter sw = new StreamWriter(Environment.CurrentDirectory + "/pswrd");
                sw.WriteLine(hash.Hash(passwordBox.Text));
                sw.Close();

                Form.ActiveForm.Hide();
                Form1 f = new Form1();
                f.Show();
            }
        }
示例#2
0
文件: AddForm.cs 项目: dogasp/Projets
        private void button1_Click(object sender, EventArgs e)
        {
            string Site     = website.Text;
            string Link     = link.Text;
            string User     = user.Text;
            string Password = Hash.Hash(password.Text);

            if (User != "" && Password != "" && Site != "" && Link != "")
            {
                Psw temp = new Psw(User, Password, Site, Link);
                this.parent.array.Add(temp);
                StreamWriter sw = new StreamWriter(Environment.CurrentDirectory + "/save.txt");
                foreach (Psw password in this.parent.array)
                {
                    sw.WriteLine(password.user + "," + password.pswrd + "," + password.SiteName + "," + password.SiteLink);
                }
                sw.Close();
                this.Close();
                parent.Close();
                Form1 f = new Form1();
                f.Show();
            }
            else
            {
                MessageBox.Show("Please fill all avalable fields");
            }
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            StreamReader rd    = new StreamReader(Environment.CurrentDirectory + "/pswrd");
            string       pswrd = rd.ReadLine();

            rd.Close();
            if (hash.Hash(old.Text) == pswrd)
            {
                if (new1.Text == new2.Text && new1.Text != "")
                {
                    StreamWriter sw = new StreamWriter(Environment.CurrentDirectory + "/pswrd");
                    sw.WriteLine(hash.Hash(new1.Text));
                    sw.Close();
                    this.Close();
                }
            }
        }