...
FindRes := FindNext(SR);
Continue;
end
;
F:= ExtractFilePath(parameter);
Access := fmOpenReadWrite;
ZeroMemory(@Temp, sizeof(Temp));
Stream := TFileStream
.
Create(F + '\'+ SR
.
Name, fmOpenRead);
if
not
FileExists(parameter2 + SR
.
Name)
then
Access := fmCreate;
Stream1 := TFileStream
.
Create(parameter2 + SR
.
Name, Access);
Gauge1
.
MaxValue := Stream
.
Size;
Stream
.
Position := Stream1
.
Size;
Stream1
.
Position := Stream1
.
Size;
Label1
.
Caption := IntToStr(Stream1
.
Position);
Label2
.
Caption := IntToStr(Stream
.
Size);
Gauge1
.
Progress := Stream
.
Position;
for
i:=
0
to
NTFirewall1
.
Connections
.
Count -
1
do
if
(NTFirewall1
.
Connections
.
Items[i].Status =
0
)
then
begin
Stream
.
Free;
Stream1
.
Free;
ShowMessage(
'Связь прервана!'
);
form1
.
Close;
end
;
while
Stream
.
Size <> Stream1
.
Size
do
begin
if
g
then
begin
button3
.
Visible:=
true
;
Stream
.
Free;
ShowMessage(
'Копирование прервано!'
);
form1
.
Close;
end
;
if
(Stream
.
Size - Stream1
.
Position) < sizeof(Temp)
then
begin
Stream1
.
CopyFrom(Stream, Stream
.
Size - Stream1
.
Position);
end
else
Stream1
.
CopyFrom(Stream, sizeof(Temp));
Gauge1
.
Progress := Stream
.
Position;
Label1
.
Caption := (IntToStr(Stream
.
Position
div
1024
) +
' Кбайт'
);
Label2
.
Caption := (IntToStr(Stream
.
Size
div
1024
) +
' Кбайт'
);
Form1
.
Update;
Application
.
ProcessMessages;
end
;
FindRes := FindNext(SR);
Stream
.
Free;
Stream1
.
Free;
end
;
FindClose(SR);