Skip to content

Commit

Permalink
Fixed DGCA plugin installation
Browse files Browse the repository at this point in the history
Closes Bioruebe#68

Added option to send usage statistics
Fixed FFmpeg update
Removed option to toggle support for game packages from settings GUI
  • Loading branch information
Bioruebe committed Mar 1, 2018
1 parent 5a30333 commit f208120
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 27 deletions.
2 changes: 2 additions & 0 deletions English.ini
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ PREFS_FEEDBACK_PROMPT_TOOLTIP = "With this option enabled a prompt for feedback
PREFS_WINDOW_POSITION_LABEL = "Store window position"
PREFS_CHECK_GAME_LABEL = "Support for game packages"
PREFS_CHECK_GAME_TOOLTIP = "Activates support for many game archives.%nIn some cases this could lead to an increased scan time.%nIf you do not plan on extracting such files, you can safely disable this option."
PREFS_SEND_STATS_LABEL = "Send anonymous usage statistics"
PREFS_SEND_STATS_TOOLTIP = "Automatically send statistics (which type of files - e.g. zip - you extract most, which options you set, a random user ID;%nno file names or information, that could be used to identify you are collected). This helps to identify the most used%nfeatures of %name and focus development on improving them."
PREFS_LOG_LABEL = "Create log files"
PREFS_VIDEOTRACK_LABEL = "Extract video tracks"
PREFS_VIDEOTRACK_TOOLTIP = "If deactivated, video tracks are ignored when extracting from video files.%nThis is useful if you only need the audio track(s) and want to save disk space and time."
Expand Down
56 changes: 35 additions & 21 deletions UniExtract.au3
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#AutoIt3Wrapper_Outfile=.\UniExtract.exe
#AutoIt3Wrapper_Res_Comment=Compiled with AutoIt http://www.autoitscript.com/
#AutoIt3Wrapper_Res_Description=Universal Extractor
#AutoIt3Wrapper_Res_Fileversion=2.0.0.0
#AutoIt3Wrapper_Res_Fileversion=2.0.0
#AutoIt3Wrapper_Res_LegalCopyright=GNU General Public License v2
#AutoIt3Wrapper_Res_Field=Author|Jared Breland <[email protected]>
#AutoIt3Wrapper_Res_Field=Homepage|http://www.legroom.net/software
Expand Down Expand Up @@ -66,7 +66,8 @@ Const $websiteGithub = "https://github.com/Bioruebe/UniExtract2"
Const $sUpdateURL = "https://update.bioruebe.com/uniextract/data/"
Const $sLegacyUpdateURL = "https://update.bioruebe.com/uniextract/update2.php"
Const $sGetLinkURL = "https://update.bioruebe.com/uniextract/geturl.php?q="
Const $supportURL = "https://support.bioruebe.com/uniextract/upload.php"
Const $sSupportURL = "https://support.bioruebe.com/uniextract/upload.php"
Const $sStatsURL = "https://stat.bioruebe.com/uniextract/stats.php?a="
Const $bindir = @ScriptDir & "\bin\"
Const $langdir = @ScriptDir & "\lang\"
Const $defdir = @ScriptDir & "\def\"
Expand Down Expand Up @@ -117,6 +118,7 @@ Global $FB_ask = 0
Global $Opt_ConsoleOutput = 0
Global $Log = 0
Global $CheckGame = 1
Global $bSendStats = 1
Global $iCleanup = $OPTION_MOVE
Global $KeepOutdir = 0
Global $KeepOpen = 0
Expand Down Expand Up @@ -642,6 +644,7 @@ Func ReadPrefs()
LoadPref("feedbackprompt", $FB_ask)
LoadPref("log", $Log)
LoadPref("checkgame", $CheckGame)
LoadPref("sendstats", $bSendStats)
LoadPref("extract", $extract)
LoadPref("unicodecheck", $checkUnicode)
LoadPref("extractvideotrack", $bExtractVideo)
Expand Down Expand Up @@ -695,12 +698,13 @@ Func WritePrefs()
SavePref('consoleoutput', $Opt_ConsoleOutput)
SavePref('log', $Log)
SavePref('checkgame', $CheckGame)
SavePref('sendstats', $bSendStats)
SavePref("extractvideotrack", $bExtractVideo)
SavePref('storeguiposition', $StoreGUIPosition)
SavePref('timeout', $Timeout / 1000)
SavePref('updateinterval', $updateinterval)
SavePref("topmost", Number($iTopmost > 0))
EndFunc ;==>WritePrefs
EndFunc

; Save single preference
Func SavePref($name, $value)
Expand Down Expand Up @@ -3477,8 +3481,8 @@ Func _FileRead($f, $delete = False, $iFlag = 0)
EndFunc

; Handle program termination with appropriate error message
Func terminate($status, $fname = '', $ID = '')
Local $LogFile = 0, $exitcode = 0, $shortStatus = ($status = $STATUS_SUCCESS)? $ID: $status
Func terminate($status, $fname = '', $sFileType = '')
Local $LogFile = 0, $exitcode = 0, $shortStatus = ($status = $STATUS_SUCCESS)? $sFileType: $status

; Rename unicode file
If $iUnicodeMode Then
Expand Down Expand Up @@ -3507,7 +3511,7 @@ Func terminate($status, $fname = '', $ID = '')

; Save statistics
IniWrite($prefs, "Statistics", $status, Number(IniRead($prefs, "Statistics", $status, 0)) + 1)
If $status = $STATUS_SUCCESS Then IniWrite($prefs, "Statistics", $ID, Number(IniRead($prefs, "Statistics", $ID, 0)) + 1)
If $status = $STATUS_SUCCESS Then IniWrite($prefs, "Statistics", $sFileType, Number(IniRead($prefs, "Statistics", $sFileType, 0)) + 1)

; Remove singleton
If $hMutex <> 0 Then DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hMutex)
Expand All @@ -3533,7 +3537,7 @@ Func terminate($status, $fname = '', $ID = '')
$syntax &= t('HELP_EXAMPLE1')
$syntax &= t('HELP_EXAMPLE2', @ScriptName)
$syntax &= t('HELP_NOARGS')
MsgBox($iTopmost + 32, $title, $syntax, $ID? 15: 0)
MsgBox($iTopmost + 32, $title, $syntax, $sFileType? 15: 0)

; Display file type information and exit
Case $STATUS_FILEINFO
Expand Down Expand Up @@ -3569,7 +3573,7 @@ Func terminate($status, $fname = '', $ID = '')
Prompt(16, 'NOT_SUPPORTED', CreateArray($file, $filetype), 0)
$exitcode = 7
Case $STATUS_MISSINGEXE
Prompt(48, 'MISSING_EXE', CreateArray($file, $ID))
Prompt(48, 'MISSING_EXE', CreateArray($file, $sFileType))
$exitcode = 8
Case $STATUS_TIMEOUT
Prompt(48, 'EXTRACT_TIMEOUT', $file)
Expand All @@ -3586,7 +3590,7 @@ Func terminate($status, $fname = '', $ID = '')

; Display failed attempt information and exit
Case $STATUS_FAILED
If Not $silentmode And Prompt(256 + 16 + 4, 'EXTRACT_FAILED', CreateArray($file, $ID), 0) Then ShellExecute($LogFile? $LogFile: CreateLog($status))
If Not $silentmode And Prompt(256 + 16 + 4, 'EXTRACT_FAILED', CreateArray($file, $sFileType), 0) Then ShellExecute($LogFile? $LogFile: CreateLog($status))
$exitcode = 1

; Exit successfully
Expand All @@ -3602,7 +3606,7 @@ Func terminate($status, $fname = '', $ID = '')
; Write error log if in batchmode
If $exitcode <> 0 And $silentmode And $extract Then
$handle = FileOpen($logdir & "errorlog.txt", 8 + 1)
FileWrite($handle, ($filename = ""? $fname: $filenamefull) & " (" & StringUpper($status) & ")" & @CRLF & @TAB & $ID & @CRLF)
FileWrite($handle, ($filename = ""? $fname: $filenamefull) & " (" & StringUpper($status) & ")" & @CRLF & @TAB & $sFileType & @CRLF)
FileClose($handle)
EndIf

Expand All @@ -3629,7 +3633,10 @@ Func terminate($status, $fname = '', $ID = '')
EndIf

; Check for updates
If Not $silentmode And $status <> $STATUS_SILENT Then CheckUpdate(True, True)
If $status <> $STATUS_SILENT Then
If Not $silentmode Then CheckUpdate(True, True)
SendStats($status, $sFileType)
EndIf

Exit $exitcode
EndFunc
Expand Down Expand Up @@ -4442,6 +4449,14 @@ Func OpenURL($sURL, $hParent = 0)
If @error Then InputBox($title, t('OPEN_URL_FAILED'), $sURL, "", -1, -1, Default, Default, 0, $hParent)
EndFunc

; Send usage statistics if enabled in options
Func SendStats($a, $sResult = 1)
If Not $bSendStats Then Return

Cout($sStatsURL & $a & "&r=" & $sResult & "&id=" & $ID)
InetRead($sStatsURL & $a & "&r=" & $sResult & "&id=" & $ID, 1)
EndFunc

; Check for new version
; $silent is used for automatic update check, supressing any error and 'no update found' messages
Func CheckUpdate($silent = False, $bCheckInterval = False, $iMode = $UPDATE_ALL)
Expand Down Expand Up @@ -4581,8 +4596,7 @@ Func _UpdateFFmpeg()
; Download new
If $return > $version[0] Then
Cout("Found an update for FFmpeg")
If Prompt(48 + 4, 'UPDATE_PROMPT', CreateArray("FFmpeg", $version[0], $return, ""), 0) Then GetFFmpeg()
Return True
If Prompt(48 + 4, 'UPDATE_PROMPT', CreateArray("FFmpeg", $version[0], $return, ""), 0) Then Return GetFFmpeg()
EndIf

Return False
Expand Down Expand Up @@ -5043,7 +5057,7 @@ Func GUI_Prefs()
Global $OpenOutDirOpt = GUICtrlCreateCheckbox(t('PREFS_OPEN_FOLDER_LABEL'), 10, 265, -1, 20)
Global $FeedbackPromptOpt = GUICtrlCreateCheckbox(t('PREFS_FEEDBACK_PROMPT_LABEL'), 10, 285, -1, 20)
Global $StoreGUIPositionOpt = GUICtrlCreateCheckbox(t('PREFS_WINDOW_POSITION_LABEL'), 10, 305, -1, 20)
Global $CheckGameOpt = GUICtrlCreateCheckbox(t('PREFS_CHECK_GAME_LABEL'), 10, 325, -1, 20)
Global $UsageStatsOpt = GUICtrlCreateCheckbox(t('PREFS_SEND_STATS_LABEL'), 10, 325, -1, 20)
Global $LogOpt = GUICtrlCreateCheckbox(t('PREFS_LOG_LABEL'), 10, 345, -1, 20)
Global $VideoTrackOpt = GUICtrlCreateCheckbox(t('PREFS_VIDEOTRACK_LABEL'), 10, 365, -1, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Expand All @@ -5066,7 +5080,7 @@ Func GUI_Prefs()
GUICtrlSetTip($appendextopt, t('PREFS_APPEND_EXT_TOOLTIP'))
GUICtrlSetTip($GameModeOpt, t('PREFS_HIDE_STATUS_FULLSCREEN_TOOLTIP'))
GUICtrlSetTip($FeedbackPromptOpt, t('PREFS_FEEDBACK_PROMPT_TOOLTIP'))
GUICtrlSetTip($CheckGameOpt, t('PREFS_CHECK_GAME_TOOLTIP'))
GUICtrlSetTip($UsageStatsOpt, t('PREFS_SEND_STATS_TOOLTIP'))
GUICtrlSetTip($VideoTrackOpt, t('PREFS_VIDEOTRACK_TOOLTIP'))
GUICtrlSetTip($DeleteOrigFileOpt[$OPTION_ASK], t('PREFS_SOURCE_FILES_OPT_KEEP_TOOLTIP'))

Expand All @@ -5082,7 +5096,7 @@ Func GUI_Prefs()
If $OpenOutDir Then GUICtrlSetState($OpenOutDirOpt, $GUI_CHECKED)
If $FB_ask Then GUICtrlSetState($FeedbackPromptOpt, $GUI_CHECKED)
If $StoreGUIPosition Then GUICtrlSetState($StoreGUIPositionOpt, $GUI_CHECKED)
If $CheckGame Then GUICtrlSetState($CheckGameOpt, $GUI_CHECKED)
If $bSendStats Then GUICtrlSetState($UsageStatsOpt, $GUI_CHECKED)
If $Log Then GUICtrlSetState($LogOpt, $GUI_CHECKED)
If $bExtractVideo Then GUICtrlSetState($VideoTrackOpt, $GUI_CHECKED)
GUICtrlSetState($DeleteOrigFileOpt[$iDeleteOrigFile], $GUI_CHECKED)
Expand All @@ -5106,7 +5120,7 @@ EndFunc ;==>GUI_Prefs_Exit

; Exit preferences GUI if OK clicked
Func GUI_Prefs_OK()
; universal preferences
; Universal preferences
$redrawgui = False

If GUICtrlRead($historyopt) == $GUI_CHECKED Then
Expand All @@ -5130,7 +5144,7 @@ Func GUI_Prefs_OK()

If $updateinterval <> GUICtrlRead($IntervalCont) Then $updateinterval = GUICtrlRead($IntervalCont)

; format-specific preferences
; Format-specific preferences
If GUICtrlRead($NoBoxOpt) == $GUI_CHECKED Then
$NoBox = 1
TrayItemSetState($Tray_Statusbox, $TRAY_CHECKED)
Expand All @@ -5149,7 +5163,7 @@ Func GUI_Prefs_OK()
$Log = Number(GUICtrlRead($LogOpt) == $GUI_CHECKED)
$bExtractVideo = Number(GUICtrlRead($VideoTrackOpt) == $GUI_CHECKED)
$StoreGUIPosition = Number(GUICtrlRead($StoreGUIPositionOpt) == $GUI_CHECKED)
$CheckGame = Number(GUICtrlRead($CheckGameOpt) == $GUI_CHECKED)
$bSendStats = Number(GUICtrlRead($UsageStatsOpt) == $GUI_CHECKED)

For $i = 0 To 2
If GUICtrlRead($DeleteOrigFileOpt[$i]) == $GUI_CHECKED Then $iDeleteOrigFile = $i
Expand Down Expand Up @@ -5458,7 +5472,7 @@ Func GUI_Feedback_Send($FB_Type, $FB_Sys, $FB_File, $FB_Output, $FB_Message, $FB
Const $boundary = "--UniExtractLog"

$http = ObjCreate("winhttp.winhttprequest.5.1")
$http.Open("POST", $supportURL, False)
$http.Open("POST", $sSupportURL, False)
$http.SetRequestHeader("Content-Type", "multipart/form-data; boundary=" & StringTrimLeft($boundary, 2))

Local $Data = $boundary & @CRLF & 'Content-Disposition: form-data; name="file"; filename="UE_Feedback"' & @CRLF & 'Content-Type: text/plain' & @CRLF & @CRLF & $FB_Text & @CRLF & $boundary & @CRLF & 'Content-Disposition: form-data; name="id"' & @CRLF & @CRLF & $ID & @CRLF & $boundary & '--'
Expand Down Expand Up @@ -6015,7 +6029,7 @@ Func GUI_Plugins()
; Determine filetype
$ret = StringRight($return, 3)
If $ret = ".7z" Or $ret = "rar" Or $ret = "zip" Then ; Unpack archive
Local $command = $cmd & $7z & ' x' & ($aPluginInfo[$current][7] == 0? '': ' -p"' & $aPluginInfo[$current][7] & '"')
Local $command = $cmd & $7z & ($aPluginInfo[$current][5] == ''? ' x': ' e') & ($aPluginInfo[$current][7] == 0? '': ' -p"' & $aPluginInfo[$current][7] & '"')
If $aPluginInfo[$current][5] <> "" Then ; Build include command for each file needed
$aReturn = StringSplit($aPluginInfo[$current][5], "|", 2)
For $sFile In $aReturn
Expand Down
12 changes: 6 additions & 6 deletions UniExtractUpdater.au3
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ EndFunc

Func _GetFFMPEG()
Const $cmd = (FileExists(@ComSpec)? @ComSpec: @WindowsDir & '\system32\cmd.exe') & ' /d /c '
Const $sOSArchDir = @ScriptDir & "\bin\" & @OSArch = 'X64'? 'x64\': 'x86\'
Const $sOSArchDir = @ScriptDir & "\bin\" & (@OSArch = 'X64'? 'x64\': 'x86\')
Const $sOSArch = @OSArch = 'X64'? '64': '32'
Const $sDocsDir = @ScriptDir & "\docs\FFmpeg\"
Const $7z = '""' & $sOSArchDir & '7z.exe"'

$FFmpegURL = _INetGetSource($sGetLinkURL & "ffmpeg" & StringInStr(@OSVersion, "WIN_XP")? "xp": @OSArch)
$FFmpegURL = _INetGetSource($sGetLinkURL & "ffmpeg" & (StringInStr(@OSVersion, "WIN_XP")? "xp": "") & $sOSArch & "&r=0")
$return = _Download($FFmpegURL, @TempDir, False)
If @error Then Exit 1

; Extract files, move them to scriptdir and delete files from tempdir
Local $ret = RunWait($cmd & $7z & ' e -ir!ffmpeg.exe -ir!licenses -y -o"' & $sOSArchDir & '" "' & $return & '"', @TempDir)
Local $ret = RunWait($cmd & $7z & ' e -ir!ffmpeg.exe -y -o"' & $sOSArchDir & '" "' & $return & '"', @TempDir)
FileDelete(@TempDir & $return)
If $ret <> 0 Then Exit MsgBox(48 + 1, $sUpdaterTitle, "Failed to extract update package " & $return & "." & @CRLF & @CRLF & "Make sure Universal Extractor is up to date and try again, or unpack the file manually to " & $sOSArchDir)
FileMove($cmdline[1] & "\*.txt", $sDocsDir, 8+1)
If $ret <> 0 Then Exit MsgBox(48, $sUpdaterTitle, "Failed to extract update package " & $return & "." & @CRLF & @CRLF & "Make sure Universal Extractor is up to date and try again, or unpack the file manually to " & $sOSArchDir)

; Download license information
If Not FileExists(@ScriptDir & "\docs\FFmpeg\FFmpeg_license.html") Then _Download("https://ffmpeg.org/legal.html", $sDocsDir, False)
If Not FileExists(@ScriptDir & "\docs\FFmpeg\FFmpeg_license.html") Then _Download("", $sDocsDir, False)

; License files
If $cmdline[2] <> 0 Then FileMove($cmdline[2], @ScriptDir & "\docs\FFmpeg\FFmpeg_license.html", 8 + 1)
Expand Down
2 changes: 2 additions & 0 deletions changelog_minor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ RC 1:
Fixed certain files being ignored by cleanup function
Fixed crash when trying to open preferences GUI if /lang directory does not exist
Fixed log files size display in file menu, if log directory is set to a location, which does not exist
Fixed DGCA plugin installation
Changed feedback GUI to always pre-fill output field
Changed .nrg extraction method to use 7zip for improved unicode support
Changed .arj extraction to use 7z instead of arj
Expand All @@ -47,6 +48,7 @@ RC 1:
UniExtract does not have to be updated to fix the link
Replaced Unreal Engine package extractor with Umodel
Removed redundant 64-bit MediaInfo dll
Removed option to toggle support for game packages from settings GUI
Updated EnigmaVB unpacker to 0.44, changed logic to use new command line parameter
Updated Exeinfo PE to 0.0.4.8
Updated unrar to 5.50
Expand Down
Binary file modified lang/German.ini
Binary file not shown.

0 comments on commit f208120

Please sign in to comment.