[VB.net]关于exe格式flash文件的播放器的剥除(11.12)(exe2swf格式转换器)(更新华为网盘)

前端之家收集整理的这篇文章主要介绍了[VB.net]关于exe格式flash文件的播放器的剥除(11.12)(exe2swf格式转换器)(更新华为网盘)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

如今不少Flash文件都是以exe格式发布的,其原理是将Flash Player和swf格式的Flash文件封装在一起,在没有安装Flash Player的电脑上一样可以播放。有时候我们可能需要swf格式的Flash文件,本转换器的功能就是将exe格式的Flash转换成swf格式。


程序下载地址:http://dl.dbank.com/c0wqcxuatd

使用Flash Player 6.0 r4版播放器的文件删去前424961个字节

使用Flash Player 7.0 r14版播放器的文件删去987137个字节

使用Flash Player 8.0 r22版播放器的文件1581057个字节

使用Flash Player 9.0 r45版播放器的文件2447561个字节

使用Flash Player 9.0 r115版播放器的文件3391489个字节



更新:

1.统一控件名和变量名为英语

2.界面微调

3.增加进度条

4.使用了自定义过程,大幅度精简了代码

5.加入了错误处理模块

欢迎致信wangjingkaibear@live.cn交流


基于Visual Basic 2010制作,以下为主界面源代码

Imports System

Imports System.IO

Public Class exe2swf

    Dim FPV1 As Integer    '定义一个变量用于保存Flash Player的版本

    Private Sub ZH1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles BtnConvert1.Click

        Dim TargetFile1 As String

        If TargetFilePath1.Text = "" Then                 '当目标文件路径未填写时

            TargetFile1 = Mid(SourceFilePath1.Text,1,SourceFilePath1.Text.Length - 3) & "swf"  '生成默认路径,即与源文件相同

        Else

            TargetFile1 = TargetFilePath1.Text            '否则则使用已填写的目标文件路径

        End If

        If File.Exists(SourceFilePath1.Text) = False Then '判断源文件是否存在

            MsgBox("无法打开文件,可能源文件路径错误或不存在!",MsgBoxStyle.OkOnly,"打开文件错误")

        Else

            Try

                Select Case FPV1           '使用Select函数分开处理不同版本的文件

                    Case 1      '使用Flash Player 6.0 r4版播放器的文件处理方法

                        Convert1(424961,TargetFile1)

                    Case 2      '使用Flash Player 7.0 r14版播放器的文件处理方法

                        Convert1(987137,TargetFile1)

                    Case 3      '使用Flash Player 8.0 r22版播放器的文件处理方法

                        Convert1(1581057,TargetFile1)

                    Case 4      '使用Flash Player 9.0 r45版播放器的文件处理方法

                        Convert1(2447561,TargetFile1)

                    Case 5      '使用Flash Player 9.0 r115版播放器的文件处理方法

                        Convert1(3391489,TargetFile1)

                End Select

            Catch ex As Exception

                Select Case Err.Number

                    Case 53

                        MsgBox("未找到文件","错误")

                    Case 321

                        MsgBox("文件格式无效","错误")

                    Case 75

                        MsgBox("路径/文件访问错误","错误")

                    Case 71

                        MsgBox("磁盘未准备好","错误")

                    Case 61

                        MsgBox("磁盘空间不足","错误")

                    Case 51

                        MsgBox("内部错误","错误")

                    Case Else

                        MsgBox("未知错误","错误")

                End Select

                ConvertProgress1.Value = 0

                Exit Sub

            End Try

            MsgBox(SourceFilePath1.Text & " 已经转换成功,并保存为 " & TargetFile1 & "!","转换成功")

            '以下If代码段用于在“转换完成后打开”选项勾选的情况下,打开生产的文件。

            Try

                If OpenFinish1.Checked = True Then

                    Process.Start(TargetFile1,-0)

                End If

            Catch ex As Exception

                MsgBox("打开文件时发生错误!",MsgBoxStyle.Exclamation,"错误")

            End Try

        End If

        ConvertProgress1.Value = 0

        SourceFilePath1.Text = ""            '清除文本框

        TargetFilePath1.Text = ""            '清除文本框

        BtnConvert1.Enabled = False          '禁用“转换”按钮

        OpenFinish1.Checked = False          '取消选择“转换完成后打开”选项

        OpenFinish1.Enabled = False          '令“转换完成后打开”选项不可用

        DlgOpenFile1.FileName = ""

    End Sub



    Private Sub LL1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles BtnBroswer1.Click

        DlgOpenFile1.ShowDialog()                      '显示打开文件对话框

        SourceFilePath1.Text = DlgOpenFile1.FileName   '将打开的文件的路径在源文件路径文本框中显示出来

    End Sub



    Private Sub LL2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles BtnBroswer2.Click

        DlgSaveFile1.ShowDialog()                     '显示保存文件对话框

        TargetFilePath1.Text = DlgSaveFile1.FileName  '将目标文件的路径在目标文件路径文本框中显示出来

    End Sub



    Private Sub YWenJianLJ1_TextChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles SourceFilePath1.TextChanged

        If SourceFilePath1.Text = "" Then       '如果“源文件路径”文本框为空,则三个单选按钮为未选状态且不可用

            FP6.Checked = False

            FP7.Checked = False

            FP8.Checked = False

            FP91.Checked = False

            FP92.Checked = False

            FP6.Enabled = False

            FP7.Enabled = False

            FP8.Enabled = False

            FP91.Enabled = False

            FP92.Enabled = False

        Else                                '如果“源文件路径”文本框有内容,则三个单选按钮可用

            FP6.Enabled = True

            FP7.Enabled = True

            FP8.Enabled = True

            FP91.Enabled = True

            FP92.Enabled = True

        End If

    End Sub





    Private Sub FP6_CheckedChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles FP6.CheckedChanged

        If FP6.Checked = True Then

            BtnConvert1.Enabled = True

            FPV1 = 1

            OpenFinish1.Enabled = True

        End If

    End Sub



    Private Sub FP7_CheckedChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles FP7.CheckedChanged

        If FP7.Checked = True Then

            BtnConvert1.Enabled = True

            FPV1 = 2

            OpenFinish1.Enabled = True

        End If

    End Sub



    Private Sub FP8_CheckedChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles FP8.CheckedChanged

        If FP8.Checked = True Then          '如果“Flash Player 8单选按钮”选择

            BtnConvert1.Enabled = True              '“转换”按钮可用

            FPV1 = 3                       '将值“3”赋给“Flash Player版本”变量

            OpenFinish1.Enabled = True            '“完成后打开”复选按钮可用

        End If

    End Sub



    Private Sub FP91_CheckedChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles FP91.CheckedChanged

        If FP91.Checked = True Then

            BtnConvert1.Enabled = True

            FPV1 = 4

            OpenFinish1.Enabled = True

        End If

    End Sub



    Private Sub FP92_CheckedChanged(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles FP92.CheckedChanged

        If FP92.Checked = True Then

            BtnConvert1.Enabled = True

            FPV1 = 5

            OpenFinish1.Enabled = True

        End If

    End Sub





    Private Sub About1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles About1.Click

        About.Show()

    End Sub



    Private Sub Help1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Help1.Click

        Help.Show()

    End Sub



    Sub Convert1(Amount1,TargetFilename1)

        Dim wjsj() As Byte

        FileOpen(1,SourceFilePath1.Text,OpenMode.Binary)  '打开源文件

        ConvertProgress1.Value = 10

        ReDim wjsj(LOF(1) - Amount1)                    '读取源文件

        ConvertProgress1.Value = 30

        FileGet(1,wjsj,Amount1)

        ConvertProgress1.Value = 60

        FileClose(1)

        ConvertProgress1.Value = 65

        FileOpen(1,TargetFilename1,OpenMode.Binary)             '打开目标文件

        ConvertProgress1.Value = 75

        FilePut(1,-1)                            '写入目标文件

        ConvertProgress1.Value = 90

        FileClose(1)

        ConvertProgress1.Value = 100

    End Sub

End Class
原文链接:https://www.f2er.com/vb/260552.html

猜你在找的VB相关文章