Func _CurrentUSBWiiflowURL($SaveCurrentUSBWiiflow, $CurrentUSBWiiflowState, $CurrentUSBWiiflow_ListN = -1)
$startGeneratetime = _Timer_Init()
Local $CurrentUSBWiiflowSize = 0, $ReturnCurrentUSBWiiflowURL = ""
FileDelete(@TempDir & "\USBWiiflowupdate.xml")
Local $hDownload = InetGet("http://code.google.com/p/open-wiiflow-mod/downloads/list", @TempDir & "\USBWiiflowupdate.xml", 1, 1) ;Download Header
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
$GetCurrentUSBWiiflowURL = FileRead(@TempDir & "\USBWiiflowupdate.xml")
FileClose($GetCurrentUSBWiiflowURL)
FileDelete(@TempDir & "\USBWiiflowupdate.xml") ;Clean
$StringCurrentUSBWiiflowVersion = _splitInfo($GetCurrentUSBWiiflowURL, 'open\-wiiflow\-mod\.googlecode\.com\/files\/Wiiflow\_Mod([^*]*?)\.zip', 1)
$StringCurrentUSBWiiflowPlugin = _splitInfo($GetCurrentUSBWiiflowURL, 'open\-wiiflow\-mod\.googlecode\.com\/files\/Wiiflow\_Plugins([^*]*?)\"', 1)
$UpdateUSBWiiflowURL = "http://open-wiiflow-mod.googlecode.com/files/Wiiflow_Mod" & $StringCurrentUSBWiiflowVersion & ".zip"
$UpdateUSBWiiflowPluginURL = "http://open-wiiflow-mod.googlecode.com/files/Wiiflow_Plugins" & $StringCurrentUSBWiiflowPlugin
FileDelete(@TempDir & "\SHA1ChecksumURL")
Local $hDownload = InetGet("http://code.google.com/p/open-wiiflow-mod/downloads/detail?name=" & StringRegExpReplace($UpdateUSBWiiflowURL, "^.*/(.*)$", "$1"), @TempDir & "\SHA1ChecksumURL", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
$GetSHA1ChecksumURL = FileRead(@TempDir & "\SHA1ChecksumURL")
FileClose($GetSHA1ChecksumURL)
FileDelete(@TempDir & "\SHA1ChecksumURL") ;Clean
$StringSHA1ChecksumURL = _splitInfo($GetSHA1ChecksumURL, "SHA1 Checksum\: ([^*]*?)What\'s this\?", 1)
$StringSHA1Checksum = _splitInfo($StringSHA1ChecksumURL, "\> ([^*]*?) \<", 1)
$UpdateUSBWiiflowRelease = StringRegExpReplace($StringCurrentUSBWiiflowVersion, "_|svn", "")
FileDelete(@TempDir & "\SHA1ChecksumURL")
Local $hDownload = InetGet("http://code.google.com/p/open-wiiflow-mod/downloads/detail?name=" & StringRegExpReplace($UpdateUSBWiiflowPluginURL, "^.*/(.*)$", "$1"), @TempDir & "\SHA1ChecksumURL", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
$GetPluginSHA1ChecksumURL = FileRead(@TempDir & "\SHA1ChecksumURL")
FileClose($GetPluginSHA1ChecksumURL)
FileDelete(@TempDir & "\SHA1ChecksumURL") ;Clean
$StringPluginSHA1ChecksumURL = _splitInfo($GetPluginSHA1ChecksumURL, "SHA1 Checksum\: ([^*]*?)What\'s this\?", 1)
$StringPluginSHA1Checksum = _splitInfo($StringPluginSHA1ChecksumURL, "\> ([^*]*?) \<", 1)
ConsoleWrite(@LF & _
"- Release : " & $UpdateUSBWiiflowRelease & @LF & _
"- URL : " & $UpdateUSBWiiflowURL & @LF & _
"- USBWiiflow SHA1 Checksum : " & $StringSHA1Checksum & @LF & _
"- Plugin URL : " & $UpdateUSBWiiflowPluginURL & @LF & _
"- Plugin SHA1 Checksum : " & $StringPluginSHA1Checksum & @LF)
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\Languages")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\boxcovers")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\covers")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\trailers")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\fanart")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\help")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\settings")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\themes")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\plugins")
$SplitCurrentUSBWiiflow = StringSplit("arab.ini|brazilian.ini|chinese_s.ini|chinese_t.ini|danish.ini|dutch.ini|english.ini|finnish.ini|" & _
"french.ini|gallego.ini|german.ini|hungarian.ini|italian.ini|japanese.ini|norwegian.ini|" & _
"polish.ini|portuguese.ini|russian.ini|spanish.ini|swedish.ini|tagalog.ini|turkish.ini", "|")
For $ilWiiflow = 1 To $SplitCurrentUSBWiiflow[0]
Local $hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/Languages/" & $SplitCurrentUSBWiiflow[$ilWiiflow], 3)
Local $hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/Languages/" & $SplitCurrentUSBWiiflow[$ilWiiflow], _
$SaveCurrentUSBWiiflow & "\Wiiflow\Languages\" & $SplitCurrentUSBWiiflow[$ilWiiflow], 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " " & $SplitCurrentUSBWiiflow[$ilWiiflow] & " | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\Languages\" & $SplitCurrentUSBWiiflow[$ilWiiflow])
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\Languages\" & $SplitCurrentUSBWiiflow[$ilWiiflow]))
Next
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/fanart/GAMEID.ini")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/fanart/GAMEID.ini", _
$SaveCurrentUSBWiiflow & "\Wiiflow\fanart\GAMEID.ini", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (fanart : GAMEID.ini) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\fanart\GAMEID.ini"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\fanart\GAMEID.ini")
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/help/english.txt")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/help/english.txt", _
$SaveCurrentUSBWiiflow & "\Wiiflow\help\english.txt", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (help : english.txt) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\help\english.txt"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\help\english.txt")
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/settings/gameconfig1.ini")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/settings/gameconfig1.ini", _
$SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig1.ini", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (settings : gameconfig1.ini) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig1.ini"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig1.ini")
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/settings/gameconfig2.ini")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/settings/gameconfig2.ini", _
$SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig2.ini", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (settings : gameconfig2.ini) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig2.ini"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig2.ini")
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/themes/default.ini")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/themes/default.ini", _
$SaveCurrentUSBWiiflow & "\Wiiflow\themes\default.ini", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (themes : default.ini) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\themes\default.ini"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\themes\default.ini")
$SplitTitleCurrentUSBWiiflow = StringSplit("EN|FR|DE|ES|IT|NL|PT|US|JA|KO|ZH", "|")
For $iTWiiflow = 1 To $SplitTitleCurrentUSBWiiflow[0]
$hDownloadSize = InetGetSize("http://www.gametdb.com/titles.txt?LANG=" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow])
$hDownload = InetGet("http://www.gametdb.com/titles.txt?LANG=" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow], _
$SaveCurrentUSBWiiflow & "\Wiiflow\settings\" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow] & "custom_titles.ini", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " " & $SplitTitleCurrentUSBWiiflow[$iTWiiflow] & "custom_titles.ini | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow] & "custom_titles.ini"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow] & "custom_titles.ini")
If $SplitTitleCurrentUSBWiiflow[$iTWiiflow] = "EN" Then _
FileCopy($SaveCurrentUSBWiiflow & "\Wiiflow\settings\" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow] & "custom_titles.ini", $SaveCurrentUSBWiiflow & "\Wiiflow\settings\custom_titles.ini", 9)
Next
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Boot.dol | " & $UpdateUSBWiiflowURL)
$DownloadCurrentUSBWiiflowSize = InetGetSize($UpdateUSBWiiflowURL)
$DownloadCurrentUSBWiiflow = InetGet($UpdateUSBWiiflowURL, $SaveCurrentUSBWiiflow & "\" & StringRegExpReplace($UpdateUSBWiiflowURL, "^.*/(.*)$", "$1"), 1, 1)
$CurrentUSBWiiflowSize += $DownloadCurrentUSBWiiflowSize
Do
$aInfo = InetGetInfo($DownloadCurrentUSBWiiflow)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $DownloadCurrentUSBWiiflowSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then
_GUICtrlListView_SetItemText($HomebrewListView, $CurrentUSBWiiflow_ListN, $iPercent & "%", 4)
GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
EndIf
Sleep(250)
Until $aInfo[2]
InetClose($DownloadCurrentUSBWiiflow)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\" & StringRegExpReplace($UpdateUSBWiiflowURL, "^.*/(.*)$", "$1")))
GUICtrlSetData($CurrentUSBWiiflowState, "Successfully Downloaded | SHA1 Checksum: " & $StringSHA1Checksum)
Local $sReadSHA1 = $SaveCurrentUSBWiiflow & "\" & StringRegExpReplace($UpdateUSBWiiflowURL, "^.*/(.*)$", "$1")
If StringStripWS($sReadSHA1, 8) <> "" And FileExists($sReadSHA1) Then
Local $bHash = _Crypt_HashFile($sReadSHA1, $CALG_SHA1)
ConsoleWrite("- Found USBWiiflow SHA1 Checksum: " & $bHash & @CRLF & "- Inter USBWiiflow SHA1 Checksum: 0x" & $StringSHA1Checksum)
If $bHash = "0x" & $StringSHA1Checksum Then
$ReturnCurrentUSBWiiflowURL = "Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Successfully Downloaded and verified | SHA1 Checksum: " & $StringSHA1Checksum & " | " & _
StringFormat("%.2f", Round(_Timer_Diff($startGeneratetime) / 1000, 2)) & " Seconds"
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
_UnZip_Init("_UnZIP_PrintFunc", "UnZIP_ReplaceFunc", "_UnZIP_PasswordFunc", "_UnZIP_SendAppMsgFunc", "_UnZIP_ServiceFunc")
_UnZIP_SetOptions()
_UnZIP_Unzip($sReadSHA1, $SaveCurrentUSBWiiflow)
If @error Then
GUICtrlSetState($MainTab, $GUI_DISABLE)
$ReturnCurrentUSBWiiflowURL = "Error! (Wiiflow Mod " & $UpdateUSBWiiflowRelease & ") Archive unpacking error!"
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
MsgBox(16, "Error! (Wiiflow Mod " & $UpdateUSBWiiflowRelease & ")", "Archive unpacking error!" & @CRLF & $sReadSHA1, Default, $Gui)
GUICtrlSetState($MainTab, $GUI_ENABLE)
Else
$ReturnCurrentUSBWiiflowURL = "Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Successfully Downloaded and verified | SHA1 Checksum: " & $StringSHA1Checksum & " | " & _
StringFormat("%.2f", Round(_Timer_Diff($startGeneratetime) / 1000, 2)) & " Seconds"
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
FileDelete($sReadSHA1)
EndIf
Else
$ReturnCurrentUSBWiiflowURL = "Wiiflow Mod " & $UpdateUSBWiiflowRelease & " already exists but it failed SHA1 verification. | SHA1 Checksum: " & $StringSHA1Checksum
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
EndIf
Else
$ReturnCurrentUSBWiiflowURL = "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Failed ! | SHA1 Checksum: " & $StringSHA1Checksum
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
EndIf
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Plugins | " & $UpdateUSBWiiflowURL)
$DownloadCurrentUSBWiiflowSizePlugin = InetGetSize($UpdateUSBWiiflowPluginURL)
$DownloadCurrentUSBWiiflowPlugin = InetGet($UpdateUSBWiiflowPluginURL, $SaveCurrentUSBWiiflow & "\" & StringRegExpReplace($UpdateUSBWiiflowPluginURL, "^.*/(.*)$", "$1"), 1, 1)
$CurrentUSBWiiflowSize += $DownloadCurrentUSBWiiflowSizePlugin
Do
$aInfo = InetGetInfo($DownloadCurrentUSBWiiflowPlugin)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $DownloadCurrentUSBWiiflowSizePlugin * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Plugins | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then
_GUICtrlListView_SetItemText($HomebrewListView, $CurrentUSBWiiflow_ListN, $iPercent & "%", 4)
GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
EndIf
Sleep(250)
Until $aInfo[2]
InetClose($DownloadCurrentUSBWiiflowPlugin)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\" & StringRegExpReplace($UpdateUSBWiiflowPluginURL, "^.*/(.*)$", "$1")))
GUICtrlSetData($CurrentUSBWiiflowState, "Successfully Downloaded | SHA1 Checksum: " & $StringPluginSHA1Checksum)
Local $sReadSHA1 = $SaveCurrentUSBWiiflow & "\" & StringRegExpReplace($UpdateUSBWiiflowPluginURL, "^.*/(.*)$", "$1")
If StringStripWS($sReadSHA1, 8) <> "" And FileExists($sReadSHA1) Then
Local $bHash = _Crypt_HashFile($sReadSHA1, $CALG_SHA1)
ConsoleWrite("- Found plugins SHA1 Checksum: " & $bHash & @CRLF & "- Inter plugins SHA1 Checksum: 0x" & $StringPluginSHA1Checksum)
If $bHash = "0x" & $StringPluginSHA1Checksum Then
$ReturnCurrentUSBWiiflowURL = "Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Plugins Successfully Downloaded and verified | SHA1 Checksum: " & $StringPluginSHA1Checksum & " | " & _
StringFormat("%.2f", Round(_Timer_Diff($startGeneratetime) / 1000, 2)) & " Seconds"
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
If StringRight($sReadSHA1, 2) = "ip" Then
_UnZip_Init("_UnZIP_PrintFunc", "UnZIP_ReplaceFunc", "_UnZIP_PasswordFunc", "_UnZIP_SendAppMsgFunc", "_UnZIP_ServiceFunc")
_UnZIP_SetOptions()
_UnZIP_Unzip($sReadSHA1, $SaveCurrentUSBWiiflow & "\Wiiflow\plugins\")
ElseIf StringRight($sReadSHA1, 2) = "7z" Then
_7ZIPExtract(0, $sReadSHA1, $SaveCurrentUSBWiiflow & "\Wiiflow\plugins\", 1, 0)
EndIf
If @error Then
GUICtrlSetState($MainTab, $GUI_DISABLE)
$ReturnCurrentUSBWiiflowURL = "Error! (Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Plugins) Archive unpacking error!"
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
MsgBox(16, "Error! (Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Plugins)", "Archive unpacking error!" & @CRLF & $sReadSHA1, Default, $Gui)
GUICtrlSetState($MainTab, $GUI_ENABLE)
Else
$ReturnCurrentUSBWiiflowURL = "Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Plugins Successfully Downloaded and verified | SHA1 Checksum: " & $StringPluginSHA1Checksum & " | " & _
StringFormat("%.2f", Round(_Timer_Diff($startGeneratetime) / 1000, 2)) & " Seconds"
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
FileDelete($sReadSHA1)
EndIf
Else
$ReturnCurrentUSBWiiflowURL = "Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Plugins already exists but it failed SHA1 verification. | SHA1 Checksum: " & $StringPluginSHA1Checksum
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
EndIf
Else
$ReturnCurrentUSBWiiflowURL = "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Plugins Failed ! | SHA1 Checksum: " & $StringSHA1Checksum
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
EndIf
IniWrite($HomebrewINI, "Wiiflowboot.dol", "1", $UpdateUSBWiiflowURL & "|" & $CurrentUSBWiiflowSize & "|0x" & $StringSHA1Checksum)
IniWrite($HomebrewINI, "Wiiflowboot.dol", "3", $UpdateUSBWiiflowRelease)
Return $ReturnCurrentUSBWiiflowURL
EndFunc ;==>_CurrentUSBWiiflowURL