rc
This commit is contained in:
parent
ead8721f4f
commit
0252b1b3e7
BIN
Utils/rc/header_part1
Normal file
BIN
Utils/rc/header_part1
Normal file
Binary file not shown.
BIN
Utils/rc/header_part2
Normal file
BIN
Utils/rc/header_part2
Normal file
Binary file not shown.
57
Utils/rc/rc.pas
Normal file
57
Utils/rc/rc.pas
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
{$resource header_part1}
|
||||||
|
{$resource header_part2}
|
||||||
|
{$resource res_end}
|
||||||
|
|
||||||
|
{$reference System.Drawing.dll}
|
||||||
|
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
var icon_str := System.IO.File.OpenRead(CommandLineArgs[0]);
|
||||||
|
var icon := new System.Drawing.Icon(icon_str);
|
||||||
|
icon_str.Position := 0;
|
||||||
|
if icon.Width <> icon.Height then Halt(1);
|
||||||
|
case icon.Width of
|
||||||
|
1,2,4,8,16,32: ;
|
||||||
|
else Halt(2);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var v: word := icon_str.Length-22;
|
||||||
|
var otp := System.Console.OpenStandardOutput;
|
||||||
|
//var otp := System.IO.File.Create('test.res');
|
||||||
|
var bw := new System.IO.BinaryWriter(otp);
|
||||||
|
|
||||||
|
GetResourceStream('header_part1').CopyTo(otp);
|
||||||
|
bw.Write(v);
|
||||||
|
GetResourceStream('header_part2').CopyTo(otp);
|
||||||
|
|
||||||
|
var br := new System.IO.BinaryReader(System.IO.File.OpenRead(CommandLineArgs[0]));
|
||||||
|
br.BaseStream.Position := 19;
|
||||||
|
bw.Write(br.ReadBytes(br.BaseStream.Length-19));
|
||||||
|
|
||||||
|
GetResourceStream('res_end').CopyTo(otp);
|
||||||
|
bw.Write(byte(icon.Width));
|
||||||
|
bw.Write(byte(icon.Width));
|
||||||
|
bw.Write(byte($10));
|
||||||
|
if icon.Width = 1 then
|
||||||
|
bw.Write(byte($FF)) else
|
||||||
|
bw.Write(byte($01));
|
||||||
|
bw.Write(byte($01));
|
||||||
|
bw.Write(byte($00));
|
||||||
|
bw.Write(byte($04));
|
||||||
|
bw.Write(byte($00));
|
||||||
|
bw.Write(v);
|
||||||
|
bw.Write(byte($00));
|
||||||
|
bw.Write(byte($00));
|
||||||
|
bw.Write(byte($01));
|
||||||
|
bw.Write(byte($00));
|
||||||
|
bw.Flush;
|
||||||
|
|
||||||
|
except
|
||||||
|
on e: Exception do
|
||||||
|
begin
|
||||||
|
//WriteAllText('RC error log.txt', _ObjectToString(e));
|
||||||
|
//Exec('RC error log.txt');
|
||||||
|
Halt(e.HResult);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end.
|
||||||
BIN
Utils/rc/res_end
Normal file
BIN
Utils/rc/res_end
Normal file
Binary file not shown.
BIN
bin/rc.exe
Normal file
BIN
bin/rc.exe
Normal file
Binary file not shown.
Loading…
Reference in a new issue