-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrm_Main.cs
More file actions
135 lines (129 loc) · 4.63 KB
/
Frm_Main.cs
File metadata and controls
135 lines (129 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
namespace OfflinePM
{
public partial class Frm_Main : Form
{
public Frm_Main()
{
InitializeComponent();
}
public string master_pass = string.Empty;
private string key = "843f0736881b4c8e95b5c4459105be0b";
private void btn_copyuser_Click(object sender, EventArgs e)
{
Clipboard.SetText(txt_user.Text);
}
private void btn_showpwd_Click(object sender, EventArgs e)
{
if(txt_pass.PasswordChar == '●')
{
txt_pass.PasswordChar = '\0';
btn_showpwd.Text = "Hide";
}
else
{
txt_pass.PasswordChar = '●';
btn_showpwd.Text = "Show";
}
}
private void btn_copypwd_Click(object sender, EventArgs e)
{
Clipboard.SetText(txt_pass.Text);
}
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);
}
}
}
private void Frm_Main_Load(object sender, EventArgs e)
{
}
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);
}
}
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)
{
}
}
}
}