日期:2013-06-19  浏览次数:21009 次

<%

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(mid(header,9,1)),8)
    RECTdata = RECTdata & ToBin(asc(mid(header,10,1)),8)
    RECTdata = RECTdata & ToBin(asc(mid(header,11,1)),8)
    RECTdata = RECTdata & ToBin(asc(mid(header,12,1)),8)
    RECTdata = RECTdata & ToBin(asc(mid(header,13,1)),8)
    RECTdata = RECTdata & ToBin(asc(mid(header,14,1)),8)
    RECTdata = RECTdata & ToBin(asc(mid(header,15,1)),8)
    RECTdata = RECTdata & ToBin(asc(mid(header,16,1)),8)
    RECTdata = RECTdata & ToBin(asc(mid(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))
  &n