Hallo,
Ich bin etwas neu und habe was im internet gefunden!
!ein Patcher!
:
Spoiler anzeigen
#NoTrayIcon
#RequireAdmin
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SendMessage.au3>
#include <StaticConstants.au3>
#include <String.au3>
#include <WindowsConstants.au3>
#include <GDIpProgress.au3>
TCPStartup ()
Global $pIcon = ".\patchskin", $buttons[7][3], $version = "1"
Global $titel = "Patcher" ; Titel des Patchers
Global $pName = "SelfPatcher.exe"; SelfPatcher Name
Global $pUrl = "hp" ; Hier kommt die Domain zum Patch Server z.B. http://www.google.de NICHT MEHR
Global $click = 0
If ProcessExists($pName) Then ProcessClose($pName)
If FileExists($pName) Then FileDelete($pName)
If TCPConnect (TCPNameToIP ($pUrl),80) = 0 Then
MsgBox(0, "Fehler", "Patch Server nicht erreichbar")
TCPShutdown ()
Exit
Else
TCPShutdown()
$pUrl &= "/ordner/" ; Link zum Pfad wo die ganzen Datein zum Patchen liegen die nach der Domain kommen. s.o.: Patcher.exe, Pack ordner etc.
EndIf
If InetRead($pUrl & "patcherver.ini") <> $version Then ; Hier kommt der Dateinname hin wo die aktuelle Version steht
$info = InetGet($pUrl & $pName,@ScriptDir & "\" & $pName)
While Not FileExists(@ScriptDir & "\" & $pName)
Sleep(100)
WEnd
Run($pName)
Exit
EndIf
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate($titel, 700, 400, Default, Default, $WS_POPUP)
$buttons[1][0] = GUICtrlCreatePic($pIcon & "\start0.jpg", 360, 44, 161, 51)
$buttons[1][1] = "start"
$buttons[2][0] = GUICtrlCreatePic($pIcon & "\beenden0.jpg", 525, 44, 161, 51)
$buttons[2][1] = "beenden"
$buttons[5][0] = GUICtrlCreatePic($pIcon & "\x0.jpg", 674, 4, 17, 17)
$buttons[5][1] = "x"
$buttons[6][0] = GUICtrlCreatePic($pIcon & "\_0.jpg", 656, 4, 17, 17)
$buttons[6][1] = "_"
Dim $cNews[4]
For $i = 0 To 3
$cNews[$i] = GUICtrlCreatePic($pIcon & "\pixel.jpg", 97, 43 + (($i) * 30), 176, 17, $BS_BITMAP)
Next
$Edit1 = GUICtrlCreateEdit("", 20, 250, 219, 124, BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_READONLY), $ES_READONLY)
GUICtrlSetColor(-1, 0xcccccc)
GUICtrlSetBkColor(-1, 0x151515)
$titel_leiste = GUICtrlCreatePic($pIcon & "\head.jpg", 0, 0, 700, 24, BitOR($SS_NOTIFY, $WS_CLIPSIBLINGS))
$Pic1 = GUICtrlCreatePic($pIcon & "\bg.jpg", 0, 0, 700, 400, BitOR($SS_NOTIFY, $WS_CLIPSIBLINGS))
;~ $titel_text = GUICtrlCreateLabel($titel, 13, 5, 500, 22)
;~ GUICtrlSetColor(-1, 0xFFFFFF)
;~ GUICtrlSetFont(-1, 10, 800, 0, "Arial")
;~ GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$read = BinaryToString(InetRead($pUrl & "data.xml"))
Global $data = _StringBetween($read, "<data>", "</data>")
If IsArray($data) Then
For $i = 0 To 3
$bild = _StringBetween($data[$i], '<bild="', '">')
$text = _StringBetween($data[$i], '<text="', '">')
$datum = _StringBetween($data[$i], '<datum="', '">')
$farbe = _StringBetween($data[$i], '<farbe="', '">')
GUICtrlCreatePic("icon\" & $bild[0] & ".jpg", 32, 44 + (($i) * 30), 52, 16)
GUICtrlCreateLabel($text[0], 97, 43 + (($i) * 30), 176, 17)
GUICtrlSetColor(-1, $farbe[0])
GUICtrlSetFont(-1, 10, 400, 0, "Candara")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateLabel($datum[0], 271, 44 + (($i) * 30), 58, 17)
GUICtrlSetFont(-1, 8, 800, 0, "Calibri")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Next
EndIf
;~ $Progress1 = GUICtrlCreateProgress (20, 186, 292, 14)
;~ $Progress2 = GUICtrlCreateProgress (20, 207, 292, 14)
$Progress1 = _ProgressCreate(20, 206, 292, 14)
_ProgressSetColors($Progress1, 0x09B8F8, 0x09B8F8, 0xFFFFFF, 0xFFFFFF); 0x0F8CB3, 0x0F8CB3)
_ProgressSetText($Progress1, " ")
$Progress2 = _ProgressCreate(20, 227, 292, 14)
_ProgressSetColors($Progress2, 0xefff12, 0xefff12, 0xFFFFFF, 0xFFFFFF); 0xc4d110, 0xc4d110)
_ProgressSetText($Progress2, " ")
$Label1 = GUICtrlCreateLabel("0%", 316, 207, 30, 14)
GUICtrlSetFont(-1,
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Label2 = GUICtrlCreateLabel("0%", 316, 228, 30, 14)
GUICtrlSetFont(-1,
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
_sleep(100)
WEnd
Func _GUI_hover()
Local $iMouse = GUIGetCursorInfo($Form1)
If Not @error Then
For $i = 0 To UBound($buttons) - 1
If $iMouse[4] = $buttons[$i][0] Then
If $iMouse[2] And $buttons[$i][2] <> 1 Then
GUICtrlSetImage($buttons[$i][0], $pIcon & "\" & $buttons[$i][1] & "2.jpg")
$buttons[$i][2] = 1
ElseIf Not $iMouse[2] And $buttons[$i][2] <> 2 Then
GUICtrlSetImage($buttons[$i][0], $pIcon & "\" & $buttons[$i][1] & "1.jpg")
$buttons[$i][2] = 2
EndIf
ElseIf $iMouse[4] <> $buttons[$i][0] And $buttons[$i][2] <> 0 Then
GUICtrlSetImage($buttons[$i][0], $pIcon & "\" & $buttons[$i][1] & "0.jpg")
$buttons[$i][2] = 0
EndIf
Next
EndIf
EndFunc ;==>_GUI_hover
Func _buttons()
$nMsg = GUIGetMsg()
Switch $nMsg
Case $buttons[1][0]
$click += 1
If $click = 1 Then
$inet = BinaryToString(InetRead($pUrl & "index.php")); Hier kommt der Name der config Datei rein für die Größe und der Datei
$iString = StringSplit($inet, "<br>", 1)
For $l = 1 To UBound($iString) - 1
If $iString[$l] <> "" Then
$iString2 = StringSplit($iString[$l], "=", 1)
;_ArrayDisplay ($iString)
If StringInStr($iString2[1], "/") Then
$eintragen = StringSplit($iString2[1], "/")
$eintragen = $eintragen[2]
Else
$eintragen = $iString2[1]
EndIf
If $eintragen <> "" Then
If $iString2[2] <> FileGetSize(@ScriptDir & "\" & $iString2[1]) Then
GUICtrlSetData($Edit1, $eintragen & " wird aktualisiert" & @CRLF & GUICtrlRead($Edit1))
If StringInStr($iString2[1], "/") Then
$iDir = StringSplit($iString2[1], "/")
If Not FileExists(@ScriptDir & "\" & $iDir[1]) Then DirCreate(@ScriptDir & "\" & $iDir[1])
EndIf
$iString2[1] = StringReplace($iString2[1], "/", "\")
;FileDelete (@ScriptDir & "\" & $iString[$i])
$iGet = InetGet($pUrl & $iString2[1], @ScriptDir & "\" & $iString2[1], 1, 1)
$prozent = ""
While InetGetInfo($iGet, 2) = False
$prozent = Round(InetGetInfo($iGet, 0) / InetGetInfo($iGet, 1) * 100, 1)
If GUICtrlRead($Label1) <> $prozent & "%" Then __ProgressSet($Progress1, $prozent, $Label1)
_sleep(100)
WEnd
__ProgressSet($Progress1, 100, $Label1)
GUICtrlSetData($Edit1, $eintragen & " ist fertig geladen." & @CRLF & GUICtrlRead($Edit1))
Else
GUICtrlSetData($Edit1, $eintragen & " ist aktuell." & @CRLF & GUICtrlRead($Edit1))
EndIf
;GUICtrlSetData($Progress2, Round($i / UBound($Config) * 100, 2))
$prozent2 = Round($l / (UBound($iString) - 1) * 100, 1)
If GUICtrlRead($Label2) <> $prozent2 & "%" Then __ProgressSet($Progress2, $prozent2, $Label2)
_buttons()
EndIf
EndIf
Next
GUICtrlSetData($Edit1, "Update wurde beendet." & @CRLF & GUICtrlRead($Edit1))
__ProgressSet($Progress2, 100, $Label2)
$click = 0
ElseIf $click = 3 Then
ShellExecute("http://www.google.dr") ; T
MsgBox(0, "", "Testing", 5)
EndIf
Case $GUI_EVENT_CLOSE
Exit
Case $buttons[2][0]
Exit
Case $buttons[5][0]
Exit
Case $buttons[6][0]
GUISetState(@SW_MINIMIZE, $Form1)
Case $titel_leiste
_SendMessage($Form1, $WM_SYSCOMMAND, 0xF012, 0)
EndSwitch
_GUI_hover()
EndFunc ;==>_buttons
Func __ProgressSet($Progress, $prozent, $label)
_ProgressSet($Progress, $prozent)
GUICtrlSetData($label, $prozent & "%")
EndFunc ;==>__ProgressSet
Func _sleep($zeit)
Local $timer = TimerInit()
_buttons()
Do
_buttons()
Until TimerDiff($timer) >= $zeit
EndFunc ;==>_sleep
Jetzt muss ich eine exe öffnen nachdem er Fertig gepatcht hat!
Hilfe
danke voraus! Sry wegen Rechtschreibfehler!