Problem bei _FTP_ProgressDownload

  • Hi, ich hab ein Programm erstellt, was mir minecraft Up- und Downgraded... das Problem dabei liegt bei einem _FTP_ProgressDownload und ich weiss nich was da falsch ist =(. Hab die Stelle markiert

    Spoiler anzeigen
    [autoit]

    #RequireAdmin

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <FTPEx.au3>
    #include <File.au3>
    #include <Array.au3>
    #include <ArrayMore.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $Percent, $Combo, $CheckboxRepair, $Open, $Connect, $Versions, $Version, $State, $FileSize, $FileList, $FileCounter
    $Percent = 0

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(0, "Minecraft Downgrader by xXKingLoLXx", "WICHTIG!" &@CRLF &"Minecraft muss geschlossen sein, bevor Sie ein Up- und Downgrade ausführen!")

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=C:\Users\Louis\Desktop\Eigene Programme\Minecraft-Downgrader.kxf
    $Main = GUICreate("Minecraft Downgrader by xXKingLoLXx", 498, 377, 292, 138)
    $Screenshot = GUICtrlCreatePic("", 8, 8, 480, 255, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Progress = GUICtrlCreateProgress(8, 272, 481, 25)
    $Homepage = GUICtrlCreateLabel("http://www.island-minecraft.de.tl/", 8, 356, 163, 17)
    GUICtrlSetColor(-1, 0x0000FF)
    $Copyright = GUICtrlCreateLabel("Copyright (c) by Island-Minecraft", 336, 356, 155, 17)
    $State = GUICtrlCreateLabel("Verbinde mit Download-Server...", 8, 308, 400)
    $Combo = GUICtrlCreateCombo("Version wählen...", 8, 328, 105, 25)
    $Start = GUICtrlCreateButton("Start", 384, 328, 105, 25, 0)
    $CheckboxRepair = GUICtrlCreateCheckbox("Minecraft Reparieren", 120, 328, 121, 21)
    GUICtrlSetState($Start, $GUI_DISABLE)
    GUICtrlSetState($Combo, $GUI_DISABLE)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    $Open = _FTP_Open("Island-Minecraft")
    $Connect = _FTP_Connect($Open, "*******", "*******", "*******")

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetData($State, "0% - Downloade Top-Screenshot...")
    _FTP_ProgressDownload($Connect, @TempDir &"\Screenshot.bmp", "Screenshot.bmp", "_Screenshot")
    GUICtrlSetImage($Screenshot, @TempDir &"\Screenshot.bmp")

    [/autoit] [autoit][/autoit] [autoit]

    _FTP_DirSetCurrent($Connect,"/minecraft/")
    GUICtrlSetData($State, "Prüfe verfügbare Versionen...")
    $Versions = _Ftp_ListToArray($Connect, 2)
    $ComboList = _ArrayToString($Versions, "|", 1)
    $ComboList = StringReplace($ComboList, "minecraft-", "")
    $ComboList = StringReplace($ComboList, ".jar", "")
    GUICtrlSetData($Combo, $ComboList)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetData($State, "Fertig...")
    GUICtrlSetState($Start, $GUI_ENABLE)
    GUICtrlSetState($Combo, $GUI_ENABLE)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $Homepage
    ShellExecute("http://www.island-minecraft.de.tl/")

    Case $Start
    GUICtrlSetState($Start, $GUI_DISABLE)
    GUICtrlSetState($Combo, $GUI_DISABLE)
    $Version = GUICtrlRead($Combo)
    If $Version <> "Version wählen..." Then
    If GUICtrlRead($CheckboxRepair) = $GUI_CHECKED Then
    GUICtrlSetData($State, "Erstelle Filelist...")

    _FTP_DirSetCurrent($Connect,"/bin/")
    $FileList = _Ftp_ListToArray($Connect, 2)
    $FileSize = 0
    For $i = 1 to $FileList[0]
    $FileSize = $FileSize + _FTP_FileGetSize($Connect, "/bin/" &$FileList[$i])
    $FileList[$i] = "bin/" &$FileList[$i]
    Next
    _FTP_DirSetCurrent($Connect, "/bin/natives/")
    $FileListRec = _Ftp_ListToArray($Connect, 2)
    For $i = 1 to $FileListRec[0]
    $FileSize = $FileSize + _FTP_FileGetSize($Connect, "/bin/natives/" &$FileListRec[$i])
    $FileListRec[$i] = "bin/natives/" &$FileListRec[$i]
    Next
    _ArrayConcatenate($FileList, $FileListRec, 1)
    $FileList[0] = $FileList[0] + $FileListRec[0]

    _FTP_DirSetCurrent($Connect, "/")
    GUICtrlSetData($State, "0% - Downloade Datei 1 von " &$FileList[0])
    For $i = 1 To $FileList[0]
    $FileCounter = $i
    _FTP_ProgressDownload($Connect, @AppDataDir &"\.minecraft" &$FileList[$i], $FileList[$i], "_MinecraftRepair") ;Hier muss der Fehler sein!
    Next

    GUICtrlSetData($State, "0% - Downloade Minecraft Version " &$Version)
    _FTP_ProgressDownload($Connect, @AppDataDir &"\.minecraft\bin\minecraft.jar", "minecraft-" &$Version &".jar", "_MinecraftVersion")
    GUICtrlSetData($State, "Fertig...")
    MsgBox(0, "Minecraft Downgrader by xXKingLoLXx", "Minecraft wurde repariert und die gewünschte Version wurde erfolgreich installiert.")
    Else
    GUICtrlSetData($State, "0% - Downloade Minecraft Version " &$Version)
    _FTP_ProgressDownload($Connect, @AppDataDir &"\.minecraft\bin\minecraft.jar", "minecraft-" &$Version &".jar", "_MinecraftVersion")
    GUICtrlSetData($State, "Fertig...")
    MsgBox(0, "Minecraft Downgrader by xXKingLoLXx", "Ihre gewünschte Minecraft Version wurde erfolgreich installiert.")
    EndIf
    Else
    MsgBox(0, "Minecraft Downgrader by xXKingLoLXx", "Bitte wählen Sie eine Minecraft Version.")
    EndIf
    GUICtrlSetState($Start, $GUI_ENABLE)
    GUICtrlSetState($Combo, $GUI_ENABLE)
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Screenshot($Percent)
    GUICtrlSetData($State, $Percent &"% - Downloade Top-Screenshot...")
    GUICtrlSetData($Progress, $Percent)
    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _MinecraftVersion($Percent)
    GUICtrlSetData($State, $Percent &"% - Downloade Minecraft Version " &$Version)
    GUICtrlSetData($Progress, $Percent)
    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _MinecraftRepair($Percent)
    $CurrencSize = ($Percent / 100) * _FTP_FileGetSize($Connect, $FileList[$FileCounter])
    $Percent = $CurrencSize / ($FileSize / 100)
    GUICtrlSetData($Progress, $Percent)
    GUICtrlSetData($State, $Percent &"% - Downloade Datei " &$FileCounter " von " &$FileList[0])
    Return 1
    EndFunc

    [/autoit]

    EDIT: Bei mir kommt keine Fehlermeldung oder ein Error! Direkt nach ausführen des markierten downloads schließt sich das Programm "normal", also ohne error code und @error konnte ich deshalb ja auch nich rausfinden...

    Einmal editiert, zuletzt von KingLoL (15. September 2011 um 22:01)

  • Hallo KingLoL,

    kann es ja nicht testen, aber vermutlich fehlt der Backslash hinter .minecraft im lokalen Pfad. Des weiteren solltest du die Session beim Programende ordnungsgemäss schliessen:

    [autoit]

    _FTP_Close($Open)

    [/autoit]

    Edit: dass keine Fehlermedlungen kommen liegt daran das du keine abfragst, sieh dir das Example1 in der Hulfe dazu an,

    mfg autoBert

    Einmal editiert, zuletzt von autoBert (14. September 2011 um 23:18)

  • nee.. das mim backslash muss, weil im Array alle Datein so anfangen: /bin/ ... omg thx für den gedanken im FTP sind die shlashes ja andersrum :DD denke das löst mein problem

    EDIT: geht immer noch nicht, mein neuer code:

    [autoit]

    _FTP_ProgressDownload($Connect, @AppDataDir &"\.minecraft\" &StringReplace($FileList[$i], "/", "\"), $FileList[$i], "_MinecraftRepair")

    [/autoit]
  • habe gemerkt, dass alles super läuft, wenn ich meine funktion nicht aufrufe. Egal welche er aufrufen soll, es klappt einfach nicht.

    EDIT: Ich habe den befehl _FTP_ProgressDownload kopiert und nach meinen wünschen umgestaltet... provisorisch, aber es klappt jetzt

    Einmal editiert, zuletzt von KingLoL (15. September 2011 um 22:00)