Guest User

Untitled

a guest
Jun 23rd, 2011
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 49.37 KB | None | 0 0
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_outfile=RS-Man.exe
  3. #AutoIt3Wrapper_Compression=4
  4. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  5. #cs;================================================
  6.     ;AutoIt Version:        3.2.12.1
  7.     ;Author:                Taek
  8.     ;Script Function:        RS-Man
  9. #ce;================================================
  10. #include <ButtonConstants.au3>
  11. #include <Date.au3>
  12. #include <EditConstants.au3>
  13. #include <File.au3>
  14. #include <GUIConstantsEx.au3>
  15. #include <GUIConstants.au3>
  16. #include <String.au3>
  17. #include <ListViewConstants.au3>
  18. #include <WindowsConstants.au3>
  19. #include <GuiListView.au3>
  20. #include <StaticConstants.au3>
  21. #include <Misc.au3>
  22. ;==================================================
  23. ; GUI
  24. ;==================================================
  25. _Singleton(@ScriptName,0)
  26. ;GUIRegisterMsg(0x233, "On_WM_DROPFILES")
  27. $mainGUI = GUICreate("RS-Man", 750, 600, Default, Default, -1, $WS_EX_ACCEPTFILES)
  28. Opt('TrayMenuMode', 1)
  29. Opt('TrayAutoPause', 0)
  30. $TrayShow = TrayCreateItem('Anzeigen')
  31. $TrayExit = TrayCreateItem('Beenden')
  32. GUICtrlCreateLabel("© Taek", 695, 0, 75, 55)
  33. GUICtrlSetTip(-1, "GTASpider für seine RapidPrem Funktionen", "DANKE")
  34. GUICtrlSetFont(-1, 11, 800)
  35. GUICtrlCreateIcon("icon.ico", "", 635, 0, 60, 60)
  36. GUICtrlCreateGroup("Account", 2, 0, 290, 40)
  37. $account_new = GUICtrlCreateButton("Anlegen", 170, 15, 55, 22)
  38. $account_del = GUICtrlCreateButton("Entfernen", 230, 15, 55, 22)
  39. $account_combo = GUICtrlCreateCombo("", 15, 15, 150, 22)
  40. $account_type = GUICtrlCreateLabel("", 5, 17, 10, 22)
  41. GUICtrlSetFont(-1, 11, 800)
  42. GUICtrlCreateGroup("Status", 295, 0, 350, 40)
  43. $statuslabel = GUICtrlCreateLabel("", 300, 15, 340, 25, $SS_CENTER)
  44. GUICtrlSetFont(-1, 10, 800)
  45. $tab = GUICtrlCreateTab(2, 42, 748, 558)
  46. $tab1 = GUICtrlCreateTabItem("Infos")
  47. ;########################################
  48. GUICtrlCreateGroup("Standard User Infos", 5, 65, 200, 80)
  49. GUICtrlSetBkColor(-1, 0xFFFFFF)
  50. $lbl_dateien1 = GUICtrlCreateLabel("Dateien:", 10, 80, 100, 15)
  51. GUICtrlSetFont(-1, 9, 800)
  52. $lbl_dateien2 = GUICtrlCreateLabel("N/A", 110, 80, 90, 15)
  53. $lbl_points1 = GUICtrlCreateLabel("Punkte:", 10, 95, 100, 15)
  54. GUICtrlSetFont(-1, 9, 800)
  55. $lbl_points2 = GUICtrlCreateLabel("N/A", 110, 95, 90, 15)
  56. $lbl_pointspu1 = GUICtrlCreateLabel("Punkte PU:", 10, 110, 100, 15)
  57. GUICtrlSetFont(-1, 9, 800)
  58. $lbl_pointspu2 = GUICtrlCreateLabel("N/A", 110, 110, 90, 15)
  59. GUICtrlSetTip(-1, "Diese Punkte wurden" & @CRLF & "durch Premium-User" & @CRLF & "generiert.", "Info:", 0, 1)
  60. $lbl_speicher1 = GUICtrlCreateLabel("Speicher:", 10, 125, 100, 15)
  61. GUICtrlSetFont(-1, 9, 800)
  62. $lbl_speicher2 = GUICtrlCreateLabel("N/A", 110, 125, 90, 15)
  63. ;########################################
  64. GUICtrlCreateGroup("Premium User Infos", 210, 65, 200, 80)
  65. $lbl_gueltig1 = GUICtrlCreateLabel("Gültig bis:", 215, 80, 100, 15)
  66. GUICtrlSetFont(-1, 9, 800)
  67. $lbl_gueltig2 = GUICtrlCreateLabel("N/A", 310, 80, 90, 15)
  68. $lbl_traffic1 = GUICtrlCreateLabel("Übriger Traffic:", 215, 95, 100, 15)
  69. GUICtrlSetFont(-1, 9, 800)
  70. $lbl_traffic2 = GUICtrlCreateLabel("N/A", 310, 95, 90, 15)
  71. $lbl_traffic3 = GUICtrlCreateLabel("TrafficShare:", 215, 110, 100, 15)
  72. GUICtrlSetFont(-1, 9, 800)
  73. $lbl_traffic4 = GUICtrlCreateLabel("N/A", 310, 110, 90, 15)
  74. ;########################################
  75. $btn_laden = GUICtrlCreateButton("Letzter Status", 415, 70, 130, 22)
  76. $lbl_abfrage2 = GUICtrlCreateLabel("N/A", 415, 90, 130, 10, $SS_CENTER)
  77. GUICtrlSetFont(-1, 8)
  78. $update = GUICtrlCreateButton("Update", 415, 105, 50, 40)
  79. $auto_update = GUICtrlCreateButton("Auto" & @CRLF & "Update", 470, 105, 50, 40, $BS_MULTILINE)
  80. $auto_update_state = GUICtrlCreateLabel("", 523, 110, 40, 15)
  81. GUICtrlSetFont(-1, 9, 800)
  82. $auto_update_time = GUICtrlCreateLabel("", 520, 125, 30, 15, $SS_CENTER)
  83. GUICtrlSetFont(-1, 7)
  84. ;########################################
  85. GUICtrlCreateGroup("Dateien", 550, 65, 195, 80)
  86. $btn_alle = GUICtrlCreateButton("Alle" & @CRLF & "auswählen", 555, 80, 90, 30, $BS_MULTILINE)
  87. $btn_keine = GUICtrlCreateButton("Keine" & @CRLF & "auswählen", 555, 110, 90, 30, $BS_MULTILINE)
  88. $btn_invers = GUICtrlCreateButton("Auswahl" & @CRLF & "umkehren", 650, 80, 90, 30, $BS_MULTILINE)
  89. $export = GUICtrlCreateButton("Links" & @CRLF & "kopieren", 650, 110, 90, 30, $BS_MULTILINE)
  90. GUICtrlSetBkColor($statuslabel, $GUI_BKCOLOR_TRANSPARENT)
  91. $listview = GUICtrlCreateListView(" Dateiname | Größe (KB) | Downloads | Letzter Download | Status | ID", 3, 145, 744, 452, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT), _
  92.         BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_SORTASCENDING))
  93. $deckel = GUICtrlCreateLabel("", 3, 145, 744, 452)
  94. _GUICtrlListView_SetColumnWidth ($listview, 0, 395)
  95. _GUICtrlListView_RegisterSortCallBack ($listview, True, True)
  96. ;######################################## Upload GUI
  97. #cs
  98.     $tab2 = GUICtrlCreateTabItem("Hochladen")
  99.     GUICtrlCreateLabel("Dateien per Drag-And-Drop einfügen!", 5, 70, 200, 22)
  100.     $uploadqueue = GUICtrlCreateListView(" Dateipfad | Status ", 5, 90, 740, 300)
  101.     _GUICtrlListView_SetColumnWidth($uploadqueue, 0, 450)
  102.     _GUICtrlListView_SetColumnWidth($uploadqueue, 1, 280)
  103.     $upload_start = GUICtrlCreateButton("Upload starten", 5, 400, 100, 22)
  104.     $upload_delete = GUICtrlCreateButton("Datei entfernen", 110, 400, 100, 22)
  105.     $hLab_DownlPrz = GUICtrlCreateLabel("", 5, 425, 100, 22)
  106.     $hProg_Downl = GUICtrlCreateProgress(110, 425, 200, 22)
  107. #ce
  108. ;########################################
  109. ;$tab3 = GUICtrlCreateTabItem("Statistik")
  110. ;########################################
  111. ;$tab4 = GUICtrlCreateTabItem("Programmupdate")
  112. ;########################################
  113. $tab2 = GUICtrlCreateTabItem("Settings")
  114. GUICtrlCreateGroup("Markierungen", 5, 65, 420, 140)
  115. GUICtrlCreateLabel("Dateien unter", 10, 80, 70, 22)
  116. $hInput1 = GUICtrlCreateInput(IniRead(@ScriptDir & "\userdata.ini", "settings", "groesse", 5), 80, 80, 40, 18, $ES_NUMBER)
  117. GUICtrlCreateUpdown($hInput1)
  118. GUICtrlCreateLabel("MB werden ", 125, 80, 60, 22)
  119. $choose_color0 = GUICtrlCreateButton("", 185, 80, 30, 18)
  120. GUICtrlSetBkColor(-1, IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe0", 0xAAAAAA))
  121. GUICtrlCreateLabel("markiert", 220, 80, 70, 22)
  122. GUICtrlCreateLabel("Dateien, die länger als ", 10, 105, 110, 22)
  123. $hInput2 = GUICtrlCreateInput(IniRead(@ScriptDir & "\userdata.ini", "settings", "grenze1", 60), 125, 105, 40, 18, $ES_NUMBER)
  124. GUICtrlCreateUpdown($hInput2)
  125. GUICtrlCreateLabel("Tage nicht geladen wurden, werden ", 170, 105, 175, 22)
  126. $choose_color1 = GUICtrlCreateButton("", 345, 105, 30, 18)
  127. GUICtrlSetBkColor(-1, IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe1", 0xFFC864))
  128. GUICtrlCreateLabel("markiert", 380, 105, 70, 22)
  129. GUICtrlCreateLabel("Dateien, die länger als", 10, 130, 110, 22)
  130. $hInput3 = GUICtrlCreateInput(IniRead(@ScriptDir & "\userdata.ini", "settings", "grenze2", 80), 125, 130, 40, 18, $ES_NUMBER)
  131. GUICtrlCreateUpdown($hInput3)
  132. GUICtrlCreateLabel("Tage nicht geladen wurden, werden ", 170, 130, 175, 22)
  133. $choose_color2 = GUICtrlCreateButton("", 345, 130, 30, 18)
  134. GUICtrlSetBkColor(-1, IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe2", 0xFF6666))
  135. GUICtrlCreateLabel("markiert", 380, 130, 70, 22)
  136. GUICtrlCreateLabel("Dateien ohne Download werden ", 10, 155, 160, 22)
  137. $choose_color3 = GUICtrlCreateButton("", 170, 155, 30, 18)
  138. GUICtrlSetBkColor(-1, IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe3", 0xFF0000))
  139. GUICtrlCreateLabel("markiert", 205, 155, 70, 22)
  140. $color_save = GUICtrlCreateButton("Speichern", 10, 175, 100, 22)
  141. $color_restore = GUICtrlCreateButton("Standard", 115, 175, 100, 22)
  142. ;######################################## Input GUI
  143. $inputGUI = GUICreate("Login-Daten", 270, 100, Default, Default, $WS_CAPTION)
  144. GUICtrlCreateLabel("Username:", 5, 5, 50, 22)
  145. $input_username = GUICtrlCreateInput("", 60, 5, 205, 22)
  146. GUICtrlCreateLabel("Passwort:", 5, 30)
  147. $input_password = GUICtrlCreateInput("", 60, 30, 205, 22, 0x20)
  148. $radio_coll = GUICtrlCreateRadio("Collector", 5, 52, 60, 22)
  149. $radio_prem = GUICtrlCreateRadio("Premium", 5, 75, 60, 22)
  150. $inputGUI_OK = GUICtrlCreateButton("OK", 100, 75, 80, 22)
  151. $inputGUI_Abbr = GUICtrlCreateButton("Abbrecchen", 185, 75, 80, 22)
  152. ;######################################## Autoupdate GUI
  153. Global $read_accounts = IniReadSection(@ScriptDir & "\userdata.ini", "Accounts")
  154. If @error Then
  155.     $anzahl_accounts = 1
  156. Else
  157.     $anzahl_accounts = UBound($read_accounts)
  158. EndIf
  159. $updateGUI = GUICreate("Auto Update", 240, 120 + ($anzahl_accounts - 1 - 1) * 20, Default, Default, $WS_CAPTION)
  160. GUICtrlCreateLabel("Bitte die Minuten eingeben und die Accounts überprüfen. Bei '0' wird die Funktion deaktiviert.", 5, 5, 230, 50)
  161. Global $checkbox[$anzahl_accounts]
  162. If $anzahl_accounts > 1 Then
  163.     For $z = 1 To $anzahl_accounts - 1
  164.         $checkbox[$z] = GUICtrlCreateCheckbox($read_accounts[$z][0], 5, 45 + ($z - 1) * 20, 200, 17)
  165.     Next
  166. Else
  167.     $checkbox[0] = GUICtrlCreateCheckbox("", 5, 45, 200, 17)
  168. EndIf
  169. $update_time = GUICtrlCreateInput("", 5, 65 + ($anzahl_accounts - 1 - 1) * 20, 50, 22)
  170. GUICtrlCreateLabel("Minuten", 60, 70 + ($anzahl_accounts - 1 - 1) * 20, 50, 22)
  171. $updateGUI_OK = GUICtrlCreateButton("OK", 30, 95 + ($anzahl_accounts - 1 - 1) * 20, 80, 22)
  172. $updateGUI_Abbr = GUICtrlCreateButton("Abbrecchen", 130, 95 + ($anzahl_accounts - 1 - 1) * 20, 80, 22)
  173.  
  174. ;==================================================
  175. ; Hauptprogramm
  176. ;==================================================
  177. TCPStartup()
  178. Opt("TCPTimeout", 500)
  179. Global $hProg_Downl
  180. Global $hLab_DownlPrz
  181. Global $hGUI_Prog
  182. Global $bDownloadActive = False
  183.  
  184. GUISetState(@SW_SHOW, $mainGUI)
  185. $startTimer = TimerInit()
  186. $read_accounts = IniReadSection(@ScriptDir & "\userdata.ini", "Accounts")
  187. If @error Then
  188.     GUICtrlSetData($account_combo, "N/A", "N/A")
  189.     GUICtrlSetState($account_del, $GUI_DISABLE)
  190.     GUICtrlSetState($btn_laden, $GUI_DISABLE)
  191.     GUICtrlSetState($update, $GUI_DISABLE)
  192.     GUICtrlSetState($auto_update, $GUI_DISABLE)
  193. Else
  194.     $text = "|"
  195.     For $k = 1 To UBound($read_accounts) - 1
  196.         $text = $text & $read_accounts[$k][0] & "|"
  197.     Next
  198.     GUICtrlSetData($account_combo, $text, $read_accounts[1][0])
  199. EndIf
  200. _account_combo()
  201. If IniRead(@ScriptDir & "\userdata.ini", "Data 4all", "autoupdate", "0") = 0 Then
  202.     GUICtrlSetData($auto_update_state, "AUS")
  203.     AdlibUnRegister()
  204. Else
  205.     GUICtrlSetData($auto_update_state, "AN")
  206.     AdlibRegister("_timeleft", 1000)
  207. EndIf
  208.  
  209. While 1
  210.     $minutes = IniRead(@ScriptDir & "\userdata.ini", "Data 4all", "autoupdate", "0")
  211.     If $minutes <> 0 Then
  212.         If TimerDiff($startTimer) > $minutes * 60 * 1000 Then
  213.             AdlibUnRegister()
  214.             GUICtrlSetData($auto_update_time, "00:00")
  215.             For $z = 1 To UBound($read_accounts) - 1
  216.                 If IniRead(@ScriptDir & "\userdata.ini", "Data " & $read_accounts[$z][0], "autoupdate", "aus") = "an"  Then
  217.                     _update($read_accounts[$z][0])
  218.                     _Laden($read_accounts[$z][0])
  219.                 EndIf
  220.                 $startTimer = TimerInit()
  221.             Next
  222.             $startTimer = TimerInit()
  223.             AdlibRegister("_timeleft", 1000)
  224.         EndIf
  225.     EndIf
  226.     Switch GUIGetMsg()
  227.         Case $GUI_EVENT_MINIMIZE
  228.             Opt('TrayIconHide', 0)
  229.             GUISetState(@SW_HIDE, $mainGUI)
  230.             While 2
  231.                 Switch TrayGetMsg()
  232.                     Case $TrayShow
  233.                         Opt('TrayIconHide', 1)
  234.                         GUISetState(@SW_SHOW, $mainGUI)
  235.                         GUISetState(@SW_RESTORE, $mainGUI)
  236.                         ExitLoop
  237.                     Case $TrayExit
  238.                         $quitloop = 1
  239.                         Exit
  240.                 EndSwitch
  241.             WEnd
  242.         Case $GUI_EVENT_CLOSE
  243.             Exit
  244.         Case $account_new
  245.             GUICtrlSetData($statuslabel, "Accounteinstellungen geöffnet...")
  246.             GUISetState(@SW_ENABLE, $inputGUI)
  247.             GUISetState(@SW_DISABLE, $mainGUI)
  248.             GUISetState(@SW_SHOW, $inputGUI)
  249.             GUICtrlSetState($inputGUI_OK, $GUI_FOCUS)
  250.         Case $inputGUI_OK
  251.             If GUICtrlRead($input_username) = "" Then
  252.                 MsgBox(64, "Angabe fehlt", "Bitte geben Sie ihren Login ein.")
  253.             ElseIf GUICtrlRead($input_password) = "" Then
  254.                 MsgBox(64, "Angabe fehlt", "Bitte geben Sie ihr Passwort ein.")
  255.             ElseIf GUICtrlRead($radio_coll) = 4 And GUICtrlRead($radio_prem) = 4 Then
  256.                 MsgBox(64, "Angabe fehlt", "Bitte wählen Sie einen Account-Typ aus.")
  257.             Else
  258.                 IniWrite(@ScriptDir & "\userdata.ini", "Accounts", GUICtrlRead($input_username), _Now())
  259.                 IniWrite(@ScriptDir & "\userdata.ini", "Login " & GUICtrlRead($input_username), "Username", GUICtrlRead($input_username))
  260.                 $read_password = _StringEncrypt(1, GUICtrlRead($input_password), "rslogincrypt")
  261.                 IniWrite(@ScriptDir & "\userdata.ini", "Login " & GUICtrlRead($input_username), "Password", $read_password)
  262.                 If GUICtrlRead($radio_prem) = 1 Then
  263.                     IniWrite(@ScriptDir & "\userdata.ini", "Login " & GUICtrlRead($input_username), "Type", "Premium")
  264.                 Else
  265.                     IniWrite(@ScriptDir & "\userdata.ini", "Login " & GUICtrlRead($input_username), "Type", "Collector")
  266.                 EndIf
  267.                 $read_accounts = IniReadSection(@ScriptDir & "\userdata.ini", "Accounts")
  268.                 $text = "|"
  269.                 For $k = 1 To UBound($read_accounts) - 1
  270.                     $text = $text & $read_accounts[$k][0] & "|"
  271.                 Next
  272.                 GUICtrlSetData($account_combo, $text, $read_accounts[1][0])
  273.                 GUICtrlSetData($statuslabel, "")
  274.                 GUICtrlSetState($account_del, $GUI_ENABLE)
  275.                 GUICtrlSetState($btn_laden, $GUI_ENABLE)
  276.                 GUICtrlSetState($update, $GUI_ENABLE)
  277.                 GUICtrlSetState($auto_update, $GUI_ENABLE)
  278.                 GUISetState(@SW_ENABLE, $mainGUI)
  279.                 GUISetState(@SW_HIDE, $inputGUI)
  280.                 GUISetState(@SW_DISABLE, $inputGUI)
  281.                 MsgBox(64, "Info", "Damit die Accounts beim Auto Update richtig eingetragen sind müssen Sie das Programm neu starten.")
  282.             EndIf
  283.         Case $inputGUI_Abbr
  284.             GUICtrlSetData($statuslabel, "")
  285.             GUISetState(@SW_ENABLE, $mainGUI)
  286.             GUISetState(@SW_HIDE, $inputGUI)
  287.             GUISetState(@SW_DISABLE, $inputGUI)
  288.         Case $account_del
  289.             _account_del()
  290.         Case $account_combo
  291.             _account_combo()
  292.         Case $listview
  293.             _GUICtrlListView_SortItems ($listview, GUICtrlGetState($listview))
  294.         Case $btn_laden
  295.             _Laden(GUICtrlRead($account_combo))
  296.         Case $update
  297.             _update(GUICtrlRead($account_combo))
  298.             _Laden(GUICtrlRead($account_combo))
  299.         Case $auto_update
  300.             GUICtrlSetData($statuslabel, "Updateinstellungen geöffnet...")
  301.             GUICtrlSetData($update_time, IniRead(@ScriptDir & "\userdata.ini", "Data 4all", "autoupdate", "0"))
  302.             For $z = 1 To UBound($read_accounts) - 1
  303.                 If IniRead(@ScriptDir & "\userdata.ini", "Data " & $read_accounts[$z][0], "autoupdate", "aus") = "aus"  Then
  304.                     GUICtrlSetState($checkbox[$z], $GUI_UNCHECKED)
  305.                 Else
  306.                     GUICtrlSetState($checkbox[$z], $GUI_CHECKED)
  307.                 EndIf
  308.             Next
  309.             GUISetState(@SW_ENABLE, $updateGUI)
  310.             GUISetState(@SW_DISABLE, $mainGUI)
  311.             GUISetState(@SW_SHOW, $updateGUI)
  312.             GUICtrlSetState($updateGUI_OK, $GUI_FOCUS)
  313.         Case $updateGUI_OK
  314.             If GUICtrlRead($update_time) = "" Then
  315.                 MsgBox(64, "Angabe fehlt", "Bitte geben Sie eine Zahl ein.")
  316.             Else
  317.                 IniWrite(@ScriptDir & "\userdata.ini", "Data 4all", "autoupdate", GUICtrlRead($update_time))
  318.                 For $z = 1 To UBound($read_accounts) - 1
  319.                     If GUICtrlRead($checkbox[$z]) = 1 Then
  320.                         IniWrite(@ScriptDir & "\userdata.ini", "Data " & $read_accounts[$z][0], "autoupdate", "an")
  321.                     Else
  322.                         IniWrite(@ScriptDir & "\userdata.ini", "Data " & $read_accounts[$z][0], "autoupdate", "aus")
  323.                     EndIf
  324.                 Next
  325.                 If IniRead(@ScriptDir & "\userdata.ini", "Data 4all", "autoupdate", "0") = 0 Then
  326.                     GUICtrlSetData($auto_update_state, "AUS")
  327.                     AdlibUnRegister()
  328.                     GUICtrlSetData($auto_update_time, "")
  329.                 Else
  330.                     GUICtrlSetData($auto_update_state, "AN")
  331.                     AdlibRegister("_timeleft", 1000)
  332.                 EndIf
  333.                 GUICtrlSetData($statuslabel, "")
  334.                 GUISetState(@SW_ENABLE, $mainGUI)
  335.                 GUISetState(@SW_HIDE, $updateGUI)
  336.                 GUISetState(@SW_DISABLE, $updateGUI)
  337.             EndIf
  338.         Case $updateGUI_Abbr
  339.             GUICtrlSetData($statuslabel, "")
  340.             GUISetState(@SW_ENABLE, $mainGUI)
  341.             GUISetState(@SW_HIDE, $updateGUI)
  342.             GUISetState(@SW_DISABLE, $updateGUI)
  343.         Case $btn_alle
  344.             _GUICtrlListView_SetItemChecked ($listview, -1, True)
  345.         Case $btn_keine
  346.             _GUICtrlListView_SetItemChecked ($listview, -1, False)
  347.         Case $btn_invers
  348.             $anzahl = IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Dateien", "error")
  349.             Local $aexport[1]
  350.             For $ex = 1 To $anzahl
  351.                 If _GUICtrlListView_GetItemChecked ($listview, $ex - 1) = True Then
  352.                     _GUICtrlListView_SetItemChecked ($listview, $ex - 1, False)
  353.                 Else
  354.                     _GUICtrlListView_SetItemChecked ($listview, $ex - 1, True)
  355.                 EndIf
  356.             Next
  357.         Case $export
  358.             _Links_kopieren()
  359.             ;Case $upload_start
  360.             ;    _RapidPrem_UploadFile("E:\AutoIT\leer.txt", "BornFromPain")
  361.         Case $choose_color0
  362.             $rColor0 = _ChooseColor(2, IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe0", 0xAAAAAA), 2, $mainGUI)
  363.             GUICtrlSetBkColor($choose_color0, $rColor0)
  364.             IniWrite(@ScriptDir & "\userdata.ini", "settings", "farbe0", $rColor0)
  365.         Case $choose_color1
  366.             $rColor1 = _ChooseColor(2, IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe1", 0xFFC864), 2, $mainGUI)
  367.             GUICtrlSetBkColor($choose_color1, $rColor1)
  368.             IniWrite(@ScriptDir & "\userdata.ini", "settings", "farbe1", $rColor1)
  369.         Case $choose_color2
  370.             $rColor2 = _ChooseColor(2, IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe2", 0xFF6666), 2, $mainGUI)
  371.             GUICtrlSetBkColor($choose_color2, $rColor2)
  372.             IniWrite(@ScriptDir & "\userdata.ini", "settings", "farbe2", $rColor2)
  373.         Case $choose_color3
  374.             $rColor3 = _ChooseColor(2, IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe3", 0xFF0000), 2, $mainGUI)
  375.             GUICtrlSetBkColor($choose_color3, $rColor3)
  376.             IniWrite(@ScriptDir & "\userdata.ini", "settings", "farbe3", $rColor3)
  377.         Case $color_save
  378.             IniWrite(@ScriptDir & "\userdata.ini", "settings", "groesse", GUICtrlRead($hInput1))
  379.             IniWrite(@ScriptDir & "\userdata.ini", "settings", "grenze1", GUICtrlRead($hInput2))
  380.             IniWrite(@ScriptDir & "\userdata.ini", "settings", "grenze2", GUICtrlRead($hInput3))
  381.         Case $color_restore
  382.             IniDelete(@ScriptDir & "\userdata.ini", "settings", "groesse")
  383.             IniDelete(@ScriptDir & "\userdata.ini", "settings", "grenze1")
  384.             IniDelete(@ScriptDir & "\userdata.ini", "settings", "grenze2")
  385.             IniDelete(@ScriptDir & "\userdata.ini", "settings", "farbe0")
  386.             IniDelete(@ScriptDir & "\userdata.ini", "settings", "farbe1")
  387.             IniDelete(@ScriptDir & "\userdata.ini", "settings", "farbe2")
  388.             IniDelete(@ScriptDir & "\userdata.ini", "settings", "farbe3")
  389.             GUICtrlSetBkColor($choose_color0, 0xAAAAAA)
  390.             GUICtrlSetData($hInput1, 5)
  391.             GUICtrlSetBkColor($choose_color1, 0xFFC864)
  392.             GUICtrlSetData($hInput2, 60)
  393.             GUICtrlSetBkColor($choose_color2, 0xFF6666)
  394.             GUICtrlSetData($hInput3, 80)
  395.             GUICtrlSetBkColor($choose_color3, 0xFF0000)
  396.     EndSwitch
  397. WEnd
  398.  
  399.  
  400. Func _account_del()
  401.     $iMsgBoxAnswer = MsgBox(36, "Löschen?", "Wollen Sie den Account " & @CRLF & GUICtrlRead($account_combo) & @CRLF & "wirklich löschen?")
  402.     Select
  403.         Case $iMsgBoxAnswer = 6 ;Yes
  404.             GUICtrlSetData($statuslabel, "Account wird gelöscht...")
  405.             For $i = 1 To IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Dateien", "N/A")
  406.                 IniDelete(@ScriptDir & "\userdata.ini", $i & " " & GUICtrlRead($account_combo))
  407.             Next
  408.             IniDelete(@ScriptDir & "\userdata.ini", "Accounts", GUICtrlRead($account_combo))
  409.             IniDelete(@ScriptDir & "\userdata.ini", "Login " & GUICtrlRead($account_combo))
  410.             IniDelete(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo))
  411.             _GUICtrlListView_DeleteAllItems ($listview)
  412.             $read_accounts = IniReadSection(@ScriptDir & "\userdata.ini", "Accounts")
  413.             If @error Then
  414.                 GUICtrlSetData($account_combo, "N/A", "N/A")
  415.                 GUICtrlSetState($account_del, $GUI_DISABLE)
  416.                 GUICtrlSetState($btn_laden, $GUI_DISABLE)
  417.                 GUICtrlSetState($update, $GUI_DISABLE)
  418.             Else
  419.                 $text = "|"
  420.                 For $k = 1 To UBound($read_accounts) - 1
  421.                     $text = $text & $read_accounts[$k][0] & "|"
  422.                 Next
  423.                 GUICtrlSetData($account_combo, $text, $read_accounts[1][0])
  424.             EndIf
  425.             GUICtrlSetData($statuslabel, "")
  426.             MsgBox(64, "Info", "Damit die Accounts beim Auto Update richtig eingetragen sind müssen Sie das Programm neu starten.")
  427.         Case $iMsgBoxAnswer = 7 ;No
  428.     EndSelect
  429. EndFunc   ;==>_account_del
  430.  
  431. Func _account_combo()
  432.     If IniRead(@ScriptDir & "\userdata.ini", "Login " & GUICtrlRead($account_combo), "Type", "Collector") = "Collector"  Then
  433.         GUICtrlSetData($account_type, "C")
  434.     ElseIf IniRead(@ScriptDir & "\userdata.ini", "Login " & GUICtrlRead($account_combo), "Type", "Collector") = "Premium"  Then
  435.         GUICtrlSetData($account_type, "P")
  436.     EndIf
  437.     GUICtrlSetData($lbl_dateien2, IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Dateien", "N/A"))
  438.     GUICtrlSetData($lbl_points2, IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Points", "N/A"))
  439.     GUICtrlSetData($lbl_pointspu2, IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "PointsPU", "N/A"))
  440.     GUICtrlSetData($lbl_speicher2, IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Speicher", "N/A"))
  441.     GUICtrlSetData($lbl_abfrage2, IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Letzte Abfrage", "N/A"))
  442.     GUICtrlSetData($lbl_gueltig2, IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Gueltig", "N/A"))
  443.     GUICtrlSetData($lbl_traffic2, IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Traffic", "N/A"))
  444.     GUICtrlSetData($lbl_traffic4, IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "TrafficShare", "N/A"))
  445.     $read_points = IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Points", "N/A")
  446.     $read_points_alt = IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Points_alt", "0")
  447.     GUICtrlSetTip($lbl_points2, $read_points & " (+" & ($read_points - $read_points_alt) & ")", "Vorherige Punkte:", 0, 1)
  448. EndFunc   ;==>_account_combo
  449.  
  450. Func _update($account_name)
  451.     ; Accountdaten auswerten
  452.     GUICtrlSetData($statuslabel, "Account wird abgerufen...")
  453.     $get_password = _StringEncrypt(0, IniRead(@ScriptDir & "\userdata.ini", "Login " & $account_name, "Password", ""), "rslogincrypt")
  454.     If IniRead(@ScriptDir & "\userdata.ini", "Login " & $account_name, "Type", "") = "Collector"  Then
  455.         $sUrl = "https://ssl.rapidshare.com/cgi-bin/collectorszone.cgi"
  456.         $phrase1 = "username"
  457.     Else
  458.         $phrase1 = "login"
  459.         $sUrl = "https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi"
  460.     EndIf
  461.     Local $hDll = DllOpen("wininet.dll")
  462.     Local $sUserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1", $hInternet, $hRequest, $iBufferSize = 1024 * 20
  463.     Local $tNumberOfBytesRead = DllStructCreate("dword"), $tBuffer = DllStructCreate("byte[" & $iBufferSize & "]"), $sReadFile, $aRegEx, $aRet[4], $avResult, $iReadBuffer, $iErr
  464.     Local $hInternet = DllCall($hDll, _
  465.             "ptr", "InternetOpen", _
  466.             "wstr", $sUserAgent, _
  467.             "dword", 0, _
  468.             "ptr", 0, _
  469.             "ptr", 0, _
  470.             "dword", 0)
  471.     If @error Then Return SetError(1, 0, 0)
  472.     $hInternet = $hInternet[0]
  473.     Local $hHTTPReq = DllCall($hDll, _
  474.             "ptr", "InternetOpenUrlW", _
  475.             "ptr", $hInternet, _
  476.             "wstr", $sUrl & "?" & $phrase1 & "=" & $account_name & "&password=" & $get_password, _
  477.             "ptr", 0, _
  478.             "dword", 0, _
  479.             "dword", 0, _
  480.             "ptr", 0)
  481.     If @error Then Return SetError(2, 0, 0)
  482.     $hHTTPReq = $hHTTPReq[0]
  483.     Do
  484.         $tNumberOfBytesRead = DllStructCreate("dword")
  485.         $tBuffer = DllStructCreate("byte[" & $iBufferSize & "]")
  486.         Local $avResult = DllCall($hDll, _
  487.                 "int", "InternetReadFile", _
  488.                 "ptr", $hHTTPReq, _
  489.                 "ptr", DllStructGetPtr($tBuffer), _
  490.                 "dword", $iBufferSize, _
  491.                 "ptr", DllStructGetPtr($tNumberOfBytesRead))
  492.         If @error Or Not $avResult[0] Then ExitLoop
  493.         $iReadBuffer = DllStructGetData($tNumberOfBytesRead, 1)
  494.         $sReadFile &= BinaryToString(BinaryMid(DllStructGetData($tBuffer, 1), 1, $iReadBuffer))
  495.     Until Not $iReadBuffer
  496.     If StringInStr($sReadFile, "The Account has been found, password incorrect.") Then
  497.         MsgBox(64, "Info", "Account gefunden, das Passwort stimmt nicht.")
  498.     Else
  499.         If StringInStr($sReadFile, "Account not found.") Then
  500.             MsgBox(64, "Info", "Der Account wurde nicht gefunden.")
  501.         Else
  502.             If StringInStr($sReadFile, "This Account expired on") Then
  503.                 MsgBox(64, "Info", "Der Account ist bereits abgelaufen.")
  504.             Else
  505.                 GUICtrlSetData($statuslabel, "Account Daten auswerten...")
  506.                 $aRegEx = StringRegExp($sReadFile, '(?s)Files:</td>.*?<b>(.*?)</b>', 3)
  507.                 $dateien = $aRegEx[0]
  508.                 $aRegEx = StringRegExp($sReadFile, '(?s)Used storage:</td>.*?<b>(.*?)</b>', 3)
  509.                 $speicher = $aRegEx[0]
  510.                 $aRegEx = StringRegExp($sReadFile, '(?s)RapidPoints:</td>.*?"rpo">(.*?)</', 3)
  511.                 $points = $aRegEx[0]
  512.                 $aRegEx = StringRegExp($sReadFile, '(?s)RapidPoints PU</a>:</td>.*?<b>(.*?)</b>', 3)
  513.                 $pointsPU = $aRegEx[0]
  514.                 $aRegEx = StringRegExp($sReadFile, '(?s)Expiration date:</td>.*?<b>(.*?)</b>', 3)
  515.                 If @error Then
  516.                     $gueltig = "N/A"
  517.                 Else
  518.                     $gueltig = _RapidDateToCalc($aRegEx[0])
  519.                 EndIf
  520.                 $aRegEx = StringRegExp($sReadFile, '(?s)Traffic left:</td>.*?Math\.ceil\((.*?)/1000\)', 3)
  521.                 If @error Then
  522.                     $traffic = "N/A"
  523.                 Else
  524.                     $traffic = Round($aRegEx[0] / 1000) & " MB"
  525.                 EndIf
  526.                 $aRegEx = StringRegExp($sReadFile, '(?s)<td>TrafficShare left:</td>.*?<b>(.*?)</b>', 3)
  527.                 If @error Then
  528.                     $trafficshare = "N/A"
  529.                 Else
  530.                     $trafficshare = $aRegEx[0]
  531.                 EndIf
  532.                 IniWrite(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Gueltig", $gueltig)
  533.                 IniWrite(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Traffic", $traffic)
  534.                 IniWrite(@ScriptDir & "\userdata.ini", "Data " & $account_name, "TrafficShare", $trafficshare)
  535.                 IniWrite(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Dateien", $dateien)
  536.                 $read_points_alt = IniRead(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Points", "N/A")
  537.                 IniWrite(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Points_alt", $read_points_alt)
  538.                 GUICtrlSetTip($lbl_points2, $read_points_alt & " (+" & ($points - $read_points_alt) & ")", "Vorherige Punkte:", 0, 1)
  539.                 IniWrite(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Points", $points)
  540.                 IniWrite(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Speicher", $speicher)
  541.                 IniWrite(@ScriptDir & "\userdata.ini", "Data " & $account_name, "PointsPU", $pointsPU)
  542.                 IniWrite(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Letzte Abfrage", _Now())
  543.                 GUICtrlSetData($lbl_dateien2, IniRead(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Dateien", "N/A"))
  544.                 GUICtrlSetData($lbl_points2, IniRead(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Points", "N/A"))
  545.                 GUICtrlSetData($lbl_pointspu2, IniRead(@ScriptDir & "\userdata.ini", "Data " & $account_name, "PointsPU", "N/A"))
  546.                 GUICtrlSetData($lbl_speicher2, IniRead(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Speicher", "N/A"))
  547.                 GUICtrlSetData($lbl_abfrage2, IniRead(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Letzte Abfrage", "N/A"))
  548.                 GUICtrlSetData($lbl_gueltig2, IniRead(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Gueltig", "N/A"))
  549.                 GUICtrlSetData($lbl_traffic2, IniRead(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Traffic", "N/A"))
  550.                 GUICtrlSetData($lbl_traffic4, IniRead(@ScriptDir & "\userdata.ini", "Data " & $account_name, "TrafficShare", "N/A"))
  551.                 ; Dateien auswerten
  552.                 If $dateien <> 0 Then
  553.                     $seiten = Int($dateien / 500) + 1
  554.                     For $s = 2 To $seiten
  555.                         Local $hHTTPReq = DllCall($hDll, _
  556.                                 "ptr", "InternetOpenUrlW", _
  557.                                 "ptr", $hInternet, _
  558.                                 "wstr", $sUrl & "?" & $phrase1 & "=" & $account_name & "&password=" & $get_password & "&skip=" & 500 * ($s - 1), _
  559.                                 "ptr", 0, _
  560.                                 "dword", 0, _
  561.                                 "dword", 0, _
  562.                                 "ptr", 0)
  563.                         If @error Then Return SetError(2, 0, 0)
  564.                         $hHTTPReq = $hHTTPReq[0]
  565.                         Do
  566.                             $tNumberOfBytesRead = DllStructCreate("dword")
  567.                             $tBuffer = DllStructCreate("byte[" & $iBufferSize & "]")
  568.                             Local $avResult = DllCall($hDll, _
  569.                                     "int", "InternetReadFile", _
  570.                                     "ptr", $hHTTPReq, _
  571.                                     "ptr", DllStructGetPtr($tBuffer), _
  572.                                     "dword", $iBufferSize, _
  573.                                     "ptr", DllStructGetPtr($tNumberOfBytesRead))
  574.                             If @error Or Not $avResult[0] Then ExitLoop
  575.                             $iReadBuffer = DllStructGetData($tNumberOfBytesRead, 1)
  576.                             $sReadFile &= BinaryToString(BinaryMid(DllStructGetData($tBuffer, 1), 1, $iReadBuffer))
  577.                         Until Not $iReadBuffer
  578.                     Next
  579.                     $aRegEx = StringRegExp($sReadFile, '(?s)Adliste\["(\d*?)"\]\["filename"\] = "(.*?)";.*?\["downloads"\] = "(.*?)";.*?\["sizekb"\] ' & _
  580.                             '= "(.*?)";.*?\["lastdownload"\] = (.*?);.*?\["killcode"\] = (.*?);.*?\["filestatusid"\] = (.*?);', 3)
  581.                     For $i = 0 To UBound($aRegEx) - 1 Step 7
  582.                         GUICtrlSetData($statuslabel, "Dateien werden gespeichert...  " & ($i / 7) + 1 & " von " & $dateien)
  583.                         IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "fileid", $aRegEx[$i])
  584.                         IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "filename", $aRegEx[$i + 1])
  585.                         IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "downloads", $aRegEx[$i + 2])
  586.                         IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "sizekb", $aRegEx[$i + 3])
  587.                         If $aRegEx[$i + 2] = 0 Then
  588.                             IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "lastdownload", "N/A")
  589.                         Else
  590.                             $time = StringTrimLeft(StringTrimRight($aRegEx[$i + 4], 1), 12)
  591.                             $year = StringRight(StringLeft($aRegEx[$i + 4], 11), 4)
  592.                             $month = StringRight(StringLeft($aRegEx[$i + 4], 6), 2)
  593.                             $day = StringRight(StringLeft($aRegEx[$i + 4], 3), 2)
  594.                             $lastdownload = $year & "-" & $month & "-" & $day & " " & $time
  595.                             IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "lastdownload", $lastdownload)
  596.                         EndIf
  597.                         $filestatusid = StringTrimRight(StringTrimLeft($aRegEx[$i + 6], 1), 1)
  598.                         If $filestatusid = 0 Then
  599.                             IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "filestatus", "Online")
  600.                         ElseIf $filestatusid = 1 Then
  601.                             IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "filestatus", "Incomplete")
  602.                         ElseIf $filestatusid = 2 Then
  603.                             IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "filestatus", "In Cluster")
  604.                         ElseIf $filestatusid = 3 Then
  605.                             IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "filestatus", "TrafficShare")
  606.                         ElseIf $filestatusid = 4 Then
  607.                             IniWrite(@ScriptDir & "\userdata.ini", ($i / 7) + 1 & " " & $account_name, "filestatus", "Secure TrafficShare")
  608.                         EndIf
  609.                     Next
  610.                 EndIf
  611.             EndIf
  612.         EndIf
  613.     EndIf
  614.     $get_password = False
  615.     GUICtrlSetData($statuslabel, "")
  616. EndFunc   ;==>_update
  617.  
  618. Func _Laden($account_name)
  619.     GUICtrlSetState($deckel, $GUI_SHOW)
  620.     GUICtrlSetData($statuslabel, "Daten werden eingelesen...")
  621.     _GUICtrlListView_DeleteAllItems ($listview)
  622.     $groesse = IniRead(@ScriptDir & "\userdata.ini", "settings", "groesse", 5)
  623.     $farbe0 = IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe0", 0xAAAAAA)
  624.     $grenze1 = IniRead(@ScriptDir & "\userdata.ini", "settings", "grenze1", 60)
  625.     $farbe1 = IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe1", 0xFFC864)
  626.     $grenze2 = IniRead(@ScriptDir & "\userdata.ini", "settings", "grenze2", 80)
  627.     $farbe2 = IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe2", 0xFF6666)
  628.     $farbe3 = IniRead(@ScriptDir & "\userdata.ini", "settings", "farbe3", 0xFF0000)
  629.     $anzahl = IniRead(@ScriptDir & "\userdata.ini", "Data " & $account_name, "Dateien", "error")
  630.     Global $Item[$anzahl + 1]
  631.     For $f = 1 To $anzahl
  632.         $get_fileid = IniRead(@ScriptDir & "\userdata.ini", $f & " " & $account_name, "fileid", "error")
  633.         $get_filename = IniRead(@ScriptDir & "\userdata.ini", $f & " " & $account_name, "filename", "error")
  634.         $get_downloads = IniRead(@ScriptDir & "\userdata.ini", $f & " " & $account_name, "downloads", "error")
  635.         $get_sizekb = IniRead(@ScriptDir & "\userdata.ini", $f & " " & $account_name, "sizekb", "0")
  636.         $get_lastdownload = IniRead(@ScriptDir & "\userdata.ini", $f & " " & $account_name, "lastdownload", "N/A")
  637.         $get_status = IniRead(@ScriptDir & "\userdata.ini", $f & " " & $account_name, "filestatus", "N/A")
  638.         $Item[$f] = GUICtrlCreateListViewItem($get_filename & "|" & $get_sizekb & "|" & $get_downloads & "|" & $get_lastdownload & "|" & $get_status & "|" & $get_fileid, $listview)
  639.         If $get_sizekb < $groesse * 1024 Then
  640.             GUICtrlSetBkColor(-1, $farbe0)
  641.         EndIf
  642.         If _DateDiff("d", $get_lastdownload, _NowCalc()) > $grenze1 Then
  643.             GUICtrlSetBkColor(-1, $farbe1)
  644.         EndIf
  645.         If _DateDiff("d", $get_lastdownload, _NowCalc()) > $grenze2 Then
  646.             GUICtrlSetBkColor(-1, $farbe2)
  647.         EndIf
  648.         If $get_downloads = 0 Then
  649.             GUICtrlSetBkColor(-1, $farbe3)
  650.         EndIf
  651.     Next
  652.     GUICtrlSetData($statuslabel, "")
  653.     GUICtrlSetState($deckel, $GUI_HIDE)
  654. EndFunc   ;==>_Laden
  655.  
  656. Func _Links_kopieren()
  657.     GUICtrlSetData($statuslabel, "Links werden gespeichert...")
  658.     $anzahl = IniRead(@ScriptDir & "\userdata.ini", "Data " & GUICtrlRead($account_combo), "Dateien", "error")
  659.     Local $aexport[1]
  660.     For $ex = 1 To $anzahl
  661.         If _GUICtrlListView_GetItemChecked ($listview, $ex - 1) = True Then
  662.             $citem = _GUICtrlListView_GetItemTextArray ($listview, $ex - 1)
  663.             _ArrayAdd($aexport, "http://rapidshare.com/files/" & $citem[6] & "/" & $citem[1])
  664.         EndIf
  665.     Next
  666.     ClipPut(_ArrayToString($aexport, @CRLF, 1, UBound($aexport) - 1))
  667.     GUICtrlSetData($statuslabel, "")
  668.     If UBound($aexport) = 1 Then
  669.         MsgBox(64, "Info", "Es wurden keine Links markiert.")
  670.     ElseIf UBound($aexport) = 2 Then
  671.         MsgBox(64, "Info", "1 Link in die Zwischenablage kopiert.")
  672.     Else
  673.         MsgBox(64, "Info", UBound($aexport) - 1 & " Links in die Zwischenablage kopiert.")
  674.     EndIf
  675. EndFunc   ;==>_Links_kopieren
  676.  
  677. ;===============================================================================
  678. ; Function Name:   _RapidPrem_UploadFile
  679. ; Description::    Upload a file with given Login
  680. ; Parameter(s):        $sFilePath:        Path to Uploadfile
  681. ;                $sUsername:        Username
  682. ;                $sPassword:        Password
  683. ;                [$sServer: [optional]    Default Rapidshare Server]
  684. ; Requirement(s):  TCP
  685. ; Return Value(s): Received Header, @extended is Error return from HTTPRecv function
  686. ;            :  False (0) on Failed
  687. ;            : @error codes:
  688. ;            : 1 - couldn't open Internet connection
  689. ;            : 2 - couldn't open url
  690. ;            : 3 - Couldn't connect to rapidshare server on port 80
  691. ;            : 4 - Error by sending string
  692. ;
  693. ; Author(s):       GtaSpider (Modified By Taek)
  694. ;===============================================================================
  695. ;
  696. Func _RapidPrem_UploadFile($sFilePath, $account_name, $sServer = "1")
  697.     GUICtrlSetData($statuslabel, "Starte Upload...")
  698.     Local $sSendString, $sTemp, $sGet, $sAuth, $hSocket
  699.     $get_password = _StringEncrypt(0, IniRead(@ScriptDir & "\userdata.ini", "Login " & $account_name, "Password", ""), "rslogincrypt")
  700.     If IniRead(@ScriptDir & "\userdata.ini", "Login " & $account_name, "Type", "") = "Collector"  Then
  701.         $phrase1 = "username"
  702.         Local $hDll = DllOpen("wininet.dll")
  703.         Local $sUserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1", $hInternet, $hRequest, $iBufferSize = 1024 * 20
  704.         Local $tNumberOfBytesRead = DllStructCreate("dword"), $tBuffer = DllStructCreate("byte[" & $iBufferSize & "]"), $sReadFile, $aRegEx, $aRet[4], $avResult, $iReadBuffer, $iErr
  705.         Local $hInternet = DllCall($hDll, _
  706.                 "ptr", "InternetOpen", _
  707.                 "wstr", $sUserAgent, _
  708.                 "dword", 0, _
  709.                 "ptr", 0, _
  710.                 "ptr", 0, _
  711.                 "dword", 0)
  712.         If @error Then Return SetError(1, 0, 0)
  713.         $hInternet = $hInternet[0]
  714.         Local $hHTTPReq = DllCall($hDll, _
  715.                 "ptr", "InternetOpenUrlW", _
  716.                 "ptr", $hInternet, _
  717.                 "wstr", "https://ssl.rapidshare.com/cgi-bin/collectorszone.cgi?username=" & $account_name & "&password=" & $get_password, _
  718.                 "ptr", 0, _
  719.                 "dword", 0, _
  720.                 "dword", 0, _
  721.                 "ptr", 0)
  722.         If @error Then Return SetError(2, 0, 0)
  723.         $hHTTPReq = $hHTTPReq[0]
  724.         Do
  725.             $tNumberOfBytesRead = DllStructCreate("dword")
  726.             $tBuffer = DllStructCreate("byte[" & $iBufferSize & "]")
  727.             Local $avResult = DllCall($hDll, _
  728.                     "int", "InternetReadFile", _
  729.                     "ptr", $hHTTPReq, _
  730.                     "ptr", DllStructGetPtr($tBuffer), _
  731.                     "dword", $iBufferSize, _
  732.                     "ptr", DllStructGetPtr($tNumberOfBytesRead))
  733.             If @error Or Not $avResult[0] Then ExitLoop
  734.             $iReadBuffer = DllStructGetData($tNumberOfBytesRead, 1)
  735.             $sReadFile &= BinaryToString(BinaryMid(DllStructGetData($tBuffer, 1), 1, $iReadBuffer))
  736.         Until Not $iReadBuffer
  737.         $aRegEx = StringRegExp($sReadFile, '(?s)"post" action="(.*?)" enctype="multipart/form-data"', 3)
  738.         $serverconnection = $aRegEx[0]
  739.         $aRegEx = StringRegExp($sReadFile, 'name="freeaccountid" value="(.*?)"', 3)
  740.         $loginname = $aRegEx[0]
  741.     Else
  742.         $phrase1 = "login"
  743.         $loginname = $account_name
  744.         $serverconnection = "rs" & $sServer & ".rapidshare.com"
  745.     EndIf
  746.     $hSocket = TCPConnect(TCPNameToIP($serverconnection), 80)
  747.     If @error Then Return SetError(3, @error, 0)
  748.  
  749.     $sTemp = @CRLF & _
  750.             "----------" & _GetTime() & @CRLF & _
  751.             'Content-Disposition: form-data; name="toolmode2"' & @CRLF & _
  752.             "" & @CRLF & _
  753.             "1" & @CRLF & _
  754.             "----------" & _GetTime() & @CRLF & _
  755.             'Content-Disposition: form-data; name="filecontent"; filename="' & $sFilePath & '"' & @CRLF & _
  756.             "Content-Type: multipart/form-data" & @CRLF & _
  757.             "Content-Transfer-Encoding: binary" & @CRLF & @CRLF & _
  758.             FileRead($sFilePath) & @CRLF & _
  759.             "----------" & _GetTime() & @CRLF & _
  760.             'Content-Disposition: form-data; name="' & $phrase1 & '"' & @CRLF & _
  761.             "" & @CRLF & _
  762.             $loginname & @CRLF & _
  763.             "----------" & _GetTime() & @CRLF & _
  764.             'Content-Disposition: form-data; name="password"' & @CRLF & _
  765.             "" & @CRLF & _
  766.             $get_password & @CRLF & _
  767.             "----------" & _GetTime() & @CRLF
  768.     $sSendString = "POST /cgi-bin/upload.cgi HTTP/1.0" & @CRLF & _
  769.             "Connection: Keep-Alive" & @CRLF & _
  770.             "Content-Type: multipart/form-data; boundary=--------" & _GetTime() & @CRLF & _
  771.             "Content-Length: " & StringLen($sTemp) - 2 & @CRLF & _
  772.             "Host: " & $serverconnection & @CRLF & _
  773.             "Keep-Alive: 300" & @CRLF & _
  774.             "User-Agent: RapidUploader[v1,2]" & @CRLF & $sTemp
  775.     ClipPut($get_password)
  776.     _HTTPSend($sSendString, $hSocket, Round(StringLen($sTemp) / 100))
  777.     If @error Then Return SetError(4, @error, 0)
  778.     $sRecv = _HTTPRecv($hSocket)
  779.     GUICtrlSetData($statuslabel, "")
  780.     Return SetError(0, @error, $sRecv)
  781. EndFunc   ;==>_RapidPrem_UploadFile
  782.  
  783. Func _timeleft()
  784.     $countfrom = IniRead(@ScriptDir & "\userdata.ini", "Data 4all", "autoupdate", "0") * 60
  785.     $vorbei = Int(TimerDiff($startTimer) / 1000)
  786.     $min = Int(($countfrom - $vorbei) / 60)
  787.     $sec = $countfrom - $vorbei - (60 * $min)
  788.     GUICtrlSetData($auto_update_time, StringFormat('%02u', $min) & ":" & StringFormat('%02u', $sec))
  789. EndFunc   ;==>_timeleft
  790.  
  791. ;RapidDateToCalc (e.g.: Sun, 14. Sep 2008 --> 2008/09/14)
  792. ;by GtaSpider
  793. Func _RapidDateToCalc($sRapidDate)
  794.     Local $aMonthNumberAbbrev[13] = ["", "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"  ]
  795.     $sRapidDate = StringSplit(StringTrimLeft($sRapidDate, StringInStr($sRapidDate, ",") + 1), " ")
  796.     Local $sRet = StringTrimLeft("00", StringLen(StringTrimRight($sRapidDate[1], 1))) & StringTrimRight($sRapidDate[1], 1) & ".", $i
  797.     For $i = 1 To 12
  798.         If $sRapidDate[2] = StringLeft($aMonthNumberAbbrev[$i], 3) Then $sRet &= StringTrimLeft("00", StringLen($i)) & $i & "."
  799.     Next
  800.     $sRet &= $sRapidDate[3]
  801.     Return $sRet
  802. EndFunc   ;==>_RapidDateToCalc
  803.  
  804. ;HTTP Send
  805. ;by GtaSpider
  806. Func _HTTPSend($sSendString, $hSocket, $iBufferSize = 2904)
  807.     Local $sBuffer = $sSendString, $iProz
  808.     If $iBufferSize < 1024 Then $iBufferSize = 1024
  809.     While StringLen($sBuffer)
  810.         $iSend = 0
  811.         If $iBufferSize >= StringLen($sBuffer) Then $iBufferSize = StringLen($sBuffer) + 2
  812.         While $iSend < $iBufferSize
  813.             $iSend += TCPSend($hSocket, StringLeft($sBuffer, $iBufferSize))
  814.             If @error Then ExitLoop 2
  815.         WEnd
  816.         $sBuffer = StringTrimLeft($sBuffer, $iBufferSize)
  817.         $iProz = Round(100 - (100 * StringLen($sBuffer) / StringLen($sSendString)))
  818.         GUICtrlSetData($hProg_Downl, $iProz)
  819.         GUICtrlSetData($hLab_DownlPrz, $iProz & "%")
  820.     WEnd
  821. EndFunc   ;==>_HTTPSend
  822.  
  823. ;HTML Recv
  824. ;by GtaSpider
  825. Func _HTTPRecv($hSocket, $iSleep = 50, $iTimeOut = 20000, $sDwn = False, $iForceBinary = 0, $iBufferSize = 1024)
  826.     Local $sRecv, $sRet, $iErr = 0, $hTi, $hFiOp, $sFirstRecv, $iLen = 0, $iFirst = True
  827.     If $iTimeOut > 0 Then $hTi = TimerInit()
  828.     If $sDwn Then $hFiOp = FileOpen($sDwn, 17)
  829.     If $hFiOp = -1 Then $bExist = False
  830.     While 1
  831.         If $iTimeOut > 0 And TimerDiff($hTi) > $iTimeOut Then ExitLoop
  832.         $sRecv = TCPRecv($hSocket, $iBufferSize, $iForceBinary)
  833.         $iErr = @error
  834.         If $iErr Then ExitLoop
  835.         If $sDwn And (Not $bDownloadActive) Then ExitLoop
  836.         While StringLen($sRecv)
  837.             If $iForceBinary Then $sRecv = BinaryToString($sRecv)
  838.             If $iFirst Then
  839.                 If Not StringInStr($sRecv, "HTTP/1.1 200 OK") Then
  840.                     TCPCloseSocket($hSocket)
  841.                     If $sDwn And $bExist Then FileClose($hFiOp)
  842.                     Return SetError(1, 1, "ERR:" & $sRecv)
  843.                 EndIf
  844.                 $sFirstRecv = $sRecv
  845.                 If $sDwn Then $sRecv = StringTrimLeft($sRecv, StringInStr($sRecv, @CRLF & @CRLF) + 4)
  846.                 $iFirst = False
  847.             EndIf
  848.             If $sDwn Then
  849.                 $iLen += StringLen($sRecv)
  850.                 If $bExist Then FileWrite($hFiOp, $sRecv)
  851.                 Call("__SetProgress", $sFirstRecv, $iLen)
  852.             EndIf
  853.             If Not $sDwn Then $sRet &= $sRecv
  854.             $sRecv = TCPRecv($hSocket, $iBufferSize, $iForceBinary)
  855.             $iErr = @error
  856.             If $iErr Then ExitLoop 2
  857.             If $iTimeOut > 0 And TimerDiff($hTi) > $iTimeOut Then ExitLoop 2
  858.             If $sDwn And (Not $bDownloadActive) Then ExitLoop 2
  859.         WEnd
  860.         Sleep($iSleep)
  861.     WEnd
  862.     TCPCloseSocket($hSocket)
  863.     If $sDwn And $bExist Then FileClose($hFiOp)
  864.     If $iForceBinary Then $sRet = "0x" & StringReplace($sRet, "0x", "")
  865.     If $iTimeOut > 0 And TimerDiff($hTi) > $iTimeOut Then Return SetError(2, 0, "Timeout")
  866.     If $iErr Then Return SetError(3, $iErr, $sRet)
  867.     If Not $bDownloadActive Then Return SetError(4, 0, 0)
  868.     Return $sRet
  869. EndFunc   ;==>_HTTPRecv
  870.  
  871. ;Function for Download to show a progress
  872. ;by GtaSpider
  873. Func __SetProgress($sRecv, $iLen)
  874.     Local $aRegEx, $iProz
  875.     $aRegEx = StringRegExp($sRecv, "(?s)(.*?Content-Length: (.*?)" & @CRLF & @CRLF & ")", 3)
  876.     If UBound($aRegEx) < 2 Then Return GUICtrlSetData($hLab_DownlPrz, "?")
  877.     $iProz = Round(100 * $iLen / $aRegEx[1])
  878.     If GUICtrlRead($hLab_DownlPrz) = $iProz & "%"  Then Return 0
  879.     GUICtrlSetData($hProg_Downl, $iProz)
  880.     GUICtrlSetData($hLab_DownlPrz, $iProz & "%")
  881. EndFunc   ;==>__SetProgress
  882.  
  883. ;GetTime
  884. ;by GtaSpider
  885. Func _GetTime()
  886.     Return @MON & @MDAY & StringRight(@YEAR, 2) & @HOUR & @MIN & @SEC & "044"          ;Eigentlich MSec aber warte auf naecchste Stable
  887. EndFunc   ;==>_GetTime
  888.  
  889. #cs
  890.     Func On_WM_DROPFILES($hWnd, $msg, $wParam, $lParam)
  891.     Local $tDrop, $aRet, $iCount
  892.     ;string buffer for file path
  893.     $tDrop = DllStructCreate("char[260]")
  894.     ;get file count
  895.     $aRet = DllCall("shell32.dll", "int", "DragQueryFile", _
  896.     "hwnd", $wParam, _
  897.     "uint", -1, _
  898.     "ptr", DllStructGetPtr($tDrop), _
  899.     "int", DllStructGetSize($tDrop) _
  900.     )
  901.     $iCount = $aRet[0]
  902.     ;get file paths
  903.     For $i = 0 To $iCount - 1
  904.     $aRet = DllCall("shell32.dll", "int", "DragQueryFile", _
  905.     "hwnd", $wParam, _
  906.     "uint", $i, _
  907.     "ptr", DllStructGetPtr($tDrop), _
  908.     "int", DllStructGetSize($tDrop) _
  909.     )
  910.     $pfad_uebergabe = DllStructGetData($tDrop, 1)
  911.     _GUICtrlListView_BeginUpdate($uploadqueue)
  912.     If StringInStr(StringRight($pfad_uebergabe, 4), ".") Then GUICtrlCreateListViewItem($pfad_uebergabe, $uploadqueue) ;Dateiname dem ListView hinzufügen
  913.     _GUICtrlListView_EndUpdate($uploadqueue)
  914.     Next
  915.     ;finalize
  916.     DllCall("shell32.dll", "int", "DragFinish", "hwnd", $wParam)
  917.     Return
  918.     EndFunc   ;==>On_WM_DROPFILES
  919.  
  920.     Func OnAutoItExit()
  921.     _GUICtrlListView_UnRegisterSortCallBack($listview)
  922.     TCPShutdown()
  923.     EndFunc   ;==>OnAutoItExit
  924. #ce
Advertisement
Add Comment
Please, Sign In to add comment