/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Gets the shape ID $this->_shapeId = $stream->littleEndianUnsignedShort(); // Processes the rectangle data $this->_shapeBounds->processData($stream); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Gets the character ID $this->_characterId = $stream->littleEndianUnsignedShort(); // Processes the rectangle data $this->_splitter->processData($stream); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Gets the SWF file signature $signature = $stream->read(3); // Checks the SWF file signature if ($signature === 'FWS') { // No compression $this->_isCompressed = false; } elseif ($signature === 'CWS') { // SWF file data is compressed $this->_isCompressed = true; } else { // Error - Invalid SWF signature throw new Woops_Swf_Header_Exception('Invalid SWF file signature (' . $signature . ')', Woops_Swf_Header_Exception::EXCEPTION_BAD_SIGNATURE); } // Gets the SWF version $this->_version = $stream->unsignedChar(); // Do not process the file size $stream->seek(4, Woops_Swf_Binary_Stream::SEEK_CUR); // Checks if we have to uncompress the SWF data if ($this->_isCompressed) { // Uncompress the SWF data $stream->uncompressData(); } // Processes the frame size rectangle $this->_frameSize->processData($stream); // Gets the frame rate $this->_frameRate = $stream->littleEndianFixedPoint(8, 8); // Gets the number of frames $this->_frameCount = $stream->littleEndianUnsignedShort(); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Gets the alpha value $this->_alpha = $stream->unsignedChar(); // Calls the parent method parent::processData($stream); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Skips the reserved bits $stream->seek(2, Woops_Swf_Binary_Stream::SEEK_CUR); // Calls the parent method parent::processData($stream); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Checks if we have data, meaning we have a MD5-encrypted password if (!$stream->endOfStream()) { // Gets the MD5-encrypted password $this->_password = $stream->nullTerminatedString(); } }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Gets the label $this->_label = $stream->nullTerminatedString(); // Checks if we have a named anchor if (!$stream->endOfStream()) { // Sets the named anchor flag $this->_namedAnchor = (bool) $stream->unsignedChar(); } }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Gets the raw data $data = $stream->littleEndianUnsignedLong(); // Sets the flags $this->_useDirectBlit = (bool) ($data & 0x2); $this->_useGpu = (bool) ($data & 0x4); $this->_hasMetadata = (bool) ($data & 0x8); $this->_useActionScript3 = (bool) ($data & 0x10); $this->_useNetwork = (bool) ($data & 0x80); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { $data = $stream->unsignedChar(); $nBits = ($data & 0xf8) >> 3; $length = ceil($nBits / 8 * 4); $fields = str_pad(decbin($data & 0x7), 3, '0', STR_PAD_LEFT); for ($i = 0; $i < $length; $i++) { $fields .= str_pad(decbin($stream->unsignedChar()), 8, '0', STR_PAD_LEFT); } $this->_xMin = bindec(substr($fields, 0, $nBits)); $this->_xMax = bindec(substr($fields, $nBits, $nBits)); $this->_yMin = bindec(substr($fields, $nBits * 2, $nBits)); $this->_yMax = bindec(substr($fields, $nBits * 3, $nBits)); }
/** * Class constructor * * @param resource The file handle for which to create a binary stream * @param boolean Whether to close the file handle or not * @return void * @see Woops_Swf_Binary_Stream::__construct */ public function __construct($handle, $closeHandle = true) { // Checks if the file exists if (!is_resource($handle)) { // Error - The file does not exist throw new Woops_Swf_Binary_File_Resource_Stream_Exception('Passed argument must be a valid file handle', Woops_Swf_Binary_File_Resource_Stream_Exception::EXCEPTION_NO_RESOURCE); } // Storage $data = ''; // Reads until the end of the file handle while (!feof($handle)) { // Reads from the file handle $data .= fread($handle, 8192); } // Checks if we must close the file handle if ($closeHandle) { // Closes the file handle fclose($handle); } // Calls the parent constructor parent::__construct($data); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Resets the storage arrays $this->_offsets = array(); $this->_scenes = array(); $this->frameLabels = array(); // Gets the number of scenes $sceneCount = $stream->encodedU32(); // Process eachs scene for ($i = 0; $i < $sceneCount; $i++) { // Gets the frame offset and name for the current scene $this->_offsets[] = $stream->encodedU32(); $this->_scenes[] = $stream->nullTerminatedString(); } // Gets the number of frame labels $frameLabelCount = $stream->encodedU32(); // Process each frame label for ($i = 0; $i < $frameLabelCount; $i++) { // Gets the frame number and label $this->_frameLabels[$stream->encodedU32()] = $stream->nullTerminatedString(); } }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { $this->_maxRecursionDepth = $stream->littleEndianUnsignedShort(); $this->_scriptTimeoutSeconds = $stream->littleEndianUnsignedShort(); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Resets the symbols arrays $this->_symbols = array(); $this->_symbolIds = array(); // Gets the number of symbols $symbolsNum = $stream->littleEndianUnsignedShort(); // Process each symbols for ($i = 0; $i < $symbolsNum; $i++) { // Gets the symbol ID $id = $stream->littleEndianUnsignedShort(); // Gets the symbol name $name = $stream->nullTerminatedString(); // Stores the symbol $this->_symbols[$id] = $name; $this->_symbolIds[] = $id; } }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { $this->_xml = $stream->nullTerminatedString(); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { $this->_red = $stream->unsignedChar(); $this->_green = $stream->unsignedChar(); $this->_blue = $stream->unsignedChar(); }
/** * Process the raw data from a binary stream * * @return void */ public function processData(Woops_Swf_Binary_Stream $stream) { // Gets the sprite ID and the frame count $this->_spriteId = $stream->littleEndianUnsignedShort(); $this->_frameCount = $stream->littleEndianUnsignedShort(); // Resets the tag array $this->_tags = array(); // Process the tags while (!$stream->endOfStream()) { // Gets thge tag record header $tagHeader = $stream->littleEndianUnsignedShort(); // Gets the tag type $tagType = $tagHeader >> 6; // Gets the tag length $tagLength = $tagHeader & 0x3f; // Checks for a 32bit length if ($tagLength === 0x3f) { // Tag is long $tagLength = $stream->littleEndianUnsignedLong(); } // Creates the tag $tag = $this->newTag($tagType); // Creates a binary stream with the tag data $tagData = new Woops_Swf_Binary_Stream($stream->read($tagLength)); // Processes the tag data $tag->processData($tagData); } }