forked from joseafilho/cine-tapioca
-
Notifications
You must be signed in to change notification settings - Fork 1
/
uSystemUtils.pas
59 lines (44 loc) · 1.58 KB
/
uSystemUtils.pas
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
unit uSystemUtils;
interface
procedure ShowInformation(const Msg: string);
function ShowQuestion(const Msg: string): boolean;
function Criptografar(wStri: String): String;
implementation
uses
System.SysUtils, Vcl.Forms, Winapi.Windows, Vcl.Controls;
procedure ShowInformation(const Msg: string);
begin
Application.MessageBox(PWideChar(Msg), PWideChar(Application.Title),
MB_ICONINFORMATION + MB_OK);
end;
function ShowQuestion(const Msg: string): boolean;
begin
Result := Application.MessageBox(PWideChar(Msg), PWideChar(Application.Title),
MB_ICONQUESTION + MB_YESNO + MB_DEFBUTTON2) = mrYes;
end;
function Criptografar(wStri: String): String;
var
Simbolos: array [0 .. 4] of String;
x: Integer;
begin
Simbolos[1] := 'ABCDEFGHIJLMNOPQRSTUVXZYWK ~!@#$%^&*()';
Simbolos[2] := 'ÂÀ©Øû׃çêùÿ5Üø£úñѪº¿®¬¼ëèïÙýÄÅÉæÆôöò»Á';
Simbolos[3] := 'abcdefghijlmnopqrstuvxzywk1234567890';
Simbolos[4] := 'áâäàåíóÇü龶§÷ÎÏ-+ÌÓ߸°¨·¹³²Õµþîì¡«½';
for x := 1 to Length(Trim(wStri)) do
begin
if pos(copy(wStri, x, 1), Simbolos[1]) > 0 then
Result := Result + copy(Simbolos[2], pos(copy(wStri, x, 1),
Simbolos[1]), 1)
else if pos(copy(wStri, x, 1), Simbolos[2]) > 0 then
Result := Result + copy(Simbolos[1], pos(copy(wStri, x, 1),
Simbolos[2]), 1)
else if pos(copy(wStri, x, 1), Simbolos[3]) > 0 then
Result := Result + copy(Simbolos[4], pos(copy(wStri, x, 1),
Simbolos[3]), 1)
else if pos(copy(wStri, x, 1), Simbolos[4]) > 0 then
Result := Result + copy(Simbolos[3], pos(copy(wStri, x, 1),
Simbolos[4]), 1);
end;
end;
end.