Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ListviewConstants.au3>
#Include <GuiListView.au3>
#include <BuildInZIP.au3>
#include <File.au3>
#include <Array.au3>
$Path = @AppDataDir & "\.minecraft\saves\"
$saves = _FileListToArray($Path)
$Scriptpath = @AppDataDir & "\.minecraft Backups\"
Global $listviewitems, $i, $e, $e_, $backup, $Backupfrage, $Backupfrage_, $Backupfrage__, $groese
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Backup Manager", 495, 433)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$ListView1 = GUICtrlCreateListView("Saves | Größe | Letztes Backup", 16, 16, 295, 409, $LVS_SINGLESEL)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 90)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50)
$Button1 = GUICtrlCreateButton("Backup erstellen", 325, 24, 153, 33, $WS_GROUP)
GUICtrlSetOnEvent(-1, "Backup")
$Button2 = GUICtrlCreateButton("Backup laden", 325, 64, 153, 33, $WS_GROUP)
GUICtrlSetOnEvent(-1, "Backupladen")
GUISetState(@SW_SHOW)
While 1
Dim $listviewitems[UBound($saves)]
For $i = 1 To UBound($saves) - 1
$backup = IniRead($Scriptpath & "data.ini", "Saves", $saves[$i], "Kein Backup vorhanden")
$groese = Round(DirGetSize($Path & $saves[$i] & "\") / 1024 / 1024, 2) & " MB"
$listviewitems[$i] = GUICtrlCreateListViewItem($saves[$i] & "|" & $groese & "|" & $backup, $ListView1)
Next
Sleep(10000)
_GUICtrlListView_DeleteAllItems($ListView1)
WEnd
Func Backup()
$e = 0
$e_ = 0
$saveausgabe = GUICtrlRead($ListView1) - 5
If $saveausgabe = -5 Then
MsgBox(16, "Fehler","Sie haben keine Welt ausgewählt!")
Else
Do
$e = $e + 1
If $e = $saveausgabe Then
$saveausgabe_ = $Path & $saves[$e] & "\"
$e_ = 1
Endif
Until $e_ = 1
$Backupfrage = MsgBox(4, "Backup erstellen", "Möchten sie wirklich von " & $saves[$e] & " ein Backup erstellen?")
If $Backupfrage = 6 Then
If FileExists($Scriptpath & $saves[$e] & ".zip") Then
$Backupfrage_ = MsgBox(4, "Backup erstellen", "Es gibt bereits ein Backup unter diesem Namen" & @CRLF & "Möchten sie es überschreiben?")
If $Backupfrage_ = 6 Then
_BuildInZIP($Scriptpath & $saves[$e] & ".zip", $saveausgabe_, False, 1)
TrayTip("Backup Manager", "Backup von " & $saves[$e] & " wurde erstellt!", 10)
Iniwrite($Scriptpath & "data.ini", "Saves", $saves[$e], @HOUR & ":" & @MIN & ":" & @SEC & " " & @MDAY & "." & @MON & "." & @YEAR)
Sleep (5000)
Endif
Else
_BuildInZIP($Scriptpath & $saves[$e] & ".zip", $saveausgabe_, False, 1)
Iniwrite($Scriptpath & "data.ini", "Saves", $saves[$e], @HOUR & ":" & @MIN & ":" & @SEC & " " & @MDAY & "." & @MON & "." & @YEAR)
TrayTip("Backup Manager", "Backup von " & $saves[$e] & " wurde erstellt!", 10)
Sleep (5000)
EndIf
EndIf
EndIf
EndFunc
Func Backupladen ()
$e = 0
$e_ = 0
$saveausgabe = GUICtrlRead($ListView1) - 5
If $saveausgabe = -5 Then
MsgBox(16,"Fehler","Sie haben keine Welt ausgewählt!")
Else
Do
$e = $e + 1
If $e = $saveausgabe Then
$saveausgabe_ = $Path & $saves[$e] & "\"
$e_ = 1
Endif
Until $e_ = 1
If NOT FileExists($Scriptpath & $saves[$e] & ".zip") Then
MsgBox(16, "Fehler","Es existiert kein Backup zu dieser Welt!")
Else
$Backupfrage__ = MsgBox(4, "Backup laden", "Möchten sie wirklich von " & $saves[$e] & " ein Backup laden und somit die alte Welt überschreiben?")
If $Backupfrage__ = 6 Then
DirRemove($Path & $saves[$e], 1)
_BuildInZIP($Scriptpath & $saves[$e] & ".zip", $Path, True, 1)
TrayTip("Backup Manager", "Backup von " & $saves[$e] & " wurde geladen!", 10)
Endif
Endif
EndIf
EndFunc
Func _Exit()
Exit
EndFunc