home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / air / update / core / AIRUnpackager.as next >
Encoding:
Text File  |  2010-06-23  |  1.2 KB  |  44 lines

  1. package air.update.core
  2. {
  3.    import air.update.utils.Constants;
  4.    import flash.utils.ByteArray;
  5.    
  6.    public class AIRUnpackager extends UCFUnpackager
  7.    {
  8.       private var _descriptorXML:XML;
  9.       
  10.       public function AIRUnpackager()
  11.       {
  12.          super();
  13.       }
  14.       
  15.       public function get descriptorXML() : XML
  16.       {
  17.          return this._descriptorXML;
  18.       }
  19.       
  20.       override protected function onFile(param1:uint, param2:String, param3:ByteArray) : Boolean
  21.       {
  22.          if(param1 == 0)
  23.          {
  24.             return true;
  25.          }
  26.          if(param1 == 1 && param2 != "META-INF/AIR/application.xml")
  27.          {
  28.             throw new Error("META-INF/AIR/application.xml must be the second file in an AIR file",Constants.ERROR_AIR_MISSING_APPLICATION_XML);
  29.          }
  30.          this._descriptorXML = new XML(param3.toString());
  31.          return false;
  32.       }
  33.       
  34.       override protected function onDone() : void
  35.       {
  36.          if(this._descriptorXML == null)
  37.          {
  38.             throw new Error("META-INF/AIR/application.xml must exists in the AIR file",Constants.ERROR_AIR_MISSING_APPLICATION_XML);
  39.          }
  40.       }
  41.    }
  42. }
  43.  
  44.