This repository was archived by the owner on Jan 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnit8.pas
More file actions
195 lines (179 loc) · 4.56 KB
/
Unit8.pas
File metadata and controls
195 lines (179 loc) · 4.56 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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
unit Unit8;
interface
{$WARN UNIT_PLATFORM OFF}
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, Unit1, FileCtrl;
type
TLGRForm = class(TForm)
ComboBox1: TComboBox;
LabeledEdit1: TLabeledEdit;
Label1: TLabel;
Memo1: TMemo;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
SpeedButton1: TSpeedButton;
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure FormDeactivate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure LabeledEdit1KeyPress(Sender: TObject; var Key: Char);
procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
LGRForm: TLGRForm;
implementation
{$R *.dfm}
procedure TLGRForm.FormShow(Sender: TObject);
var
SR:TSearchRec;
begin
ComboBox1.Items.Clear;
if FindFirst(CurDir+'\LGR\*.lgr',faAnyFile,SR)=0 then begin
SetLength(SR.Name,Pos('.',SR.Name)-1);
SR.Name:=LowerCase(SR.Name);
ComboBox1.Items.Add(SR.Name);
while FindNext(SR)=0 do begin
SetLength(SR.Name,Pos('.',SR.Name)-1);
SR.Name:=LowerCase(SR.Name);
ComboBox1.Items.Add(SR.Name);
end;
end;
ComboBox1.Sorted:=true;
ComboBox1.ItemIndex:=ComboBox1.Items.IndexOf(Level.LGR);
LabeledEdit1.Text:=CurDir+'\'+Level.LGR;
Memo1.Clear;
end;
procedure TLGRForm.BitBtn1Click(Sender: TObject);
var
f,f2:TFileStream;
ft:TextFile;
mas:array of
record
dis,clip,unn:dword;
tip:string[4];
end;
i,j:integer;
id:string[5];
nofp,nofall,dw:dword;
name:string[12];
names:array of string[10];
b:byte;
begin
f:=nil;
try
f:=TFileStream.Create(CurDir+'\LGR\'+ComboBox1.Text+'.lgr',fmOpenRead);
AssignFile(ft,LabeledEdit1.Text+'\pictures.lst');
CreateDir(LabeledEdit1.Text);
//ShowMessage(LabeledEdit1.Text+'\pictures.lst');
f.Read(id[1],5);
id[0]:=#5;
if id<>'LGR12' then exit;
f.Read(nofall,4);
f.Read(dw,4);
f.Read(nofp,4);
SetLength(names,nofp);
for i:=0 to nofp-1 do begin
SetLength(names[i],10);
f.Read(names[i,1],10);
//Memo1.Lines.Add(names[i]);
end;
SetLength(Mas,nofp);
for i:=0 to nofp-1 do begin
SetLength(mas[i].tip,4);
f.Read(mas[i].tip[1],4);
end;
for i:=0 to nofp-1 do
f.Read(mas[i].dis,4);
for i:=0 to nofp-1 do
f.Read(mas[i].clip,4);
for i:=0 to nofp-1 do
f.Read(mas[i].unn,4);
Rewrite(ft);
for i:=0 to nofp-1 do with mas[i] do begin
//Memo1.Lines.Add(mas[i].tip[1]);
for j:=1 to 10 do
if names[i,j]=#0 then names[i,j]:=' ';
Write(ft,names[i]);
case tip[1] of
'd':Write(ft,'pict');
'e':Write(ft,'text');
'f':Write(ft,'mask');
end;
if tip[1]='f' then Writeln(ft) else begin
Write(ft,' ',mas[i].dis,' ');
case mas[i].clip of
0:Writeln(ft,'u');
1:Writeln(ft,'g');
2:Writeln(ft,'s');
end;
end;
end;
CloseFile(ft);
for i:=0 to nofall-1 do begin
SetLength(name,12);
f.Read(name[1],12);
f.Read(dw,4);
f.Read(dw,4);
f.Read(dw,4);
if not FileExists(LabeledEdit1.Text+'\'+name) then begin
f2:=TFileStream.Create(LabeledEdit1.Text+'\'+name,fmCreate);
f2.Free;
end;
f2:=TFileStream.Create(LabeledEdit1.Text+'\'+name,fmOpenWrite);
Memo1.Lines.Add(MessageString[47]+' '+name);
for j:=0 to dw-1 do begin
f.Read(b,1);
f2.Write(b,1);
end;
f2.Free;
end;
Memo1.Lines.Add(MessageString[48])
finally
f.Free;
end;
end;
procedure TLGRForm.ComboBox1Change(Sender: TObject);
begin
LabeledEdit1.Text:=CurDir+'\'+ComboBox1.Text;
end;
procedure TLGRForm.FormDeactivate(Sender: TObject);
begin
ModalResult:=mrCancel;
Close;
end;
procedure TLGRForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=VK_ESCAPE then Close;
end;
procedure TLGRForm.LabeledEdit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then begin
key:=#0;
BitBtn1Click(nil);
end;
end;
procedure TLGRForm.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then begin
key:=#0;
LabeledEdit1.SetFocus;
end;
end;
procedure TLGRForm.SpeedButton1Click(Sender: TObject);
var
s:string;
begin
s:=CurDir;
if SelectDirectory(MessageString[41],'',s) then
LabeledEdit1.Text:=s;
end;
end.