Esempio n. 1
0
        private void ReadMetadata(EndianReader reader)
        {
            string signature = reader.ReadStringZeroTerm();

            if (signature != Signature)
            {
                throw new Exception($"Signature '{signature}' doesn't match to '{Signature}'");
            }

            SmartStream         webStream = (SmartStream)reader.BaseStream;
            List <WebFileEntry> entries   = new List <WebFileEntry>();
            long headerLength             = reader.ReadInt32();

            while (webStream.Position < headerLength)
            {
                int    offset     = reader.ReadInt32();
                int    length     = reader.ReadInt32();
                int    pathLength = reader.ReadInt32();
                string path       = reader.ReadString(pathLength);

                WebFileEntry entry = new WebFileEntry(webStream, m_filePath, path, offset, length);
                entries.Add(entry);
            }
            Metadata = new WebMetadata(entries);
        }
Esempio n. 2
0
        private void ReadWebFiles(EndianStream stream, bool isClosable)
        {
            string signature = stream.ReadStringZeroTerm();

            if (signature != Signature)
            {
                throw new Exception($"Signature dosn't match to '{Signature}'");
            }

            List <WebFileEntry> entries = new List <WebFileEntry>();
            long headerLength           = stream.ReadInt32();

            while (stream.BaseStream.Position < headerLength)
            {
                int    offset     = stream.ReadInt32();
                int    length     = stream.ReadInt32();
                int    pathLength = stream.ReadInt32();
                string path       = stream.ReadString(pathLength);

                WebFileEntry entry = new WebFileEntry(stream.BaseStream, path, offset, length);
                entries.Add(entry);
            }
            Metadata = new WebMetadata(stream.BaseStream, isClosable, entries);
        }