Advertisement
Guest User

Untitled

a guest
Feb 10th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 7.64 KB | None | 0 0
  1. Func _Setup()
  2.     #Region ### START Koda GUI section ### Form=
  3.     $Form_SelectProfil = GUICreate("Sélection du profil", 260, 70, Default, Default)
  4.     $Label_SelectProfil = GUICtrlCreateLabel("Veuillez sélectionner votre profil Automobilista", 18, 4, 217, 17)
  5.     $ComboBox_SelectProfil = GUICtrlCreateCombo("", 18, 24, 145, 25, $CBS_DROPDOWNLIST)
  6.     $ListProfil = _FileListToArray($AMSfolder & "\UserData\", "*", 2)
  7.     Local $sString = ""
  8.     For $vElement In $ListProfil
  9.         If FileExists($AMSfolder & "\UserData\" & $vElement & "\Controller.ini") Then
  10.             $sString = $sString & "|" & $vElement
  11.             GUICtrlSetData($ComboBox_SelectProfil, $sString)
  12.         EndIf
  13.     Next
  14.     If $sString = '' Then MsgBox(16, 'Erreur', 'Veuillez lancer votre jeu en administrateur pour avoir accès à votre profil')
  15.     $Button_SelectProfil = GUICtrlCreateButton("OK", 166, 23, 67, 23)
  16.     GUISetState(@SW_SHOW)
  17.     #EndRegion ### END Koda GUI section ###
  18.  
  19.     While 1
  20.         $nMsg = GUIGetMsg()
  21.         Switch $nMsg
  22.             Case $GUI_EVENT_CLOSE
  23.                 GUIDelete($Form_SelectProfil)
  24.                 ExitLoop
  25.             Case $Button_SelectProfil
  26.                 $ProfilAMS = GUICtrlRead($ComboBox_SelectProfil)
  27.                 GUIDelete($Form_SelectProfil)
  28.                 IniWrite($GOAPPS & '\GO.Apps.ini', 'Dir', 'Profil', $ProfilAMS)
  29.                 ExitLoop
  30.         EndSwitch
  31.     WEnd
  32. EndFunc   ;==>_Setup
  33.  
  34. Func _Setup2()
  35.     #Region ### START Koda GUI section ### Form=
  36.     $Form_Setup2 = GUICreate("Setup", 500, 150, Default, Default)
  37.     $TABSetup2 = GUICtrlCreateTab(0, 0, 330)
  38.     GUICtrlCreateTabItem("Upload")
  39.     $Label_ProfilSelect = GUICtrlCreateLabel("Profil sélectionné : " & $ProfilAMS, 175, 5)
  40.     Global $GUIList_OurCircuit = GUICtrlCreateList("", 18, 24, 145, 100)
  41.     Global $GUIList_OurCircuitSetup = GUICtrlCreateList("", 165, 24, 145, 100)
  42.     $Button_UploadSetup = GUICtrlCreateButton("Upload", 185, 123, 100, 25)
  43.     Global $ListCircuit = _FileListToArray($AMSfolder & "\UserData\" & $ProfilAMS & "\Settings\", "*", 2)
  44.     Local $sString = ""
  45.     For $vElement In $ListCircuit
  46.         If IsNumber($vElement) Then
  47.             GUICtrlSetData($GUIList_OurCircuit, "")
  48.         Else
  49.             $sString = $sString & "|" & $vElement
  50.             GUICtrlSetData($GUIList_OurCircuit, $sString)
  51.         EndIf
  52.     Next
  53.     GUICtrlCreateTabItem("Setup GO.Race")
  54.     Global $GUIList_UsProfil = GUICtrlCreateList("", 18, 24, 145, 100)
  55.     Global $GUIList_UsCircuit = GUICtrlCreateList("", 165, 24, 145, 100)
  56.     Global $GUIList_UsCircuitSetup = GUICtrlCreateList("", 312, 24, 145, 100)
  57.     $Button_DLSetup = GUICtrlCreateButton("Télécharger", 185, 123, 100, 25)
  58.     $Label_ProfilSelect = GUICtrlCreateLabel("Profil sélectionné : " & $ProfilAMS, 175, 5)
  59.     GUISetState(@SW_SHOW)
  60.     #EndRegion ### END Koda GUI section ###
  61.  
  62.     _FTP_DirSetCurrent($hConn, "/GO.Race/Setup/")
  63.     Global $ListProfil = _FTP_ListToArray($hConn, 0)
  64.     Local $sString = ""
  65.     For $vElement In $ListProfil
  66.         If IsNumber($vElement) Then
  67.             GUICtrlSetData($GUIList_UsProfil, "")
  68.         ElseIf $vElement = "." Then
  69.             GUICtrlSetData($GUIList_UsProfil, "")
  70.         ElseIf $vElement = ".." Then
  71.             GUICtrlSetData($GUIList_UsProfil, "")
  72.         Else
  73.             $sString = $sString & "|" & $vElement
  74.             GUICtrlSetData($GUIList_UsProfil, $sString)
  75.         EndIf
  76.     Next
  77.     If $sString = '' Then MsgBox(16, 'Erreur', 'Une erreur est survenue, veuillez relancer GO.Apps pour avoir accès aux setups en ligne.')
  78.  
  79.     Local $changes = ""
  80.     Local $changesProfil = ""
  81.     Local $changesCircuit = ""
  82.     While 1
  83.         $nMsg = GUIGetMsg()
  84.         Switch $nMsg
  85.             Case 0
  86.                 Local $_changes = GUICtrlRead($GUIList_OurCircuit)
  87.                 If $changes <> $_changes Then
  88.                     $changes = $_changes
  89.                     _Changes_OurCircuit()
  90.                 EndIf
  91.                 Local $_changesProfil = GUICtrlRead($GUIList_UsProfil)
  92.                 If $changesProfil <> $_changesProfil Then
  93.                     $changesProfil = $_changesProfil
  94.                     _Changes_UsProfil()
  95.                 EndIf
  96.                 Local $_changesCircuit = GUICtrlRead($GUIList_UsCircuit)
  97.                 If $changesCircuit <> $_changesCircuit Then
  98.                     $changesCircuit = $_changesCircuit
  99.                     _Changes_Us_Circuit()
  100.                 EndIf
  101.             Case $GUI_EVENT_CLOSE
  102.                 GUIDelete($Form_Setup2)
  103.                 ExitLoop
  104.             Case $Button_UploadSetup
  105.                 Local $Circuit = GUICtrlRead($GUIList_OurCircuit), $Setup = GUICtrlRead($GUIList_OurCircuitSetup)
  106.                 _FTP_FilePut($hConn, $AMSfolder & "\UserData\" & $ProfilAMS & "\Settings\" & $Circuit & "\" & $Setup, "/GO.Race/Setup/" & $ProfilAMS & "/" & $Circuit & "/" & $Setup)
  107.                 If @error Then
  108.                     _FTP_DirCreate($hConn, "/GO.Race/Setup/" & $ProfilAMS & "/" & $Circuit)
  109.                     If @error Then
  110.                         _FTP_DirCreate($hConn, "/GO.Race/Setup/" & $ProfilAMS)
  111.                         _FTP_DirCreate($hConn, "/GO.Race/Setup/" & $ProfilAMS & "/" & $Circuit)
  112.                         _FTP_FilePut($hConn, $AMSfolder & "\UserData\" & $ProfilAMS & "\Settings\" & $Circuit & "\" & $Setup, "/GO.Race/Setup/" & $ProfilAMS & "/" & $Circuit & "/" & $Setup)
  113.                     EndIf
  114.                     _FTP_FilePut($hConn, $AMSfolder & "\UserData\" & $ProfilAMS & "\Settings\" & $Circuit & "\" & $Setup, "/GO.Race/Setup/" & $ProfilAMS & "/" & $Circuit & "/" & $Setup)
  115.                 EndIf
  116.                 GUIDelete($Form_Setup2)
  117.                 ExitLoop
  118.             Case $Button_DLSetup
  119.                 Local $Profil = GUICtrlRead($GUIList_UsProfil), $Circuit = GUICtrlRead($GUIList_UsCircuit), $Setup = GUICtrlRead($GUIList_UsCircuitSetup)
  120.                 If $Setup = "" Then
  121.                     MsgBox(64, "Erreur", "Aucun setup sélectionné.")
  122.                 Else
  123.                     _FTP_FileGet($hConn, "/GO.Race/Setup/" & $Profil & "/" & $Circuit & "/" & $Setup, $AMSfolder & "\UserData\" & $ProfilAMS & "\Settings\" & $Circuit & "\" & $Profil & "_" & $Setup)
  124.                     If @error Then
  125.                         MsgBox(64, "Erreur", "Le téléchargement du Setup n'a pas pu être éffectué. Veuillez rééssayer.")
  126.                     Else
  127.                         MsgBox(64, "", "Téléchargement du setup '" & $Setup & "' de " & $Profil & " terminé." & @CRLF & _
  128.                                 "Il a été nommer : " & $Profil & "_" & $Setup)
  129.                     EndIf
  130.                 EndIf
  131.         EndSwitch
  132.     WEnd
  133. EndFunc   ;==>_Setup2
  134.  
  135. Func _Changes_OurCircuit()
  136.     $ListCircuitSetup = _FileListToArray($AMSfolder & "\UserData\" & $ProfilAMS & "\Settings\" & GUICtrlRead($GUIList_OurCircuit) & "\")
  137.     If @error Then
  138.         GUICtrlSetData($GUIList_OurCircuitSetup, "")
  139.     Else
  140.         Local $sString = ""
  141.         For $vElement In $ListCircuitSetup
  142.             If IsNumber($vElement) Then
  143.                 GUICtrlSetData($GUIList_OurCircuitSetup, "")
  144.             Else
  145.                 $sString = $sString & "|" & $vElement
  146.                 GUICtrlSetData($GUIList_OurCircuitSetup, $sString)
  147.             EndIf
  148.         Next
  149.     EndIf
  150. EndFunc   ;==>_Changes_OurCircuit
  151.  
  152. Func _Changes_UsProfil()
  153.     _FTP_DirSetCurrent($hConn, "/GO.Race/Setup/" & GUICtrlRead($GUIList_UsProfil) & "/")
  154.     $ListProfilCircuit = _FTP_ListToArray($hConn, 0)
  155.     Global $sString_UsProfil = ""
  156.     For $vElement In $ListProfilCircuit
  157.         If IsNumber($vElement) Then
  158.             GUICtrlSetData($GUIList_UsCircuit, "")
  159.         ElseIf $vElement = "." Then
  160.             GUICtrlSetData($GUIList_UsCircuit, "")
  161.         ElseIf $vElement = ".." Then
  162.             GUICtrlSetData($GUIList_UsCircuit, "")
  163.         Else
  164.             $sString_UsProfil = $sString_UsProfil & "|" & $vElement
  165.             GUICtrlSetData($GUIList_UsCircuit, $sString_UsProfil)
  166.         EndIf
  167.     Next
  168. EndFunc   ;==>_Changes_UsProfil
  169.  
  170. Func _Changes_Us_Circuit()
  171.     _FTP_DirSetCurrent($hConn, "/GO.Race/Setup/" & GUICtrlRead($GUIList_UsProfil) & "/" & GUICtrlRead($GUIList_UsCircuit) & "/")
  172.     If @error Then
  173.     Else
  174.         $ListProfilCircuitSetup = _FTP_ListToArray($hConn, 0)
  175.         Local $sString2 = ""
  176.         For $vElement In $ListProfilCircuitSetup
  177.             If IsNumber($vElement) Then
  178.                 GUICtrlSetData($GUIList_UsCircuitSetup, "")
  179.             ElseIf $vElement = "." Then
  180.                 GUICtrlSetData($GUIList_UsCircuitSetup, "")
  181.             ElseIf $vElement = ".." Then
  182.                 GUICtrlSetData($GUIList_UsCircuitSetup, "")
  183.             Else
  184.                 $sString2 = $sString2 & "|" & $vElement
  185.                 If $sString2 = $sString_UsProfil Then
  186.                     GUICtrlSetData($GUIList_UsCircuitSetup, "")
  187.                 Else
  188.                     GUICtrlSetData($GUIList_UsCircuitSetup, $sString2)
  189.                 EndIf
  190.             EndIf
  191.         Next
  192.     EndIf
  193. EndFunc   ;==>_Changes_Us_Circuit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement