C# Class SwfDotNet.IO.SwfReader

The SwfReader class reads and parses a swf file from a stream.

The SwfReader creates a Swf object, that is a sequence of tags readed from a swf binary file. The tag sequences follows the Swf version 7 format specifications from Macromedia, and is compatible with Swf version 1 to 7.

The working process of the tags sequence is explain in the Macromedia specifications. The tags sequence is composed of objects from the SwfDotNet.IO.Tags namespace.

SwfReader gets all the content of a file and provides some functionnalities to decompile bitmap, sounds, video or scripting bytecode.

The tag reading process doesnt decompile actionscript bytecode, though. This is handled by SwfDotNet.IO.ByteCode.Decompiler. The action script tags contain directly actionscript bytecodes as a byte array. The SwfDotNet.IO.ByteCode.Decompiler object provides the way to get actionscript command as objects of the SwfDotNet.IO.ByteCode namespace.

Show file Open project: bladecoding/SwfExport Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Closes this stream reader.

ReadSwf ( ) : Swf

Read swf (header and tags), this is the only public method of SwfReader with Close and ReadSwfHeader methods. The returned Swf object contains swf headers informations and the tags list.

ReadSwfHeader ( ) : SwfHeader

Reads the SWF header only. This method don't read the complete content of the SWF file. Then, it provides the possibility to get faster header informations, and only it.

SwfReader ( Stream stream ) : System

Swf Reader class, takes an input stream as single argument.

SwfReader ( string path ) : System

Creates a new SwfReader instance.

SwfReader ( string path, bool useBuffer ) : System

Creates a new SwfReader instance. If useBuffer is true, all the content of the SWF file is readed first and is parsed from the memory after. If useBuffer is false, the SWF is parsed directly from the file stream. Use a buffer is faster to parse, but use more memory.

Private Methods

Method Description
Inflate ( ) : void

Inflate compressed swf

Init ( string path, bool useBuffer ) : void

Inits the stream reading process.

ReadTag ( byte version, BufferedBinaryReader binaryReader, BaseTagCollection tagList ) : BaseTag

Read next tag from swf input stream.

ReadVideoFrameTag ( BufferedBinaryReader binaryReader, BaseTagCollection tagList ) : VideoFrameTag

Read and parse VideoFrameTag, into inner tags and raw byte-array header data

Method Details

Close() public method

Closes this stream reader.
public Close ( ) : void
return void

ReadSwf() public method

Read swf (header and tags), this is the only public method of SwfReader with Close and ReadSwfHeader methods. The returned Swf object contains swf headers informations and the tags list.
public ReadSwf ( ) : Swf
return Swf

ReadSwfHeader() public method

Reads the SWF header only. This method don't read the complete content of the SWF file. Then, it provides the possibility to get faster header informations, and only it.
public ReadSwfHeader ( ) : SwfHeader
return SwfHeader

SwfReader() public method

Swf Reader class, takes an input stream as single argument.
public SwfReader ( Stream stream ) : System
stream Stream Stream to read swf from, must allow random access
return System

SwfReader() public method

Creates a new SwfReader instance.
public SwfReader ( string path ) : System
path string Path.
return System

SwfReader() public method

Creates a new SwfReader instance. If useBuffer is true, all the content of the SWF file is readed first and is parsed from the memory after. If useBuffer is false, the SWF is parsed directly from the file stream. Use a buffer is faster to parse, but use more memory.
public SwfReader ( string path, bool useBuffer ) : System
path string String path of the local swf file
useBuffer bool Use buffer.
return System