EXE2SWF(SourceCode)

类别:.NET开发 点击:0 评论:0 推荐:

由于以前写过个播放器,硬盘里也放着不少Flash文件,不少是EXE格式的.
也下载过一些小程序转换,现在闲着没事,自己也写了一个小程序...但....

'''''函数功能:输入SWF或EXE格式的Flash文件
Private Sub OutputFlash(InputFile As String,  Outputfile As String)
   Dim bittmp() As Byte
    Dim FileLenth&, I&, J&
    Dim FileNum1 As Integer
    Dim FileNum2 As Integer
    Dim strFwsFlag As String
    Dim strHexFlag As String
    Dim strVAR As String
    Dim bitVAR As Byte
    Dim swfSize As Long
    Dim swfStartPostion As Long
  
   FileLenth = FileLen(InputFile)
    S = "&H"
   FileNum1 = FreeFile: Open InputFile For Binary As #FileNum1
   FileNum2 = FreeFile: Open Outputfile For Binary As #FileNum2
  
   Dim sss$: sss = Time
         For I = FileLenth To FileLenth - 3 Step -1
             Seek #FileNum1, I                                    '''文件指针位置
             t = AscB(StrConv((Input(1, #FileNum1)), 128))        '''字符串ASCII码
             s = s & Hex(Int(t / 16)) & Hex(Int(t Mod 16))      '''双字16进制
         Next
         sss = sss & ">" & Time '''Record TIME
        
             swfSize = Val(s)                                           '''SWF文件大小
             swfStartPostion = FileLenth - swfSize - 7         ''SWF文件开始地址
            Seek #FileNum1, swfStartPostion
            strVAR = Asc(Input(3, #FileNum1))
            If strVAR = 70 Or strVAR = 67 Then                                 '''正确查找到FWS标记
                           Dim startByte&: startByte = swfStartPostion
                              sss = sss & ">" & Time
                             
                              ReDim bittmp(swfSize) As Byte
                              For I = 1 To swfSize
                                 Get #FileNum1, swfStartPostion + I - 1, bittmp(I)
                              Next
                              For I = 1 To swfSize            '''输出SWF格式的文件
                                 Put #FileNum2, I, bittmp(I)
                              Next                                                                                   
                           sss = sss & ">" & Time   ''Record TIME
                     Close #FileNum2
                     Skf.Movie = Outputfile
            Else
                     MnuShowText.Caption = "Sorry! Can't Output SWF-Flash File"
                     tmr = True
            End If
    Close #FileNum1
    sss = sss & ">" & Time ''Show Time
    Me.Caption = sss
End Sub

每次写文件,读文件都是一个一个字节读写.所以速度很慢!

本文地址:http://com.8s8s.com/it/it42576.htm