ajout de commentaires pour clarifier le code et amélioration de la gestion des serveurs POP

This commit is contained in:
jopazerty
2025-03-17 13:47:06 +01:00
parent d04e9bd615
commit a6a3f771ff

View File

@ -35,11 +35,13 @@ $color = "0x4A90E2"
$color2 = "0x4A90E2" $color2 = "0x4A90E2"
$colorbk = "0x1E1E2E" $colorbk = "0x1E1E2E"
; thunderbird doit être fermé pour lancer le script
if ProcessExists("thunderbird.exe") Then if ProcessExists("thunderbird.exe") Then
MsgBox(16, "MoveYourPOP", "Veuillez fermer Thunderbird avant de lancer le script.") MsgBox(16, "MoveYourPOP", "Veuillez fermer Thunderbird avant de lancer le script.")
Exit Exit
EndIf EndIf
;gui principal
$hGUI = GUICreate("MoveYourPOP", 800, 570) $hGUI = GUICreate("MoveYourPOP", 800, 570)
GUISetBkColor(0xf2f2f2) GUISetBkColor(0xf2f2f2)
@ -263,8 +265,11 @@ While 1
EndSwitch EndSwitch
WEnd WEnd
;~ Func _getAllServer($profileDirectory)
; teste si le prefs.js existe
; teste si un compte POP existe
; récupère les infos des serveurs POP
Func _getAllServer($profileDirectory) Func _getAllServer($profileDirectory)
GUICtrlDelete($listview) GUICtrlDelete($listview)
$listview = GUICtrlCreateListView("Username|Account|ID|ServerID|Dossier de stockage|smtpID|Size", 20, 220, 760, 250) $listview = GUICtrlCreateListView("Username|Account|ID|ServerID|Dossier de stockage|smtpID|Size", 20, 220, 760, 250)
GUICtrlSetData($go, "🚀 Exécuter") GUICtrlSetData($go, "🚀 Exécuter")
@ -275,7 +280,6 @@ Func _getAllServer($profileDirectory)
GUICtrlSetBkColor($labSave, 0xffffff) GUICtrlSetBkColor($labSave, 0xffffff)
GUICtrlSetColor($labSave, 0x000000) GUICtrlSetColor($labSave, 0x000000)
$jsFile = $proFileDirectory&"\prefs.js" $jsFile = $proFileDirectory&"\prefs.js"
if Not FileExists($jsFile) Then if Not FileExists($jsFile) Then
GUICtrlSetData($labProfile, "Pas de fichier prefs.js trouvé dans "&$profileDirectory) GUICtrlSetData($labProfile, "Pas de fichier prefs.js trouvé dans "&$profileDirectory)
@ -344,9 +348,9 @@ Func _getAllServer($profileDirectory)
if $count = 0 then GUICtrlSetState($go, $GUI_DISABLE) if $count = 0 then GUICtrlSetState($go, $GUI_DISABLE)
Redim $allServer[$count][7] Redim $allServer[$count][7]
;~ _ArrayDisplay($allServer) ;~ _ArrayDisplay($allServer)
GUICtrlDelete($listview) ;~ GUICtrlDelete($listview)
$listview = GUICtrlCreateListView("Username|Account|ID|ServerID|Dossier de stockage|smtpID|Adresse du POP", 20, 220, 760, 250) ;~ $listview = GUICtrlCreateListView("Username|Account|ID|ServerID|Dossier de stockage|smtpID|Adresse du POP", 20, 220, 760, 250)
GUICtrlSetFont(-1, 11, 500, Default, "Segoe UI") ;~ GUICtrlSetFont(-1, 11, 500, Default, "Segoe UI")
_GUICtrlListView_AddArray($listview, $allServer) _GUICtrlListView_AddArray($listview, $allServer)
;~ Redim $allServer[$count][6] ;~ Redim $allServer[$count][6]
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -1) ; $LVSCW_AUTOSIZE GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -1) ; $LVSCW_AUTOSIZE
@ -367,6 +371,7 @@ Func _getAllServer($profileDirectory)
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 7, -2) ; $LVSCW_AUTOSIZE_USEHEADER GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 7, -2) ; $LVSCW_AUTOSIZE_USEHEADER
EndFunc EndFunc
;fonction de sauvegarde
Func _backup($source, $destination) Func _backup($source, $destination)
$dateHeure = StringFormat("%02d_%02d_%04d_%02dh%02dm%02ds", @MDAY, @MON, @YEAR, @HOUR, @MIN, @SEC) $dateHeure = StringFormat("%02d_%02d_%04d_%02dh%02dm%02ds", @MDAY, @MON, @YEAR, @HOUR, @MIN, @SEC)
$name = StringSplit($source, "\") $name = StringSplit($source, "\")
@ -375,6 +380,7 @@ Func _backup($source, $destination)
Return $name Return $name
EndFunc EndFunc
;vérifie l'espace disque
func _checkSpace($profileDirectory, $dstSave) func _checkSpace($profileDirectory, $dstSave)
Local $free, $profileSize Local $free, $profileSize
$free = DriveSpaceFree($dstSave) $free = DriveSpaceFree($dstSave)
@ -384,6 +390,7 @@ func _checkSpace($profileDirectory, $dstSave)
EndIf EndIf
EndFunc EndFunc
;récupère les infos des serveurs POP
Func _getInfosAboutServer($prefsArray, $serverID) Func _getInfosAboutServer($prefsArray, $serverID)
Local $aArray[4] Local $aArray[4]
Local $accountID Local $accountID