-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmPrincipal.cs
178 lines (166 loc) · 6.23 KB
/
frmPrincipal.cs
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Encript_Master_v2._0
{
public partial class frmPrincipal : Form
{
ASCII ASCII;
HashMD5 HMD5;
public frmPrincipal()
{
InitializeComponent();
this.Text = Titulo;
}
private void ComingSoon()
{
MessageBox.Show("Em breve novas atualizações!", Titulo, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
#region ASCII
string Titulo = "Encryption Master - versão: 2.0";
private void nupFontASCII_ValueChanged(object sender, EventArgs e)
{
try
{
this.Text = Titulo + " (Aumentando Fonte)";
float tamanhofonte = (Convert.ToInt32(nupFontASCII.Value));
this.txtIntASCII.Font = new Font("Consolas", tamanhofonte, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
this.txtExitASCII.Font = new Font("Consolas", tamanhofonte, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
this.Text = Titulo;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnLimparASCII_Click(object sender, EventArgs e)
{
this.Text = Titulo + " (Limpando)";
txtIntASCII.Clear();
txtExitASCII.Clear();
this.Text = Titulo;
}
private void btnCriptASCII_Click(object sender, EventArgs e)
{
if (txtIntASCII.Text == "")
{
MessageBox.Show("Campo 'Entrada' vazio!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
this.Text = Titulo + " (Criptografando)";
try
{
ASCII = new ASCII();
string textoCript = ASCII.Criptografar(txtIntASCII.Text);
txtExitASCII.Text = textoCript;
}
catch (Exception ex)
{
this.Text = Titulo;
MessageBox.Show(ex.Message, "Erro ao tentar criptografar!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Text = Titulo;
}
}
private void btnDescriptASCII_Click(object sender, EventArgs e)
{
if (txtIntASCII.Text == "")
{
MessageBox.Show("Campo 'Entrada' vazio!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
this.Text = Titulo + " (Descriptografando)";
try
{
ASCII = new ASCII();
string textoCript = ASCII.Descriptografar(txtIntASCII.Text);
txtExitASCII.Text = textoCript;
}
catch (Exception ex)
{
this.Text = Titulo;
MessageBox.Show(ex.Message + "\n\nTalvez você colocou texto comum no campo 'Entrada'.", "Erro ao tentar descriptografar!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Text = Titulo;
}
}
private void btnMultiCriptASCII_Click(object sender, EventArgs e)
{
frmMultiCriptASCII MultiCriptASCII = new frmMultiCriptASCII();
MultiCriptASCII.ShowDialog();
}
#endregion
#region HashMD5
private void nupFontMD5_ValueChanged(object sender, EventArgs e)
{
try
{
this.Text = Titulo + " (Aumentando Fonte)";
float tamanhofonte = (Convert.ToInt32(nupFontMD5.Value));
this.txtIntHMD5.Font = new Font("Consolas", tamanhofonte, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
this.txtExitHMD5.Font = new Font("Consolas", tamanhofonte, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
this.Text = Titulo;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnLimparHMD5_Click(object sender, EventArgs e)
{
txtIntHMD5.Clear();
txtExitHMD5.Clear();
}
private void btnDescriptMD5_Click(object sender, EventArgs e)
{
ComingSoon();
}
private void btnCriptMD5_Click(object sender, EventArgs e)
{
if (txtIntHMD5.Text == "")
{
this.Text = Titulo + " (Criptografando)";
try
{
HMD5 = new HashMD5();
txtExitHMD5.Text = HMD5.Criptografar(txtIntHMD5.Text);
}
catch (Exception ex)
{
this.Text = Titulo;
MessageBox.Show(ex.Message, "Erro ao criptografar!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Text = Titulo;
}
else
{
this.Text = Titulo + " (Criptografando)";
try
{
HMD5 = new HashMD5();
txtExitHMD5.Text = HMD5.Criptografar(txtIntHMD5.Text);
}
catch (Exception ex)
{
this.Text = Titulo;
MessageBox.Show(ex.Message, "Erro ao tentar criptografar!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Text = Titulo;
}
}
private void btnMultiCriptMD5_Click(object sender, EventArgs e)
{
frmMultiEncodHashMD5 HMD5 = new frmMultiEncodHashMD5();
HMD5.ShowDialog();
}
#endregion
}
}