#NoTrayIcon
FileInstall("D:\Program Files\Resource Tuner\ZlibUIN.exe", @TempDir & "\ZlibUIN.exe")
Local $smessage = "请选择一个 Heaventools 语言包"
Local $sfileopendialog = FileOpenDialog($smessage, @ScriptDir & "", "语言包(langpack.dat)|所有文件(*.*)")
If @error Then Exit
$decompress = @TempDir & "\langpack.txt"
Run(@TempDir & "\ZlibUIN.exe", @TempDir, @SW_HIDE)
$title = "Zlib Tools"
WinWait($title)
WinActivate($title)
ControlSetText($title, "", "[CLASS:obj_EDIT; INSTANCE:1]", $sfileopendialog)
ControlSetText($title, "", "[CLASS:obj_EDIT; INSTANCE:2]", $decompress)
ControlClick($title, "", "[CLASS:obj_BUTTON; INSTANCE:3]")
Sleep(500)
ProcessClose("ZlibUIN.exe")
Local $number = _readbinary($decompress, 0, 4, True)
$h = 60 + 20 * ($number + 1) + 10
Local $hgui = GUICreate("Heaventools 语言包分析程序", 338, $h)
GUICtrlCreateLabel("语言包: ", 10, 10, 56, 20)
GUICtrlCreateLabel(_abbreviation($decompress, 46), 58, 10, 380, 20)
GUICtrlCreateLabel("序列 偏移 语言 代码 长度", 10, 50, 312, 20)
Local $x = 70, $y = 1, $z
For $i = 4 To 4 + ($number - 1) * 16 Step 16
$j = _readbinary($decompress, $i, 16, False)
$j = StringTrimLeft($j, 2)
$offset = Number(Binary("0x" & StringMid($j, 1, 8)))
$langlen = Number(Binary("0x" & StringMid($j, 9, 8)))
$langtxt = _decode(_readbinary($decompress, 4 + $number * 16 + $offset, $langlen, False), 2)
$langcode = Number(Binary("0x" & StringMid($j, 17, 8)))
$lang_lang = Number(Binary("0x" & StringMid($j, 25, 8)))
GUICtrlCreateLabel(StringFormat("%2i %7i %-19s", $y, $offset, $langtxt), 15, $x, 230, 20)
GUICtrlCreateLabel(StringFormat("%4i %6i", $langcode, $lang_lang), 255, $x, 72, 20)
$y += 1
$x += 20
$z = 4 + $number * 16 + $offset + $langlen + $lang_lang
Next
GUICtrlCreateLabel(StringFormat("%7i", $z), 45, $x, 100, 20)
GUISetState(@SW_SHOW, $hgui)
While 1
Switch GUIGetMsg()
Case -3
ExitLoop
EndSwitch
WEnd
GUIDelete($hgui)
Func _readbinary($file, $begin, $amount, $tf)
$ado_stream = ObjCreate("ADODB.Stream")
$ado_stream.type = 1
$ado_stream.open
$ado_stream.loadfromfile($file)
$ado_stream.position = $begin
$read = $ado_stream.read($amount)
$ado_stream.close
If $tf Then
Return Number($read)
Else
Return $read
EndIf
EndFunc
Func _abbreviation($text, $len)
If StringLen($text) > $len Then
Return StringLeft($text, ($len - 6) / 2) & "..." & StringRight($text, ($len - 6) / 2)
Else
Return $text
EndIf
EndFunc
Func _decode($expression, $flag)
Return BinaryToString(Binary($expression), $flag)
EndFunc