Hallo DaisukeHideki,
hier einmal die geänderte Version:
Spoiler anzeigen
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Icon.ico
#AutoIt3Wrapper_Outfile=Launcher_New.exe
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Region
#EndRegion
; ================================;
; Minecraft Launcher
; Made by Aldeos
; © 2011 Aldeos.de
; ================================;
;====Includes====;
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3> ;<================ zu Debugwecken nütlich
If Not FileExists(@AppDataDir & "\.minecraft\Splash.jpg") Then FileInstall("Splash.jpg", @AppDataDir & "\.minecraft\Splash.jpg") ;- Fragt ab, ob Splash.bmp existiert, falls nicht installiert er diese Datei.
If Not FileExists(@AppDataDir & "\.minecraft\Minecraft.exe") Then FileInstall("Minecraft.exe", @AppDataDir & "\.minecraft\Minecraft.exe") ;- Fragt ab, ob Minecraft.exe existiert, falls nicht installiert er diese Datei.
;<=========================
if not FileExists(@AppDataDir & "\.minecraft") Then DirCreate(@AppDataDir & "\.minecraft\")
Global $aFav
;<=========================
;====GUI====;
$GUI = GUICreate("Minecraft Launcher by Aldeos.de", 401, 251, 273, 176) ;- Erstellt die GUI.
$DATA = GUICtrlCreateMenu("Datei")
$EXIT = GUICtrlCreateMenuItem("Beenden", $DATA)
$SERVER = GUICtrlCreateMenu("Server")
$ADD = GUICtrlCreateMenuItem("Server hinzufügen", $SERVER)
$DELETE = GUICtrlCreateMenuItem("Server entfernen", $SERVER)
$NAME = GUICtrlCreateLabel("Login:", 104, 42, 33, 17) ;- Erstellt den Label "Login:".
$NAME_READ = IniRead(@AppDataDir & "\.minecraft\Launcher.ini", "Config", "NAME", "") ;- Liest aus der Launcher.ini die Wert NAME aus der Sektion Config.
$NAME_INPUT = GUICtrlCreateInput($NAME_READ, 160, 40, 121, 21) ;- Erstellt ein Eingabefeld für den Namen.
$PASSWORD = GUICtrlCreateLabel("Passwort:", 104, 70, 50, 17) ;- Erstellt den Label "Password:".
$PASS_READ = IniRead(@AppDataDir & "\.minecraft\Launcher.ini", "Config", "PASS", "");- Liest aus der Launcher.ini die Wert PASS aus der Sektion Config.
$PASSWORD_INPUT = GUICtrlCreateInput($PASS_READ, 160, 68, 121, 21, $ES_PASSWORD);- Erstellt ein Eingabefeld für das Password.
$IP = GUICtrlCreateLabel("IP:", 104, 98, 17, 17) ;- Erstellt den Label "IP:".
;<============ hier eine Zeile gelöscht und nächste angepasst
$IP_INPUT = GUICtrlCreateCombo("", 160, 96, 121, 25) ;-;- Erstellt ein Eingabefeld für die IP.
$START = GUICtrlCreateButton("Start", 194, 128, 89, 25, $WS_GROUP) ;- Erstellt einen Button mit der Aufschrift "Start" zum starten des Spieles.
$UPDATE = GUICtrlCreateButton("Update", 104, 128, 81, 25, $WS_GROUP) ;- Erstellt einen Button mit der Aufschrift "Update" zum überprüfen auf Updates.
$IMG = GUICtrlCreatePic(@AppDataDir & "\.minecraft\Splash.jpg", 0, 0, 400, 230, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
$DL_PROG = GUICtrlCreateProgress(16, 173, 369, 25)
$DL_LAB = GUICtrlCreateLabel("", 24, 204, 4, 4)
$UPDATE = GUICtrlCreateButton("Update", 104, 128, 81, 25, $WS_GROUP)
$VERSION = GUICtrlCreateLabel("V. 1.0", 352, 200, 32, 17)
GUISetState(@SW_SHOW)
_IniRead();<======================
;====Variable====;
$ServerINI = @TempDir & "\serverversion.ini"
$LocalINI = @AppDataDir & "\.minecraft\Version.ini"
$upd_url = IniRead($LocalINI, "File", "URL", "")
$sString = BinaryToString(InetRead('http://46.4.146.40/serverversion.ini'))
$hFile = FileOpen($ServerINI, 2)
FileWrite($hFile, $sString)
FileClose($hFile)
FileDelete($hFile)
$Ini1 = IniRead($ServerINI, "Update", "VERSION", "")
$Ini2 = IniRead($LocalINI, "Update", "VERSION", "")
$url = IniRead($ServerINI, "File", "URL", "")
$NAME = IniRead($ServerINI, "File", "NAME", "")
$size = InetGetSize($url & $NAME)
;====Funktionen====;
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $EXIT
Exit
Case $START
_startcheck()
Case $UPDATE
_updatecheck()
Case $ADD
_favadd()
_IniRead() ;<======================
Case $DELETE
_favdel()
_IniRead();<======================
EndSwitch
WEnd
Func _IniRead() ;<<================ ganze Func
$aFav = IniReadSection(@AppDataDir & "\.minecraft\Launcher.ini", "Favoriten")
;- Liest aus der Launcher.ini die Favoriten
if IsArray($aFav) Then
GUICtrlSetData($IP_INPUT,"","")
_ArrayDisplay($aFav,"Favoriten")
for $i = 1 to $aFav[0][0]
GUICtrlSetData($IP_INPUT,$aFav[$i][0])
Next
EndIf
EndFunc
Func _run()
If Not @error Then
$NAME = GUICtrlRead($NAME_INPUT)
$PASS = GUICtrlRead($PASSWORD_INPUT)
$IP = GUICtrlRead($IP_INPUT)
$PASS_READ = IniRead(@AppDataDir & "\.minecraft\Launcher.ini", "Config", "PASS", "")
ShellExecute(@AppDataDir & "\.minecraft\Minecraft.exe", $NAME & " " & $PASS_READ & " " & $IP) ;- Startet die Datei "Minecraft.exe" mit den folgenden Parametern, $NAME_READ, $PASS_READ und $IP_READ.
If Not @error Then
IniWriteSection(@AppDataDir & "\.minecraft\Launcher.ini", "Config", "NAME=" & GUICtrlRead($NAME_INPUT) & @LF & "PASS=" & GUICtrlRead($PASSWORD_INPUT) & @LF & "IP=" & GUICtrlRead($IP_INPUT)) ;- Schreit $NAME_INPUT, $PASSWORD_INPUT und $IP_INPUT in die INI.
Exit
EndIf
EndIf
EndFunc ;==>_run
Func _updatecheck()
If $Ini1 <> $Ini2 Then
$iMsgBoxAnswer = MsgBox(52, "Aktualisierung gefunden!", "Es wurde eine Aktualisierung gefunden." & @CRLF & "Möchten Sie diese herunterladen?")
Select
Case $iMsgBoxAnswer = 6
$download = InetGet($url & $NAME, $NAME, 1, 1)
Do
$info = InetGetInfo($download, 0)
$percent = (100 / $size) * $info
GUICtrlSetData($DL_PROG, $percent)
$Old = GUICtrlRead($DL_LAB)
$New = "Geladen:" & Round(($info / 1024) / 1024, 1) & " / " & Round(($size / 1024) / 1024, 1) & "MB"
If $Old <> $New Then GUICtrlSetData($DL_LAB, $New)
Until $percent >= 100
IniWrite($LocalINI, "Update", "VERSION", $Ini1)
_Update()
Exit
Case $iMsgBoxAnswer = 7
Exit
EndSelect
EndIf
EndFunc ;==>_updatecheck
Func _startcheck()
If $Ini1 <> $Ini2 Then
MsgBox(48, "Version nicht aktuell!", "Ihre Version ist nicht aktuell." & @CRLF & "Bitte aktualisieren sie ihren Launcher.")
ElseIf $Ini1 = $Ini2 Then
_run()
EndIf
EndFunc ;==>_startcheck
Func _Update($iDelay = 0)
Local $sCmdFile
FileDelete(@TempDir & "scratch.bat")
$sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _
& ':loop' & @CRLF _
& 'del "' & @ScriptFullPath & '" > nul' & @CRLF _
& 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _
& 'ren ' & @ScriptDir & '\Launcher_New.exe Launcher.exe' & @CRLF _
& 'start ' & @ScriptDir & '\Launcher.exe' & @CRLF _
& 'del ' & @TempDir & 'scratch.bat'
FileWrite(@TempDir & "scratch.bat", $sCmdFile)
Run(@TempDir & "scratch.bat", @TempDir, @SW_HIDE)
Exit
EndFunc ;==>_Update
Func _favadd()
$FAV_ADD = GUICreate("Hinzufügen", 201, 122, 192, 124)
$NAME = GUICtrlCreateInput("", 48, 24, 145, 21)
$IP = GUICtrlCreateInput("", 48, 56, 145, 21)
$LAB_NAME = GUICtrlCreateLabel("Name:", 8, 26, 35, 17)
$LAB_IP = GUICtrlCreateLabel("IP:", 24, 58, 17, 17)
$ADD_SERVER = GUICtrlCreateButton("Hinzufügen", 56, 88, 89, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $ADD_SERVER
IniWrite(@AppDataDir & "\.minecraft\Launcher.ini", "Favoriten", GUICtrlRead($NAME), GUICtrlRead($IP))
ExitLoop
EndSwitch
WEnd
GUIDelete($FAV_ADD)
EndFunc ;==>_favadd
Func _favdel()
$FAV_DEL = GUICreate("Entfernen", 194, 99, 192, 124)
$FAV_READ = IniReadSection(@AppDataDir & "\.minecraft\Launcher.ini", "Favoriten")
$SELECT = GUICtrlCreateCombo($FAV_READ, 16, 24, 161, 25)
$DELETE = GUICtrlCreateButton("Entfernen", 56, 56, 81, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($FAV_DEL)
Case $DELETE
IniDelete (@AppDataDir & "\.minecraft\Launcher.ini", "Favoriten", GUICtrlRead($SELECT))
EndSwitch
WEnd
EndFunc
wobei du die Änderungen (;<================) bei dir einpflegen solltest,
mfg autoBert