unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
ZLib,IniFiles,ShellApi,Dialogs;
type
TForm1 =
class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
Var dir,version:
string; stream:Tstream;
var Ini: TIniFile; update:boolean;
procedure Decompress(InputFileName, OutputFileName:
string);
var InputStream, OutputStream: TFileStream;
DeCompressionStream: TDeCompressionStream;
Buf:
array[0..4095]
of Byte;
Count: Integer;
begin
InputStream:=TFileStream.Create(InputFileName, fmOpenRead);
try
OutputStream:=TFileStream.Create(OutputFileName, fmCreate); <---------------hier taucht das Problem auf
try
DecompressionStream := TDecompressionStream.Create(InputStream);
try
while true
do
begin
Count := DecompressionStream.
Read(Buf[0], SizeOf(Buf));
if Count = 0
then
break
else
OutputStream.
Write(Buf[0], Count);
end;
finally
DecompressionStream.Free;
end;
finally
OutputStream.Free;
end;
finally
InputStream.Free;
end;
end;
Begin
dir:=ExtractFileDir(Application.ExeName) ;
if fileexists(dir+'
\update.zip')
then
Begin
ShowMessage(dir+'
\update.zip');
Decompress(dir+'
\update.zip',dir+'
\');
try
Ini:=TIniFile.Create(ExtractFileDir(Application.ExeName)+'
\BOINC-OBSERVER.ini');
Ini.WriteString('
BOINC-Observer','
version',Ini.ReadString('
update','
to version',version));
except
Ini.Free
End;
deletefile(dir+'
\update.zip');
dir:=dir+'
\BOINC_Observer.exe' ;
ShellExecute(Application.Handle, '
open', PChar(dir),
nil,
nil, SW_SHOW);
End;
End;
end.