accessing flash details in ASP files

Source: Internet
Author: User
Visit <%

Class Swfdump

Private Header
Private Rectdata
Private nbits
Private mversion
Private Mfilelen
Private Mxmin
Private Mxmax
Private Mymin
Private Mymax
Private Mheigt
Private Mwidth
Private mframerate
Private Mframecount

Private Sub Class_Initialize ()

End Sub

Private Sub Class_Terminate ()

End Sub


Private Function readheader (filename)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim FSO, F
Set fso = CreateObject ("Scripting.FileSystemObject")
Set f = fso. OpenTextFile (filename, ForReading)
Readheader = F.read (21)
End Function

Private Function ToBin (Innumber, OUTLENSTR)
Dim binary
binary = ""
Do While Innumber >= 1
binary = binary & innumber mod 2
Innumber = innumber \ 2
Loop
binary = binary & String (Outlenstr-len (binary), "0")
ToBin = strreverse (binary)
End Function

Private Function Bin2decimal (inbin)
Dim counter
Dim Temp
Dim Value
Inbin = StrReverse (Inbin)
temp = 0
For counter = 1 to Len (Inbin)
If counter = 1 Then
Value = 1
Else
Value = value * 2
End If
Temp = temp + Mid (Inbin, counter, 1) * Value
Next
Bin2decimal = Temp
End Function

Public Function swfdump (fileName)

Header = Readheader (fileName)
Mversion = ASC (Mid (header,4,1))
Mfilelen = ASC (Mid (header,5,1))
Mfilelen = Mfilelen + ASC (Mid (header,6,1)) * 256
Mfilelen = Mfilelen + ASC (Mid (header,7,1)) * 256 * 256
Mfilelen = Mfilelen + ASC (Mid (header,8,1)) * 256 * 256 * 256

Rectdata = ToBin (ASC (header,9,1), 8)
Rectdata = rectdata & ToBin (ASC (header,10,1), 8)
Rectdata = rectdata & ToBin (ASC (header,11,1), 8)
Rectdata = rectdata & ToBin (ASC (header,12,1), 8)
Rectdata = rectdata & ToBin (ASC (header,13,1), 8)
Rectdata = rectdata & ToBin (ASC (header,14,1), 8)
Rectdata = rectdata & ToBin (ASC (header,15,1), 8)
Rectdata = rectdata & ToBin (ASC (header,16,1), 8)
Rectdata = rectdata & ToBin (ASC (header,17,1), 8)

Nbits = Mid (rectdata,1,5)
Nbits = Bin2decimal (nbits)

Mxmin = Bin2decimal (Mid (rectdata,6,nbits))
Mxmax = Bin2decimal (Mid (rectdata,6 + nbits * 1, nbits))
Mymin = Bin2decimal (Mid (rectdata,6 + nbits * 2, Nbits))
Mymax = Bin2decimal (Mid (rectdata,6 + nbits * 3, Nbits))

Mheigt = (mymax-mymin)/20
Mwidth = (mxmax-mxmin)/20

Mframerate = ASC (Mid (header,18,1))

Mframecount = ASC (Mid (header,19,1))
Mframecount = Mframecount + ASC (Mid (header,20,1)) * 256

End Function


Public Property Get Heigt ()
Heigt = Mheigt
End Property



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.