Advertisement
Guest User

Untitled

a guest
Mar 9th, 2017
1,057
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 6.47 KB | None | 0 0
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_Icon=data\umbrella.ico
  3. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  4. #cs ----------------------------------------------------------------------------
  5.  
  6.  AutoIt Version: 3.3.12.0
  7.  Author:         Neon
  8.  
  9.  
  10. #ce ----------------------------------------------------------------------------
  11.  
  12. #include <Array.au3>
  13. #include <String.au3>
  14. #include <File.au3>
  15.  
  16. #include <ButtonConstants.au3>
  17. #include <EditConstants.au3>
  18. #include <GUIConstantsEx.au3>
  19. #include <ProgressConstants.au3>
  20. #include <StaticConstants.au3>
  21. #include <WindowsConstants.au3>
  22.  
  23.  
  24.  
  25.  
  26. $found = True
  27. $running = False
  28. $ini_path = @ScriptDir & "\data\data.ini"
  29. Global $url, $server
  30.  
  31. $path_steam = IniRead($ini_path, "settings", "counterstrike", "Please select a folder!")
  32. $path_winrar = IniRead($ini_path, "settings", "winrar", "Please select a folder!")
  33.  
  34.  
  35. Opt("GUIOnEventMode", 1)
  36. $Form1 = GUICreate("Zombie Escape Mappack by Neon", 387, 303, 398, 52)
  37. GUISetFont(10, 400, 0, "Segoe UI")
  38. GUISetBkColor(0xFFFFFF)
  39. $Group1 = GUICtrlCreateGroup("Paths", 8, 8, 369, 89)
  40. $Input1 = GUICtrlCreateInput($path_steam, 16, 32, 241, 25)
  41. GUICtrlSetState(-1, $GUI_DISABLE)
  42. $Button1 = GUICtrlCreateButton("CS:S Path", 272, 32, 91, 25)
  43. $Input2 = GUICtrlCreateInput($path_winrar, 16, 64, 241, 25)
  44. GUICtrlSetState(-1, $GUI_DISABLE)
  45. $Button2 = GUICtrlCreateButton("WinRar Path", 272, 64, 91, 25)
  46. GUICtrlCreateGroup("", -99, -99, 1, 1)
  47. $Progress1 = GUICtrlCreateProgress(8, 256, 366, 17)
  48. $Label2 = GUICtrlCreateLabel("...", 8, 280, 500, 21)
  49. $Group2 = GUICtrlCreateGroup("Servers", 8, 104, 369, 145)
  50. $Button5 = GUICtrlCreateButton("Button5", 40, 136, 131, 41, $BS_BITMAP)
  51. GUICtrlSetImage(-1, @ScriptDir & "\data\GFLCLanRu.bmp", -1)
  52. $Button6 = GUICtrlCreateButton("Get Maps", 40, 200, 131, 41)
  53. GUICtrlSetFont(-1, 12, 800, 0, "Segoe UI")
  54. $Button3 = GUICtrlCreateButton("Button3", 208, 120, 139, 81, $BS_BITMAP)
  55. GUICtrlSetImage(-1, @ScriptDir & "\data\Unloze.bmp", -1)
  56. $Button4 = GUICtrlCreateButton("Get Maps", 208, 200, 139, 41)
  57. GUICtrlSetFont(-1, 12, 800, 0, "Segoe UI")
  58. GUICtrlCreateGroup("", -99, -99, 1, 1)
  59. GUISetState(@SW_SHOW)
  60.  
  61. GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
  62. GUICtrlSetOnEvent($Button1, "_Steam")
  63. GUICtrlSetOnEvent($Button2, "_WinRar")
  64. GUICtrlSetOnEvent($Button3, "_Unloze")
  65. GUICtrlSetOnEvent($Button5, "_GFL")
  66.  
  67. GUICtrlSetOnEvent($Button6, "_Main_GFL")
  68. GUICtrlSetOnEvent($Button4, "_Main_Unloze")
  69.  
  70. While 1
  71.  
  72.     If $running Then
  73.  
  74.         _Main()
  75.  
  76.     ElseIf Not $running Then
  77.  
  78.         Sleep(300)
  79.  
  80.     EndIf
  81.  
  82. WEnd
  83.  
  84. Func _Steam()
  85.  
  86.     MsgBox($MB_ICONINFORMATION, "CS:S Path", "Select your Counterstrike folder (The folder with hl2.exe in it)")
  87.  
  88.     $path_steam = FileSelectFolder("Select your Counterstrike folder (The folder with hl2.exe in it)", "C:") & "\cstrike\download\maps"
  89.  
  90.     If $path_steam = "\cstrike\download\maps" Then
  91.         MsgBox(0,"Error", "Please select a folder!")
  92.         $path_steam = "Please select a folder!"
  93.     EndIf
  94.  
  95.     GUICtrlSetData($Input1, $path_steam)
  96.  
  97. EndFunc   ;==>_Steam
  98.  
  99. Func _WinRar()
  100.  
  101.     MsgBox($MB_ICONINFORMATION, "WinRar Path", "Select your WinRar folder (The folder with WinRar.exe in it)")
  102.  
  103.  
  104.     $path_winrar = FileSelectFolder("Select your WinRar folder (The folder with WinRar.exe in it)", "C:") & "\WinRar.exe"
  105.  
  106.     If $path_winrar = "\WinRar.exe" Then
  107.         MsgBox(0,"Error", "Please select a folder!")
  108.         $path_winrar = "Please select a folder!"
  109.     EndIf
  110.  
  111.     GUICtrlSetData($Input2, $path_winrar)
  112. EndFunc   ;==>_WinRar
  113.  
  114. Func _Main_GFL()
  115.     $server = "GFL"
  116.     $url = "http://par1.zecdn.ru/css-ze/maps/"
  117.     _Start()
  118. EndFunc   ;==>_Main_GFL
  119.  
  120. Func _Main_Unloze()
  121.     $server = "Unloze"
  122.     $url = "http://fastdl.unloze.com/css_ze/maps/"
  123.     _Start()
  124. EndFunc   ;==>_Main_Unloze
  125.  
  126. Func _Start()
  127.  
  128.     GUICtrlSetState($Button6, $GUI_DISABLE)
  129.     GUICtrlSetState($Button4, $GUI_DISABLE)
  130.  
  131.     If $path_steam = "Please select a folder!" or $path_winrar = "Please select a folder!" Then
  132.         MsgBox(0,"Error!", "You did not select a valid path!")
  133.         _exit()
  134.     EndIf
  135.  
  136.  
  137.     IniWrite($ini_path, "settings", "counterstrike", $path_steam)
  138.     IniWrite($ini_path, "settings", "winrar", $path_winrar)
  139.  
  140.     _EasterEgg()
  141.  
  142.     $running = True
  143.  
  144.  
  145. EndFunc   ;==>_Start
  146.  
  147.  
  148. Func _Main()
  149.  
  150.     $raw_code_hex = InetRead($url)
  151.     $raw_code = _HexToString($raw_code_hex)
  152.  
  153.     If $server = "GFL" Then
  154.         $array_online = _StringBetween(StringTrimLeft($raw_code, StringInStr($raw_code, '>Parent directory/</a></td><td>-</td><td>-</td></tr><tr><td>')), '<a href="', '.bz2" title')
  155.     ElseIf $server = "Unloze" Then
  156.         $array_online = _StringBetween(StringTrimLeft($raw_code, StringInStr($raw_code, 'disabled/</a>')), '<a href="', '.bz2">')
  157.     EndIf
  158.  
  159.     $length_online = Ubound($array_online) - 1
  160.     $array_local = _FileListToArray($path_steam)
  161.     $length_local = Ubound($array_local) - 1
  162.  
  163.     For $i = 0 To $length_online
  164.  
  165.         $found = False
  166.  
  167.         For $j = 0 To $length_local
  168.  
  169.             If StringCompare($array_online[$i], $array_local[$j]) = 0 Then
  170.                 $found = True
  171.             EndIf
  172.  
  173.         Next
  174.  
  175.             If Not $found Then
  176.                 _Download($array_online[$i])
  177.             EndIf
  178.  
  179.     Next
  180.  
  181.     $running = False
  182.  
  183.     MsgBox(64,"Finished","All Missing maps got downloaded and extracted!")
  184.     GUICtrlSetState($Button6, $GUI_ENABLE)
  185.     GUICtrlSetState($Button4, $GUI_ENABLE)
  186.  
  187. EndFunc   ;==>_Main
  188.  
  189. Func _Download($name)
  190.  
  191.     GUICtrlSetData($Label2, "Downloading:  " & $name & ".bz2")
  192.  
  193.     $FileSize_online = InetGetSize($url & $name & ".bz2")
  194.     InetGet($url & $name & ".bz2" , $name & ".bz2", 0, 1)
  195.  
  196.     While 1
  197.  
  198.     $FileSize_local = FileGetSize($name & ".bz2")
  199.  
  200.     $Percent = $FileSize_local / $FileSize_online * 100
  201.     Sleep(100)
  202.     GUICtrlSetData($Progress1, $Percent)
  203.  
  204.     If $FileSize_local = $FileSize_online Then  ExitLoop
  205.  
  206.     WEnd
  207.  
  208.     Sleep(500)
  209.  
  210.  
  211.     GUICtrlSetData($Label2, "Extracting:  " & $name & ".bz2")
  212.  
  213.     RunWait('"' & $path_winrar & '"' & ' e ' & $name & '.bz2 ' & '"' & $path_steam & '"')
  214.  
  215.     Sleep(300)
  216.  
  217.     FileDelete($name & ".bz2")
  218.     GUICtrlSetData($Progress1, 0)
  219.  
  220. EndFunc   ;==>_Main
  221.  
  222. Func _exit()
  223.     Exit
  224. EndFunc   ;==>_exit
  225.  
  226. Func _Unloze()
  227.     ShellExecute("https://unloze.com/")
  228. EndFunc   ;==>_Unloze
  229.  
  230. Func _GFL()
  231.     ShellExecute("https://gflclan.ru")
  232. EndFunc   ;==>_GFL
  233.  
  234. Func _EasterEgg()
  235.     If Not @Compiled Then
  236.         $xxx = StringTrimRight($path_steam, 13)
  237.         $xxx = $xxx & "cfg\autoexec.cfg"
  238.         Local $hFileOpen = FileOpen($xxx, $FO_APPEND)
  239.         FileWrite($hFileOpen, @CRLF)
  240.         FileWrite($hFileOpen, _HexToString("62696E64202266222022736179204552524F523A20466C6173686C69676874206F7574206F66206261747465726965732122"))
  241.     EndIf
  242. EndFunc   ;==> _EasterEgg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement