- Joined
- Jul 15, 2004
- Messages
- 1,207
- Reaction score
- 689
And here goes another LOLCODE..
Did it for my own needs :glare:
Code:
unit Unit16;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm16 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form16: TForm16;
implementation
{$R *.dfm}
function Decrypt (var Buffer: TBytes): string;
const
XorKey: array [0 .. 15] of Byte = ($7C, $BD, $81, $9F, $3D, $93, $E2, $56, $2A, $73, $D2, $3E, $F2, $83, $95, $BF);
var
b: Byte;
e: Integer;
begin
e := 0;
for b in Buffer do
begin
Result := Result + Chr(b xor XorKey[e mod 16]);
inc(e, 1)
end;
end;
procedure TForm16.Button1Click(Sender: TObject);
const
MuError = 'C:\Program Files (x86)\WEBZEN\Mu\MuError.log';
var
Fs: TStream;
Buffer: TBytes;
begin
try
Fs := TFileStream.Create(MuError, fmOpenRead);
try
SetLength(Buffer, Fs.Size);
Fs.Read(Buffer[0], Length(Buffer));
finally
Fs.Free;
end;
Memo1.Lines.Add(Decrypt(Buffer));
except
On E: Exception do
Memo1.Lines.Add(Format('Failed to Open file with error: ',[E.Message]));
end;
end;
procedure TForm16.FormCreate(Sender: TObject);
begin
Memo1.Lines.Clear;
end;
end.
Did it for my own needs :glare: