Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool GetNextEntry(ZipEntry entry)
        {
            if (_index >= _entryCount)
            {
                return(false);
            }

            _stream.position = _pos + 28;
            int len  = _stream.ReadUshort();
            int len2 = _stream.ReadUshort() + _stream.ReadUshort();

            _stream.position = _pos + 46;
            string name = _stream.ReadString(len);

            name = name.Replace("\\", "/");

            entry.name = name;
            if (name[name.Length - 1] == '/')             //directory
            {
                entry.isDirectory = true;
                entry.compress    = 0;
                entry.crc         = 0;
                entry.size        = entry.sourceSize = 0;
                entry.offset      = 0;
            }
            else
            {
                entry.isDirectory = false;
                _stream.position  = _pos + 10;
                entry.compress    = _stream.ReadUshort();
                _stream.position  = _pos + 16;
                entry.crc         = _stream.ReadUint();
                entry.size        = _stream.ReadInt();
                entry.sourceSize  = _stream.ReadInt();
                _stream.position  = _pos + 42;
                entry.offset      = _stream.ReadInt() + 30 + len;
            }

            _pos += 46 + len + len2;
            _index++;

            return(true);
        }
 static public int ReadUshort(IntPtr l)
 {
     try {
         FairyGUI.Utils.ByteBuffer self = (FairyGUI.Utils.ByteBuffer)checkSelf(l);
         var ret = self.ReadUshort();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }