1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-24 02:02:17 -05:00

Oh and here the needed components

This commit is contained in:
Raymond 2010-12-26 14:52:20 +01:00
parent 5e737bbdb9
commit 418fcba1c2
2 changed files with 66 additions and 12 deletions

View File

@ -1,5 +1,5 @@
function ps_haval(Data: string): string;
function ps_haval(Data: string): string; extdecl;
var
HASH: TDCP_haval;
Digest: array[0..31] of byte;
@ -19,7 +19,7 @@ begin
end;
end;
function ps_md4(Data: string): string;
function ps_md4(Data: string): string; extdecl;
var
HASH: TDCP_md4;
Digest: array[0..15] of byte;
@ -39,7 +39,7 @@ begin
end;
end;
function ps_md5(Data: string): string;
function ps_md5(Data: string): string; extdecl;
var
HASH: TDCP_md5;
Digest: array[0..15] of byte;
@ -59,7 +59,7 @@ begin
end;
end;
function ps_ripemd128(Data: string): string;
function ps_ripemd128(Data: string): string; extdecl;
var
HASH: TDCP_ripemd128;
Digest: array[0..15] of byte;
@ -79,7 +79,7 @@ begin
end;
end;
function ps_ripemd160(Data: string): string;
function ps_ripemd160(Data: string): string; extdecl;
var
HASH: TDCP_ripemd160;
Digest: array[0..19] of byte;
@ -99,7 +99,7 @@ begin
end;
end;
function ps_sha1(Data: string): string;
function ps_sha1(Data: string): string; extdecl;
var
HASH: TDCP_sha1;
Digest: array[0..19] of byte;
@ -119,7 +119,7 @@ begin
end;
end;
function ps_sha256(Data: string): string;
function ps_sha256(Data: string): string; extdecl;
var
HASH: TDCP_sha256;
Digest: array[0..31] of byte;
@ -139,7 +139,7 @@ begin
end;
end;
function ps_sha384(Data: string): string;
function ps_sha384(Data: string): string; extdecl;
var
HASH: TDCP_sha384;
Digest: array[0..47] of byte;
@ -159,7 +159,7 @@ begin
end;
end;
function ps_sha512(Data: string): string;
function ps_sha512(Data: string): string; extdecl;
var
HASH: TDCP_sha512;
Digest: array[0..63] of byte;
@ -179,7 +179,7 @@ begin
end;
end;
function ps_tiger(Data: string): string;
function ps_tiger(Data: string): string; extdecl;
var
HASH: TDCP_tiger;
Digest: array[0..23] of byte;
@ -198,4 +198,3 @@ begin
Hash.Free;
end;
end;

View File

@ -51,10 +51,25 @@ type
property Finished : boolean read FFinished;
end;
{ TDownloadDecompressThread }
TDownloadDecompressThread = class(TThread)
private
InputURL : string;
Folder : string;
FData : string;
FOverWrite : boolean;
public
Done : boolean;
Succeeded : boolean;
property Rawdata : string read FData;
constructor Create(const URL, OutputDir : string; const Overwrite : boolean);
procedure execute; override;
end;
implementation
uses
FileUtil;
FileUtil, internets;
function DecompressBZip2(const input: TStream; const BlockSize: Cardinal): TMemoryStream;
var
@ -148,6 +163,46 @@ begin;
Result := Succ;
end;
{ TDownloadDecompressThread }
constructor TDownloadDecompressThread.Create(const URL, OutputDir: string; const Overwrite : boolean);
begin
inherited Create(true);
FreeOnTerminate := False;
InputURL:= URL;
Folder:= OutputDir;
Done := false;
FData := '';
Succeeded:= false;
FOverWrite:= Overwrite;
end;
procedure TDownloadDecompressThread.execute;
var
SStream : TStringStream;
DecompressData : TMemoryStream;
begin
Succeeded:= False;
try
if ((InputURL = '') or (Folder = '')) then
Exit;
FData := Getpage(InputURL);
if FData = '' then
Exit; //Goes to finally
SStream := TStringStream.Create(FData);
DecompressData := DecompressBZip2(SStream);
if DecompressData = nil then
Exit; //Goes to finally
if not Untar(DecompressData,Folder,FOverwrite) then
Exit;
DecompressData.Free;
SStream.free;
Succeeded:= True;
finally
Done := true;
end;
end;
constructor TProcThread.Create;
begin
inherited Create(true);