-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuOPTION.pas
118 lines (101 loc) · 2.67 KB
/
uOPTION.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
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
unit uOPTION;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TfrmOPTION = class(TForm)
GroupBox1: TGroupBox;
TxtSaveCompressed: TEdit;
Button1: TButton;
TxtSaveDecompressed: TEdit;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Button3: TButton;
Button4: TButton;
Button5: TButton;
procedure ReadPath();
procedure Button5Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
COMPRESS_DIR = 'SystemPath.dat';
var
frmOPTION: TfrmOPTION;
FH: TextFile;
ArrDir: Array[0..5] of String;
implementation
uses uTREEVIEW;
{$R *.dfm}
procedure TfrmOPTION.ReadPath();
var
Hold: String;
I: Byte;
begin
{ if file isn't exist, simply write it back so it always can be read }
if not FileExists(COMPRESS_DIR) then begin
AssignFile(FH, COMPRESS_DIR);
ReWrite(FH); { alternative append, reset }
WriteLn(FH, '{Not Defined Yet}');
WriteLn(FH, '{Not Defined Yet}');
CloseFile(FH);
end;
I := 0;
AssignFile(FH, COMPRESS_DIR);
Reset(FH);
While not EOF(FH) do begin
Readln(FH, Hold);
ArrDir[I] := Hold;
Inc(I);
end;
CloseFile(FH);
end;
procedure TfrmOPTION.Button5Click(Sender: TObject);
begin
MessageDlg('Define where the compressed or decompressed file will be saved', MtInformation, [MbOk], 0);
end;
{ Cancle }
procedure TfrmOPTION.Button4Click(Sender: TObject);
begin
ReadPath();
TxtSaveCompressed.Text := ArrDir[0];
TxtSaveDecompressed.Text := ArrDir[1];
Self.Close;
end;
procedure TfrmOPTION.Button1Click(Sender: TObject);
begin
frmTREEVIEW.Label1.Caption := '0'; { as an indicator for TREEVIEW, so it doesn't confuse }
frmTREEVIEW.Show; { where it is come from }
end;
procedure TfrmOPTION.Button2Click(Sender: TObject);
begin
frmTREEVIEW.Label1.Caption := '1';
frmTREEVIEW.Show;
end;
{ Okay }
procedure TfrmOPTION.Button3Click(Sender: TObject);
begin
{ update a new path }
AssignFile(FH, COMPRESS_DIR);
ReWrite(FH);
WriteLn(FH, TxtSaveCompressed.Text);
WriteLn(FH, TxtSaveDecompressed.Text);
CloseFile(FH);
Self.Close;
end;
procedure TfrmOPTION.FormCreate(Sender: TObject);
begin
ReadPath();
TxtSaveCompressed.Text := ArrDir[0];
TxtSaveDecompressed.Text := ArrDir[1];
end;
end.