c2ephp

agents/COB/FileBlock.php

Go to the documentation of this file.
00001 <?php
00002 require_once(dirname(__FILE__).'/COBBlock.php');
00003 
00005 class COBFileBlock extends COBBlock {
00006 
00008     //
00009     private $fileType;
00010     private $fileName;
00011     
00012     private $reserved;
00013     private $contents;
00014 
00016 
00018 
00023     public function COBFileBlock($type,$name,$contents) {
00024         parent::COBBlock(COB_BLOCK_FILE);
00025         $this->fileType = $type;
00026         $this->fileName = $name;
00027         $this->contents = $contents;
00028     }
00029 
00031 
00034     public function AddReserved($reserved) {
00035         $this->reserved = $reserved;
00036     }
00037 
00039     public function GetName() {
00040         return $this->fileName;
00041     }
00042 
00044 
00048     public function GetFileType() {
00049         return $this->fileType;
00050     }
00051 
00053     public function GetContents() {
00054         return $this->contents;
00055     }
00056 
00058 
00062     public function GetReserved() {
00063         return $this->reserved;
00064     }
00065 
00067 
00069 
00072     public static function CreateFromReader(IReader $reader) {
00073         $type = ($reader->ReadInt(2)==0)?'sprite':'sound';
00074         $reserved = $reader->ReadInt(4);
00075         $size = $reader->ReadInt(4);
00076         $fileName = $reader->ReadCString();
00077         $contents = $reader->Read($size);
00078         $block = new COBFileBlock($type,$fileName,$contents);
00079         $block->AddReserved($reserved);
00080         return $block;
00081     }
00083 }
00084 ?>
 All Classes Files Functions Variables Enumerations