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
|
procedure t_graphisme.remplir(cat: t_cat; chem: string);
var
bmp: TBitmap;
bmps: T4Bitmap;
Zipper: TAbUnZipper;
item: TAbArchiveItem;
MS: TMemoryStream;
iz, i, cc, ref: integer;
Bitmap: TBitmap;
lst: T4Listes;
nomzip, s, ns: string;
begin
lst := getListe(cat);
for iz := 1 to 4 do
begin
nomzip := chem + Format('Z%d.zip', [iz]);
if fileexists(nomzip) then
begin
Zipper := TAbUnZipper.Create(nil);
try
Zipper.FileName := chem + Format('Z%d.zip', [iz]);
for i := 0 to Zipper.Count - 1 do
begin
MS := TMemoryStream.Create;
item := Zipper.items[i];
try
Zipper.ExtractToStream(item.FileName, MS);
s := item.FileName;
ns := '';
for cc := 1 to length(s) do
begin
if (s[cc] >= '0') and (s[cc] <= '9') then
ns := ns + s[cc];
end;
ref := ns.ToInteger;
bmp := TBitmap.CreateFromStream(MS);
if not(lst.TryGetValue(ref, bmps)) then
begin
bmps := T4Bitmap.Create;
lst.Add(ref, bmps);
end;
bmps.bmp[iz] := bmp;
finally
MS.free;
end;
end;
finally
Zipper.Free;
end;
end;
end;
end; |
Partager