unit UnStorychoose;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ULZMABench,ULZMAEncoder,ULZMADecoder,UBufferedFS,ULZMACommon;
type
{ TfmStorychoose }
TfmStorychoose = class(TForm)
Button1: TButton;
dlSpielwahl: TOpenDialog;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
fmStorychoose: TfmStorychoose;
implementation
{$R *.lfm}
{ TfmStorychoose }
procedure TfmStorychoose.Button1Click(Sender: TObject);
var
encoder: TLZMAEncoder;
inStream:TBufferedFS;
outStream:TBufferedFS;
filesize:int64;
i: Integer;
begin
inStream:=TBufferedFS.Create(dlSpielwahl.FileName,fmOpenRead or fmsharedenynone);
outStream:=TBufferedFS.Create('C:\test.7z',fmcreate);
encoder:=TLZMAEncoder.Create;
encoder.SetEndMarkerMode(false);
encoder.WriteCoderProperties(outStream);
fileSize := inStream.Size;
for i := 0 to 7 do
WriteByte(outStream,(fileSize shr (8 * i)) and $FF);
encoder.Code(inStream, outStream, -1, -1);
encoder.free;
outStream.Free;
inStream.Free;
end;
end.