#include <Array.au3>
Global $sFile = @ScriptDir & "\TestTorrent.torrent"
Global $sWdxPlugin = @ScriptDir & "\TCTorrent.wlx"
Global $nUnitIdx = 0
Global Const $ft_nomorefields = 0
Global Const $ft_numeric_32 = 1
Global Const $ft_numeric_64 = 2
Global Const $ft_numeric_floating = 3
Global Const $ft_date = 4
Global Const $ft_time = 5
Global Const $ft_boolean = 6
Global Const $ft_multiplechoice = 7
Global Const $ft_string = 8
Global Const $ft_fulltext = 9
Global Const $ft_datetime = 10
Global Const $ft_stringw = 11
Global $aFields[1][3]
For $i = 0 To 255
$aRet = DllCall($sWdxPlugin, "int", "ContentGetSupportedField", "int", $i, "str", "", "str", "", "int", 65535)
If @error Then ExitLoop
If $aRet[0] = $ft_nomorefields Then ExitLoop
ReDim $aFields[$i+1][3]
$aFields[$i][0] = $aRet[0]
$aFields[$i][1] = $aRet[2]
$aFields[$i][2] = $aRet[3]
Next
If UBound($aFields) = 0 Then
MsgBox (0, "", "No fields.")
Exit
EndIf
Global $aValues[UBound($aFields)][2]
Global $nMaxBuffSize = 65535
Global $pBuffer = DllStructCreate("byte[65535]")
For $i=0 To UBound($aFields) - 1
$aRet = DllCall($sWdxPlugin, "int", "ContentGetValue", "str", $sFile, "int", $i, "int", $nUnitIdx, "ptr", DllStructGetPtr($pBuffer), "int", $nMaxBuffSize, "int", 0)
If @error Then ExitLoop
Switch $aFields[$i][0]
Case $ft_numeric_32
$pValue = DllStructCreate("int", DllStructGetPtr($pBuffer))
Case $ft_numeric_64
$pValue = DllStructCreate("int64", DllStructGetPtr($pBuffer))
Case $ft_numeric_floating
$pValue = DllStructCreate("double", DllStructGetPtr($pBuffer))
Case $ft_string, $ft_fulltext
$pValue = DllStructCreate("char[" & $nMaxBuffSize & "]", DllStructGetPtr($pBuffer))
Case $ft_datetime
$pFileTime = DllStructCreate("dword;dword", DllStructGetPtr($pBuffer))
$pLocalTime = DllStructCreate("dword;dword")
DllCall("Kernel32.dll", "int", "FileTimeToLocalFileTime", "ptr", DllStructGetPtr($pFileTime), "ptr", DllStructGetPtr($pLocalTime))
$pValue = DllStructCreate("short;short;short;short;short;short;short;short")
DllCall("Kernel32.dll", "int", "FileTimeToSystemTime", "ptr", DllStructGetPtr($pLocalTime), "ptr", DllStructGetPtr($pValue))
$aValues[$i][0] = $aFields[$i][1]
$aValues[$i][1] = StringFormat("%04d-%02d-%02d %02d:%02d:%02d", _
DllStructGetData($pValue, 1), _
DllStructGetData($pValue, 2), _
DllStructGetData($pValue, 4), _
DllStructGetData($pValue, 5), _
DllStructGetData($pValue, 6), _
DllStructGetData($pValue, 7))
ContinueLoop
Case Else
ContinueLoop
EndSwitch
$aValues[$i][0] = $aFields[$i][1]
$aValues[$i][1] = DllStructGetData($pValue, 1)
Next
_ArrayDisplay($aValues)
|