Пример #1
0
 private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
 {
     if (e.ClickedItem.Text == "Add")
     {
         Frm_Add add = new Frm_Add();
         add.Show();
     }
     if (e.ClickedItem.Text == "Change Master Password")
     {
         MessageBox.Show("Coming Soon...");
     }
     if (e.ClickedItem.Text == "Refresh")
     {
         try
         {
             listBox1.Items.Clear();
             using (StreamReader sr = new StreamReader(Application.StartupPath + @"\Data.opm"))
             {
                 string[] get_service = sr.ReadToEnd().Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                 foreach (string str in get_service)
                 {
                     var      decryptedString = AesOperation.DecryptString(key, str);
                     string[] real_str        = decryptedString.Split("|");
                     listBox1.Items.Add(real_str[0]);
                 }
                 sr.Close();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Пример #2
0
 private void Frm_Main_Shown(object sender, EventArgs e)
 {
     if (master_pass == string.Empty)
     {
         this.Hide();
         Frm_Login login = new Frm_Login();
         login.Show();
     }
     try
     {
         listBox1.Items.Clear();
         using (StreamReader sr = new StreamReader(Application.StartupPath + @"\Data.opm"))
         {
             string[] get_service = sr.ReadToEnd().Split(new[] { Environment.NewLine }, StringSplitOptions.None);
             foreach (string str in get_service)
             {
                 var      decryptedString = AesOperation.DecryptString(key, str);
                 string[] real_str        = decryptedString.Split("|");
                 listBox1.Items.Add(real_str[0]);
             }
             sr.Close();
         }
     }
     catch (Exception ex)
     {
     }
 }
Пример #3
0
 private void btn_enter_Click(object sender, EventArgs e)
 {
     try
     {
         using (StreamReader sr = new StreamReader(Application.StartupPath + @"\Config.opm"))
         {
             var key             = "4622c3067f0d4b8c903717443ca0b4ee";
             var decryptedString = AesOperation.DecryptString(key, sr.ReadLine());
             if (txt_pwd.Text == decryptedString)
             {
                 Frm_Main main = new Frm_Main();
                 main.master_pass = decryptedString;
                 main.Show();
                 this.Hide();
             }
             else
             {
                 MessageBox.Show("Login Failed!");
             }
             sr.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #4
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            int duplicate = 0;

            try
            {
                using (StreamReader sr = File.OpenText(Application.StartupPath + @"\Data.opm"))
                {
                    string[] lines = sr.ReadToEnd().Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                    foreach (string str in lines)
                    {
                        string[] real_str = str.Split("|");
                        if (real_str[0] == txt_addweb.Text)
                        {
                            duplicate = 1;
                        }
                        sr.Close();
                    }
                }
            }
            catch
            {
            }
            finally
            {
                if (duplicate != 0)
                {
                    MessageBox.Show("duplicate data");
                }
                else
                {
                    using (StreamWriter sw = File.AppendText(Application.StartupPath + @"\Data.opm"))
                    {
                        var    key             = "843f0736881b4c8e95b5c4459105be0b";
                        string plaintext       = txt_addweb.Text + "|" + txt_adduser.Text + "|" + txt_addpwd.Text;
                        var    encryptedString = AesOperation.EncryptString(key, plaintext);
                        sw.WriteLine(encryptedString);
                    }
                    this.Close();
                }
            }
        }
Пример #5
0
 private void btn_create_Click(object sender, EventArgs e)
 {
     try
     {
         using (StreamWriter sw = File.AppendText(Application.StartupPath + @"\Config.opm"))
         {
             var key             = "4622c3067f0d4b8c903717443ca0b4ee";
             var encryptedString = AesOperation.EncryptString(key, txt_createpwd.Text);
             sw.WriteLine(encryptedString);
             sw.Flush();
             sw.Close();
         }
     }
     catch
     {
     }
     finally
     {
         Frm_Main main = new Frm_Main();
         main.Show();
         this.Hide();
     }
 }
Пример #6
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         using (StreamReader sr = new StreamReader(Application.StartupPath + @"\Data.opm"))
         {
             string[] get_service     = sr.ReadToEnd().Split(new[] { Environment.NewLine }, StringSplitOptions.None);
             var      decryptedString = new List <string>();
             foreach (string str in get_service)
             {
                 decryptedString.Add(AesOperation.DecryptString(key, str));
             }
             int      num      = listBox1.SelectedIndex;
             string[] real_str = decryptedString[num].Split("|");
             txt_user.Text = real_str[1];
             txt_pass.Text = real_str[2];
             sr.Close();
         }
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message);
     }
 }