Hi Sly,
this is the Decryption method:
Code:
function MyDecrypt(s: TStream): TStream;
var arrbyte: array of byte;
i, size: Integer;
r: byte;
Key: Word;
begin
size := s.Size; SetLength(arrbyte, size);
s.Position := 0; s.Read(arrbyte[0], SizeOf(arrbyte[0]) * size);
Key := password;
for i := 0 to High(arrbyte) do // for every byte in the stream
begin
r := arrbyte[i];
arrbyte[i] := arrbyte[i] xor (Key shr 8);
Key := (r + Key) * C1 + C2;
end;
s.Position := 0; s.Write(arrbyte[0], SizeOf(arrbyte[0]) * size);
result := s;
end;
I load an Imagelist like this:
ImageListEditor.ImageList.DecodeFunction := MyDecrypt;
imagelisteditor.ImageList.LoadFromFile('grafix\ima gelisteditor.oil');
Imagelisteditor.init;
Does this help?
Firle
Bookmarks