Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

XMPScannerMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class XMP MBS XMP Plugin 6.5 Yes Yes Yes Yes No
Function: The class to scan any file stream for XMP data.
Example:
dim c,n,i,l as Integer
dim xs as XMPScannerMBS
dim xn as XMPSnipMBS
dim s as string
dim x as XMPMetaMBS
dim b as BinaryStream
dim source as FolderItem

// get file
source=GetOpenFolderItem("any")
if source=nil then Return

b=source.OpenAsBinaryFile(false)

if b=nil then Return

// read file to memory
l=b.Length
s=b.Read(l)

// scan for xmp blocks
MsgBox "Scanning "+str(lenb(s))+" of "+str(l)+" bytes."

xs=new XMPScannerMBS(l)
xs.Scan(s,0)

MsgBox "Found "+str(xs.Report)+" blocks"

n=xs.Report-1

c=0
for i=0 to n

xn=xs.Snip(i)

if xn.State=3 then // found
if xn.Length>50 then
try
b.Position=xn.Offset

s=b.Read(xn.Length)

// debug output xmp data
'WriteInputXMP dest,s

// try to parse
x=new XMPMetaMBS(s)

// work with xmp meta data
catch r as XMPExceptionMBS
MsgBox "ExtractXMP failed on: "+r.message
end try
else
MsgBox "Found small xmp block? "+str(xn.Length)
end if
end if
next

Feedback, Comments & Corrections

This class has no sub classes.


The items on this page are in the following plugins: MBS XMP Plugin.


XMPPacketInfoMBS   -   XMPSnipMBS




Links
MBS Xojo PDF Plugins