PHP Code:
#include <File.au3>
#include <_ArrayNaturalSort.au3>
#include <Array.au3>
#include <Crypt.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### F
$Form1 = GUICreate("RoM Patcher", 300, 80, -1, -1)
GUISetOnEvent(-3, "_Exit")
$Dname = GUICtrlCreateLabel("", 10, 10, 280, 20)
DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0)
$Dprogress = GUICtrlCreateProgress(10, 35, 280, 20)
GUICtrlSetColor(-1, 0x22FF22)
GUICtrlSetBkColor(-1, 0xEEEEEE)
DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7)
$Dprozent = GUICtrlCreateLabel('0%', 138, 39, 50, 14, $SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Dstatus = GUICtrlCreateLabel("", 10, 60, 280, 20)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###
Dim $MD5
$instart = MsgBox(36, "RoM Patcher", "Patches nur herrunterladen? OHNE Installation?")
$MD5File = FileOpenDialog("MD5 Datei wählen", @DesktopDir, "Textdateien (*.txt)")
If @error Then Exit
If Not FileExists($MD5File) Then Exit
_FileReadToArray($MD5File, $MD5)
Dim $patchsort[UBound($MD5)][2]
For $i = 1 To $MD5[0]
$tmp = StringSplit($MD5[$i], " ")
If UBound($tmp) = 3 Then
$patchsort[$i][0] = $tmp[1]
$patchsort[$i][1] = $tmp[2]
EndIf
Next
_ArrayNaturalSort($patchsort, 0, 0, 0, 1)
If @OSVersion = "WIN_XP" Then
$Settingsdir = @UserProfileDir & "\Eigene Dateien\Runes of Magic"
Else
$Settingsdir = @UserProfileDir & "\Documents\Runes of Magic"
EndIf
If $instart = 7 Then
If FileExists($Settingsdir) = 0 Then
DirCreate($Settingsdir)
EndIf
If FileExists($Settingsdir & "\GameSettings.ini") Then
$verzeichniss = IniRead($Settingsdir & "\GameSettings.ini", "Install", "GamePath", "")
If $verzeichniss = "" Then
$verzeichniss = FileSelectFolder("Runes of Magic Installationsverzeichnis wählen", "")
If @error Then Exit
If Not FileExists($verzeichniss) Then Exit
IniWrite($Settingsdir & "\GameSettings.ini", "Install", "GamePath", $verzeichniss)
EndIf
Else
$verzeichniss = FileSelectFolder("Runes of Magic Installationsverzeichnis wählen", "")
If @error Then Exit
If Not FileExists($verzeichniss) Then Exit
IniWrite($Settingsdir & "\GameSettings.ini", "Install", "GamePath", $verzeichniss)
EndIf
If FileExists($verzeichniss & "\Client.exe.ini") Then
$Major = IniRead($verzeichniss & "\Client.exe.ini", "Version", "Major", "")
$Minor = IniRead($verzeichniss & "\Client.exe.ini", "Version", "Minor", "")
$BuildNum = IniRead($verzeichniss & "\Client.exe.ini", "Version", "BuildNum", "")
$Extend = IniRead($verzeichniss & "\Client.exe.ini", "Version", "Extend", "")
$Patchaktuell = $Major & "." & $Minor & "." & $BuildNum & "." & $Extend
Else
$Patchaktuell = InputBox("Aktuelle Version", "Was ist die aktuelle Version deines Clients?" & @CRLF & @CRLF & "z.B. 2.0.0.1796")
EndIf
Else
$Patchaktuell = InputBox("Ab welcher Version", "Ab welche Version sollen die Patches herruntergeladen werden?" & @CRLF & @CRLF & "z.B. 2.0.0.1796")
EndIf
$Patchaktuellindex = _ArraySearch($patchsort, "*patch_" & $Patchaktuell, 0, 0, 0, 1, 1, 1) - 1
While $Patchaktuellindex > 0
_ArrayDelete($patchsort, $Patchaktuellindex)
$Patchaktuellindex = $Patchaktuellindex - 1
WEnd
DirCreate(@ScriptDir & "\Patches")
For $i = 1 To UBound($patchsort) - 1
$dateiname = StringTrimLeft($patchsort[$i][1], 1)
GUICtrlSetData($Dname, $i & "/" & UBound($patchsort) - 1 & ": " & $dateiname)
Do
$z = 0
If FileExists(@ScriptDir & "\Patches\" & $dateiname) Then
GUISetState(@SW_SHOW)
GUICtrlSetData($Dstatus, "Patch gefunden")
Else
$Download = InetGet("http://frogster.vo.llnwd.net/o9/patch/en/" & $dateiname, @ScriptDir & "\Patches\" & $dateiname, 1, 1)
GUISetState(@SW_SHOW)
Do
$proprozent = Round((InetGetInfo($Download, 1) / 100), 2)
$prozentaktuell = Round((InetGetInfo($Download, 0) / $proprozent), 2)
$prozentaktuell = StringFormat("%.2f", $prozentaktuell)
GUICtrlSetData($Dprogress, $prozentaktuell)
GUICtrlSetData($Dprozent, $prozentaktuell & "%")
$MB = Round(((InetGetInfo($Download, 1) / 1024) / 1024), 1)
$MBdown = Round(((InetGetInfo($Download, 0) / 1024) / 1024), 1)
GUICtrlSetData($Dstatus, $MBdown & " MB" & " / " & $MB & " MB")
Sleep(250)
Until InetGetInfo($Download, 2)
EndIf
$Dhash = StringTrimLeft(_Crypt_HashFile(@ScriptDir & "\Patches\" & $dateiname, $CALG_MD5), 2)
If $Dhash <> $patchsort[$i][0] Then
FileDelete(@ScriptDir & "\Patches\" & $dateiname)
$z = 1
Else
If $instart = 7 Then
GUICtrlSetData($Dstatus, "Installiere Patch...")
Run(@ScriptDir & "\Patches\" & $dateiname)
WinWait("RomUpdate")
WinWaitClose("RomUpdate")
EndIf
EndIf
Until $z = 0
Next
If $instart = 7 Then
MsgBox(64, "RoM Patcher", "Patches wurden herruntergeladen und installiert.")
Else
MsgBox(64, "RoM Patcher", "Patches wurden herruntergeladen.")
Run("C:\WINDOWS\explorer.exe /root, " & @ScriptDir & "\Patches\")
EndIf
Func _Exit()
Exit
EndFunc ;==>_Exit