예제 #1
0
		public bool readArchiveFileHeader(FileStream fileHandle, MByteBuffer pMByteBuffer)
		{
			pMByteBuffer.clear ();
			fileHandle.Read(pMByteBuffer.dynBuff.buff, 0, 4);
			pMByteBuffer.length = 4;
			string magic = pMByteBuffer.readMultiByte(4, Encoding.UTF8);
			if (magic != "asdf")		// 检查 magic
			{
				return false;
			}

			pMByteBuffer.clear ();
			fileHandle.Read(pMByteBuffer.dynBuff.buff, 0, (int)calcArchiveHeaderSizeNoFileHeader() - 4);
			pMByteBuffer.length = calcArchiveHeaderSizeNoFileHeader() - 4;
			// 读取 endian 
			m_endian = pMByteBuffer.readByte ();
			pMByteBuffer.setEndian((Endian)m_endian);

			// 读取头部大小
			m_headerSize = pMByteBuffer.readUnsignedInt();

			// 读取版本
			m_version = pMByteBuffer.readUnsignedInt();
			// 读取文件数量
			m_fileCount = pMByteBuffer.readUnsignedInt();

			// 读取整个头
			pMByteBuffer.clear ();
			fileHandle.Read(pMByteBuffer.dynBuff.buff, 0, (int)(m_headerSize - calcArchiveHeaderSizeNoFileHeader()));
			pMByteBuffer.length = m_headerSize - calcArchiveHeaderSizeNoFileHeader ();

			return true;
		}
예제 #2
0
        public bool readArchiveFileHeader(FileStream fileHandle, MByteBuffer pMByteBuffer)
        {
            pMByteBuffer.clear();
            fileHandle.Read(pMByteBuffer.dynBuff.buff, 0, 4);
            pMByteBuffer.length = 4;
            string magic = pMByteBuffer.readMultiByte(4, Encoding.UTF8);

            if (magic != "asdf")                        // 检查 magic
            {
                return(false);
            }

            pMByteBuffer.clear();
            fileHandle.Read(pMByteBuffer.dynBuff.buff, 0, (int)calcArchiveHeaderSizeNoFileHeader() - 4);
            pMByteBuffer.length = calcArchiveHeaderSizeNoFileHeader() - 4;
            // 读取 endian
            m_endian = pMByteBuffer.readByte();
            pMByteBuffer.setEndian((Endian)m_endian);

            // 读取头部大小
            m_headerSize = pMByteBuffer.readUnsignedInt();

            // 读取版本
            m_version = pMByteBuffer.readUnsignedInt();
            // 读取文件数量
            m_fileCount = pMByteBuffer.readUnsignedInt();

            // 读取整个头
            pMByteBuffer.clear();
            fileHandle.Read(pMByteBuffer.dynBuff.buff, 0, (int)(m_headerSize - calcArchiveHeaderSizeNoFileHeader()));
            pMByteBuffer.length = m_headerSize - calcArchiveHeaderSizeNoFileHeader();

            return(true);
        }
예제 #3
0
 public void readHeaderFromArchiveFile(MByteBuffer ba)
 {
     m_pathLen      = ba.readUnsignedByte();
     m_fileNamePath = ba.readMultiByte(m_pathLen, Encoding.UTF8);
     m_fileOffset   = ba.readUnsignedInt();
     m_fileSize     = ba.readUnsignedInt();
     m_flags        = ba.readUnsignedInt();
 }
예제 #4
0
		public void readHeaderFromArchiveFile(MByteBuffer ba)
		{
			m_pathLen = ba.readUnsignedByte();
			m_fileNamePath = ba.readMultiByte(m_pathLen, Encoding.UTF8);
			m_fileOffset = ba.readUnsignedInt();
			m_fileSize = ba.readUnsignedInt();
			m_flags = ba.readUnsignedInt();
		}
예제 #5
0
파일: PakItem.cs 프로젝트: quinsmpang/Tools
		public void readArchiveFileHeader(FileStream fileHandle)
		{
			MByteBuffer pMByteBuffer = new MByteBuffer();

			if (m_pArchiveHeader.readArchiveFileHeader(fileHandle, pMByteBuffer))		// 检查 magic
			{
				FileHeader pFileHeader;
				for (uint idx = 0; idx < m_pArchiveHeader.m_fileCount; ++idx)
				{
					pFileHeader = new FileHeader();
					m_pFileVec.Add(pFileHeader);
					pFileHeader.readHeaderFromArchiveFile(pMByteBuffer);
				}
			}
		}
예제 #6
0
        public void readArchiveFileHeader(FileStream fileHandle)
        {
            MByteBuffer pMByteBuffer = new MByteBuffer();

            if (m_pArchiveHeader.readArchiveFileHeader(fileHandle, pMByteBuffer))                       // 检查 magic
            {
                FileHeader pFileHeader;
                for (uint idx = 0; idx < m_pArchiveHeader.m_fileCount; ++idx)
                {
                    pFileHeader = new FileHeader();
                    m_pFileVec.Add(pFileHeader);
                    pFileHeader.readHeaderFromArchiveFile(pMByteBuffer);
                }
            }
        }