-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
4,346 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SWFFilePlayer", "SWFFilePlayer\SWFFilePlayer.vbproj", "{FDF14335-5BBA-4954-8155-2F08C92782F4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{FDF14335-5BBA-4954-8155-2F08C92782F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{FDF14335-5BBA-4954-8155-2F08C92782F4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{FDF14335-5BBA-4954-8155-2F08C92782F4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{FDF14335-5BBA-4954-8155-2F08C92782F4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Imports System | ||
|
||
' Token: 0x02000004 RID: 4 | ||
Public Class Rect | ||
Dim xMin_, xMax_, yMin_, yMax_ | ||
' Token: 0x17000001 RID: 1 | ||
' (get) Token: 0x06000012 RID: 18 RVA: 0x00003B4F File Offset: 0x00001D4F | ||
Public ReadOnly Property XMin As Integer | ||
Get | ||
Return Me.xMin_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x17000002 RID: 2 | ||
' (get) Token: 0x06000013 RID: 19 RVA: 0x00003B57 File Offset: 0x00001D57 | ||
Public ReadOnly Property XMax As Integer | ||
Get | ||
Return Me.xMax_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x17000003 RID: 3 | ||
' (get) Token: 0x06000014 RID: 20 RVA: 0x00003B5F File Offset: 0x00001D5F | ||
Public ReadOnly Property YMin As Integer | ||
Get | ||
Return Me.yMin_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x17000004 RID: 4 | ||
' (get) Token: 0x06000015 RID: 21 RVA: 0x00003B67 File Offset: 0x00001D67 | ||
Public ReadOnly Property YMax As Integer | ||
Get | ||
Return Me.yMax_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x06000016 RID: 22 RVA: 0x00003B70 File Offset: 0x00001D70 | ||
Public Sub New(ByVal swf As SWFReader) | ||
Dim nBits As Integer = CInt(swf.ReadUB(5)) | ||
Me.xMin_ = swf.ReadSB(nBits) | ||
Me.xMax_ = swf.ReadSB(nBits) | ||
Me.yMin_ = swf.ReadSB(nBits) | ||
Me.yMax_ = swf.ReadSB(nBits) | ||
End Sub | ||
End Class | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
Imports System | ||
Imports System.IO | ||
Imports System.Text | ||
Imports ICSharpCode.SharpZipLib.Zip.Compression.Streams | ||
' Token: 0x02000005 RID: 5 | ||
Public Class SWFFile | ||
' Token: 0x17000005 RID: 5 | ||
' (get) Token: 0x06000017 RID: 23 RVA: 0x00003BBF File Offset: 0x00001DBF | ||
Dim fileLength_ As UInteger, fileName_ As String, frameCount_ As UShort, frameHeight_ As Integer, frameRate_ As Single, frameWidth_ As Integer, swf_ As SWFReader, version_ As Byte, signature_ As String, stream_ As Stream | ||
Public ReadOnly Property FileName As String | ||
Get | ||
Return Me.fileName_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x17000006 RID: 6 | ||
' (get) Token: 0x06000018 RID: 24 RVA: 0x00003BC7 File Offset: 0x00001DC7 | ||
Public ReadOnly Property Signature As String | ||
Get | ||
Return Me.Signature_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x17000007 RID: 7 | ||
' (get) Token: 0x06000019 RID: 25 RVA: 0x00003BCF File Offset: 0x00001DCF | ||
Public ReadOnly Property Version As Byte | ||
Get | ||
Return Me.Version_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x17000008 RID: 8 | ||
' (get) Token: 0x0600001A RID: 26 RVA: 0x00003BD7 File Offset: 0x00001DD7 | ||
Public ReadOnly Property FileLength As UInteger | ||
Get | ||
Return Me.FileLength_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x17000009 RID: 9 | ||
' (get) Token: 0x0600001B RID: 27 RVA: 0x00003BDF File Offset: 0x00001DDF | ||
Public ReadOnly Property FrameWidth As Integer | ||
Get | ||
Return Me.frameWidth_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x1700000A RID: 10 | ||
' (get) Token: 0x0600001C RID: 28 RVA: 0x00003BE7 File Offset: 0x00001DE7 | ||
Public ReadOnly Property FrameHeight As Integer | ||
Get | ||
Return Me.FrameHeight_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x1700000B RID: 11 | ||
' (get) Token: 0x0600001D RID: 29 RVA: 0x00003BEF File Offset: 0x00001DEF | ||
Public ReadOnly Property FrameRate As Single | ||
Get | ||
Return Me.FrameRate_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x1700000C RID: 12 | ||
' (get) Token: 0x0600001E RID: 30 RVA: 0x00003BF7 File Offset: 0x00001DF7 | ||
Public ReadOnly Property FrameCount As UShort | ||
Get | ||
Return Me.FrameCount_ | ||
End Get | ||
End Property | ||
|
||
' Token: 0x0600001F RID: 31 RVA: 0x00003C00 File Offset: 0x00001E00 | ||
Public Sub New(ByVal fileName As String) | ||
Me.fileName_ = fileName | ||
Me.stream_ = New FileStream(Me.FileName, FileMode.Open, FileAccess.Read) | ||
Me.swf_ = New SWFReader(Me.stream_) | ||
If Me.ReadHeader() Then | ||
Me.IdentifyTags() | ||
End If | ||
End Sub | ||
|
||
' Token: 0x06000020 RID: 32 RVA: 0x00003C64 File Offset: 0x00001E64 | ||
Private Function ReadHeader() As Boolean | ||
Me.signature_ = Encoding.ASCII.GetString(Me.swf_.ReadUI8(3)) | ||
If Me.Signature <> "FWS" AndAlso Me.Signature <> "CWS" Then | ||
Return False | ||
End If | ||
Me.version_ = Me.swf_.ReadUI8() | ||
Me.fileLength_ = Me.swf_.ReadUI32() | ||
If Me.Signature = "CWS" Then | ||
Dim inflaterInputStream As InflaterInputStream = New InflaterInputStream(Me.stream_) | ||
Me.swf_.Stream = inflaterInputStream | ||
End If | ||
Dim rect As Rect = New Rect(Me.swf_) | ||
Me.frameWidth_ = rect.XMax | ||
Me.frameHeight_ = rect.YMax | ||
Dim num As UShort = CUShort(Me.swf_.ReadUI8()) | ||
Dim num2 As UShort = CUShort(Me.swf_.ReadUI8()) | ||
Me.frameRate_ = Convert.ToSingle(String.Format("{0}.{1}", num2, num)) | ||
Me.frameCount_ = Me.swf_.ReadUI16() | ||
Return True | ||
End Function | ||
|
||
' Token: 0x06000021 RID: 33 RVA: 0x00003D70 File Offset: 0x00001F70 | ||
Private Sub IdentifyTags() | ||
Dim tag As Tag | ||
Do | ||
tag = New Tag(Me.swf_) | ||
Loop While tag.ID <> 0US | ||
End Sub | ||
|
||
' Token: 0x06000022 RID: 34 RVA: 0x00003D93 File Offset: 0x00001F93 | ||
Public Sub Close() | ||
Me.stream_.Close() | ||
End Sub | ||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
Imports System | ||
Imports System.IO | ||
Imports System.Text | ||
' Token: 0x02000006 RID: 6 | ||
Public Class SWFReader | ||
' Token: 0x1700000D RID: 13 | ||
' (get) Token: 0x06000023 RID: 35 RVA: 0x00003DA0 File Offset: 0x00001FA0 | ||
' (set) Token: 0x06000024 RID: 36 RVA: 0x00003DA8 File Offset: 0x00001FA8 | ||
Dim bitPosition As Byte, currentByte As Byte, stream_ As Stream | ||
Public Property Stream As Stream | ||
Get | ||
Return Me.stream_ | ||
End Get | ||
Set(ByVal value As Stream) | ||
Me.stream_ = value | ||
End Set | ||
End Property | ||
|
||
' Token: 0x06000025 RID: 37 RVA: 0x00003DB4 File Offset: 0x00001FB4 | ||
Shared Sub New() | ||
For b As Byte = 0 To 32 - 1 | ||
SWFReader.bitValues(CInt(b)) = 1UI << CInt(b) | ||
Next | ||
SWFReader.powers = New Single(31) {} | ||
For b2 As Byte = 0 To 32 - 1 | ||
SWFReader.powers(CInt(b2)) = CSng(Math.Pow(2.0, CDbl((b2 - 16)))) | ||
Next | ||
End Sub | ||
|
||
' Token: 0x06000026 RID: 38 RVA: 0x00003E1D File Offset: 0x0000201D | ||
Public Sub New(ByVal stream As Stream) | ||
Me.Stream = stream | ||
End Sub | ||
|
||
' Token: 0x06000027 RID: 39 RVA: 0x00003E2C File Offset: 0x0000202C | ||
Public Function ReadByte() As Byte | ||
Dim num As Integer = Me.Stream.ReadByte() | ||
Me.bitPosition = 8 | ||
If num = -1 Then | ||
Throw New ApplicationException("Attempted to read past end of stream") | ||
End If | ||
Return CByte(num) | ||
End Function | ||
|
||
' Token: 0x06000028 RID: 40 RVA: 0x00003E60 File Offset: 0x00002060 | ||
Public Function ReadBit() As Boolean | ||
If Me.bitPosition > 7 Then | ||
Me.currentByte = Me.ReadByte() | ||
Me.bitPosition = 0 | ||
End If | ||
Dim result As Boolean = (CUInt(Me.currentByte) And SWFReader.bitValues(CInt((7 - Me.bitPosition)))) <> 0UI | ||
Me.bitPosition += 1 | ||
Return result | ||
End Function | ||
|
||
' Token: 0x06000029 RID: 41 RVA: 0x00003EB5 File Offset: 0x000020B5 | ||
Public Function ReadUI8() As Byte | ||
Return Me.ReadByte() | ||
End Function | ||
|
||
' Token: 0x0600002A RID: 42 RVA: 0x00003EC0 File Offset: 0x000020C0 | ||
Public Function ReadUI8(ByVal n As Integer) As Byte() | ||
Dim array As Byte() = New Byte(n - 1) {} | ||
For i As Integer = 0 To n - 1 | ||
array(i) = Me.ReadUI8() | ||
Next | ||
Return array | ||
End Function | ||
|
||
' Token: 0x0600002B RID: 43 RVA: 0x00003EEA File Offset: 0x000020EA | ||
Public Function ReadSI8() As SByte | ||
Return CSByte(Me.ReadByte()) | ||
End Function | ||
|
||
' Token: 0x0600002C RID: 44 RVA: 0x00003EF4 File Offset: 0x000020F4 | ||
Public Function ReadUI16() As UShort | ||
Dim num As UShort = 0US | ||
num = num Or CUShort(Me.ReadByte()) | ||
Return num Or CUShort((Me.ReadByte() << 8)) | ||
End Function | ||
|
||
' Token: 0x0600002D RID: 45 RVA: 0x00003F1B File Offset: 0x0000211B | ||
Public Function ReadSI16() As Short | ||
Return CShort(Me.ReadUI16()) | ||
End Function | ||
|
||
' Token: 0x0600002E RID: 46 RVA: 0x00003F24 File Offset: 0x00002124 | ||
Public Function ReadUI32() As UInteger | ||
Dim num As UInteger = 0UI | ||
num = num Or CUInt(Me.ReadByte()) | ||
num = num Or CUInt((CUInt(Me.ReadByte()) << 8)) | ||
num = num Or CUInt((CUInt(Me.ReadByte()) << 16)) | ||
Return num Or CUInt((CUInt(Me.ReadByte()) << 24)) | ||
End Function | ||
|
||
' Token: 0x0600002F RID: 47 RVA: 0x00003F60 File Offset: 0x00002160 | ||
Public Function ReadSI32() As Integer | ||
Return CInt(Me.ReadUI32()) | ||
End Function | ||
|
||
' Token: 0x06000030 RID: 48 RVA: 0x00003F68 File Offset: 0x00002168 | ||
Public Function ReadFIXED() As Single | ||
Dim num As Single = 0.0F | ||
num += CSng(Me.ReadByte()) * SWFReader.powers(0) | ||
num += CSng(Me.ReadByte()) * SWFReader.powers(7) | ||
num += CSng(Me.ReadByte()) * SWFReader.powers(15) | ||
Return num + CSng(Me.ReadByte()) * SWFReader.powers(31) | ||
End Function | ||
|
||
' Token: 0x06000031 RID: 49 RVA: 0x00003FCC File Offset: 0x000021CC | ||
Public Function ReadSTRING() As String | ||
Dim text As String = String.Empty | ||
Dim array As Byte() = New Byte(0) {} | ||
Dim array2 As Byte() = array | ||
Do | ||
array2(0) = Me.ReadByte() | ||
If array2(0) <> 0 Then | ||
text += Encoding.ASCII.GetString(array2) | ||
End If | ||
Loop While array2(0) <> 0 | ||
Return text | ||
End Function | ||
|
||
' Token: 0x06000032 RID: 50 RVA: 0x00004010 File Offset: 0x00002210 | ||
Public Function ReadUB(ByVal nBits As Integer) As UInteger | ||
Dim num As UInteger = 0UI | ||
If nBits > 0 Then | ||
For i As Integer = nBits - 1 To -1 + 1 Step -1 | ||
If Me.ReadBit() Then | ||
num = num Or SWFReader.bitValues(i) | ||
End If | ||
Next | ||
End If | ||
Return num | ||
End Function | ||
|
||
' Token: 0x06000033 RID: 51 RVA: 0x00004044 File Offset: 0x00002244 | ||
Public Function ReadSB(ByVal nBits As Integer) As Integer | ||
Dim num As Integer = 0 | ||
If nBits > 0 Then | ||
If Me.ReadBit() Then | ||
num -= CInt(SWFReader.bitValues(nBits - 1)) | ||
End If | ||
For i As Integer = nBits - 2 To -1 + 1 Step -1 | ||
If Me.ReadBit() Then | ||
num = num Or CInt(SWFReader.bitValues(i)) | ||
End If | ||
Next | ||
End If | ||
Return num | ||
End Function | ||
|
||
' Token: 0x06000034 RID: 52 RVA: 0x0000408C File Offset: 0x0000228C | ||
Public Function ReadFB(ByVal nBits As Integer) As Single | ||
Dim num As Single = 0.0F | ||
If nBits > 0 Then | ||
If Me.ReadBit() Then | ||
num -= SWFReader.powers(nBits - 1) | ||
End If | ||
For i As Integer = nBits - 1 To 0 + 1 Step -1 | ||
If Me.ReadBit() Then | ||
num += SWFReader.powers(i - 1) | ||
End If | ||
Next | ||
End If | ||
Return num | ||
End Function | ||
|
||
' Token: 0x0400003F RID: 63 | ||
Private Shared bitValues As UInteger() = New UInteger(31) {} | ||
|
||
' Token: 0x04000040 RID: 64 | ||
Private Shared powers As Single() | ||
End Class | ||
|
Oops, something went wrong.