-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuMain.pas
More file actions
66 lines (54 loc) · 1.36 KB
/
uMain.pas
File metadata and controls
66 lines (54 loc) · 1.36 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
unit uMain;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Edit,
FMX.Controls.Presentation, FMX.StdCtrls;
const
MAX_COLUMN = 20;
type
TfrmMain = class(TForm)
Label1: TLabel;
edtText: TEdit;
Label2: TLabel;
edtEncode: TEdit;
Label3: TLabel;
edtDecode: TEdit;
chkTerminateWithEqualSigns: TCheckBox;
procedure edtTextChangeTracking(Sender: TObject);
procedure chkTerminateWithEqualSignsChange(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure DoTest;
end;
var
frmMain: TfrmMain;
implementation
uses
Rac.Base64;
{$R *.fmx}
procedure TfrmMain.chkTerminateWithEqualSignsChange(Sender: TObject);
begin
DoTest;
end;
procedure TfrmMain.DoTest;
begin
edtEncode.Text := TBase64.NewLineAfterColumn(
TBase64.Encode(
TEncoding.UTF8.GetBytes(edtText.Text),
chkTerminateWithEqualSigns.IsChecked),
MAX_COLUMN);
try
edtDecode.Text := TEncoding.UTF8.GetString(TBase64.Decode(edtEncode.Text));
except
on E: Exception do
edtDecode.Text := 'Decode Error: ' + E.Message;
end;
end;
procedure TfrmMain.edtTextChangeTracking(Sender: TObject);
begin
DoTest;
end;
end.