![]() |
Multimedia »
General Graphics »
General
Intermediate
License: The Code Project Open License (CPOL)
Reader of SWF Header File in Pure C#By zebulon75018Reader of SWF header file in pure C# with a single class |
C#2.0, Windows, .NET1.0, .NET2.0VS2005, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
It's my first article on The Code Project. Please excuse my English.
This article describes how to read the header of the flash file. (This file has the extension .swf )
The Format Header SWF is described in this link.
You can also read a good article on SWF which describes the library SwfDotNet.
I wrote this article for myself and for people who want small source code.
To read this header, I translate PHP code to C#. The original source code in PHP is at this address.
This is the code of a class which can provide information of the Swf Flash:
FrameRate FrameCount Width Height VersionWarning, this class doesn't work with the compressed Flash File.
The name of the class is FlashHeaderReader and takes for the constructor a parameter, the filename of the flash file.
It calls these methods:
ReadSignature(); mVersion=GetNextByte();ReadFileLength();ReadFrameSize(); ReadFrameRate();ReadFrameCount();Later, you can access the properties of the swf file :
FlashHeaderReader swfreader = new FlashHeaderReader(openFileDialog1.FileName);
listBox1.Items.Clear();
listBox1.Items.Add("Frames : " + swfreader.FrameCount);
listBox1.Items.Add("Width : " + swfreader.Width );
listBox1.Items.Add("Height : " + swfreader.Height);
The method ReadFrameSize is complex because the swf format also compresses the header and information has a different size.
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 10 Aug 2007 Editor: Deeksha Shenoy |
Copyright 2007 by zebulon75018 Everything else Copyright © CodeProject, 1999-2010 Web22 | Advertise on the Code Project |