public Header(int width, int height, int fileLength, int FrameCount, int FrameRate) { this._FileLength = fileLength; this._FrameSize = new RECT(0, 0, width, height); this._FrameCount = new UI16(FrameCount); this._FrameRate = new FB8((float)FrameRate); }
public UI16 ReadUI16(Stream strmSource) { UI16 ui16Result = 0; ui16Result |= (UInt16)strmSource.ReadByte(); ui16Result |= (UInt16)(strmSource.ReadByte() << 8); return(ui16Result); }
public SWFFileHeader(string strFileName) { Stream strmReader = new FileStream(strFileName, FileMode.Open, FileAccess.Read); UI8 ui8SigByteOne = ReadUI8(strmReader); UI8 ui8SigByteTwo = ReadUI8(strmReader); UI8 ui8SigByteThree = ReadUI8(strmReader); if (ui8SigByteOne == (byte)'F' || ui8SigByteOne == (byte)'C') { if (ui8SigByteOne == (byte)'C') { m_bCompressed = true; } if (ui8SigByteTwo == (byte)'W' && ui8SigByteThree == (byte)'S') { m_ui8Version = ReadUI8(strmReader); m_ui32FileLength = ReadUI32(strmReader); if (m_bCompressed) { m_strSignature = "CWS"; strmReader.ReadByte(); strmReader.ReadByte(); DeflateStream zipStream = new DeflateStream(strmReader, CompressionMode.Decompress); strmReader = zipStream; } else { m_strSignature = "FWS"; } m_rectFrameSize = new RECT(strmReader); m_dFrameRate = ReadFrameRate(strmReader); m_ui16FrameCount = ReadUI16(strmReader); strmReader.Close(); } else { throw new Exception("Invalid file format"); } } else { throw new Exception("Invalid file format"); } }