Esempio n. 1
0
        /**
         * Reads the next lha entry and positions stream at the beginning of the
         * entry data.
         *
         * @param name
         *            the name of the entry
         * @return the LzhEntry just read
         * @throws LhaException
         *             if a lha format error has occurred
         * @throws IOException
         *             if an I/O error has occured
         */
        public virtual LhaEntry GetNextEntry()
        {
            if (entry != null)
            {
                dis.CloseEntry();
            }
            LhaEntryReader lhaEntryReader = new LhaEntryReader(this, encoding);

            entry = lhaEntryReader.ReadHeader();

            if (entry != null)
            {
                dis    = new LhaDecoderInputStream(this, entry);
                closed = false;
            }
            else
            {
                dis    = null;
                closed = true;
            }
            return(entry);
        }
Esempio n. 2
0
        /**
         * Make entry map in lha file.
         *
         * @throws LhaException
         *             if a lha format error has occurred
         * @throws IOException
         *             if an I/O error has occured
         */
        private void MakeEntryMap()
        {
            LhaEntryReader lhaEntryReader = new LhaEntryReader(binaryReader, encoding);

            this.size = 0;

            while (true)
            {
                LhaEntry e = lhaEntryReader.ReadHeader();

                if (e == null)
                {
                    break;
                }

                e.SetOffset(binaryReader.BaseStream.Position);
                entryList.Add(e);
                entryMap.Add(e.GetPath(), e);
                ++size;

                int skipSize = (int)e.GetCompressedSize();
                binaryReader.BaseStream.Position += skipSize;
            }
        }