⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpacker.h

📁 用FREE BASIC做的演示程序
💻 H
字号:
/*
          GGGGGGG          AAA         MMM         MMM   EEEEEEEEEEE         ++++                   _/_/
         GG     GG        AA AA        MMMMM     MMMMM   EE                  ++++                  _/_/
        GG               AA   AA       MM  MM   MM  MM   EE                  ++++                 _/_/
       GG               AA     AA      MM    MMM    MM   EEEEEEEEEEE   +++++++++++++++++  _/_/_/_/_/_/_/_/_/
       GG              AAAAAAAAAAA     MM	        MM   EEEEEEEEEEE   +++++++++++++++++ _/_/_/_/_/_/_/_/_/
        GG    GGGGGG  AA         AA    MM           MM   EE                  ++++              _/_/
         GG     GG   AA           AA   MM           MM   EE                  ++++             _/_/
          GGGGGGG   AAAA         AAAA MMMM         MMMM  EEEEEEEEEEE         ++++            _/_/
	  
		  Game++ Game Engine---
		  Game++ Studio版权所有
		  http://www.gamepp.org/

          File:gppPacker.h
		  Purpose:Packer Class
		  Author:Kylinx	(game++Studio member)
		  Created Date:2003/10/21
          Last Updated by:Kylinx
          Last Updated Date:2003/10/22
*/
#ifndef GPP_PACKER_H_
#define GPP_PACKER_H_
#include<string>
#include<vector>
#include<fstream>
#include"compress.h"
#include"AutoMemManager.h"
using namespace std;
#pragma warning(disable:4786)

class GVPacker
{
public:
	virtual bool OpenPackFile(const string & strFile)=0;
	virtual bool ClosePackFile()=0;
	virtual bool ReadPackedFile(const string &strFile,char**ppReturnData,unsigned long & dwByteRead)=0;	
	virtual bool ReadPackedFile(const string &strFile,GFileData & fd)=0;
	virtual ~GVPacker(){}
};
const unsigned long C_BSP_FILE_ID='KXPK';
const unsigned char  C_BSP_FILE_VER_MAJOR=1;
const unsigned char	 C_BSP_FILE_VER_MINON=0;
const unsigned long C_BSP_FILE_NAME_SIZE=116;

class GBinarySearchPacker:public GVPacker
{
public:
	GBinarySearchPacker();
	virtual ~GBinarySearchPacker();
	
	virtual bool OpenPackFile(const string & strFile);
	virtual bool ClosePackFile();
	virtual bool ReadPackedFile(const string &strFile,char**ppReturnData,unsigned long & dwByteRead);
	virtual bool ReadPackedFile(const string &strFile,GFileData & fd);
private:
	ifstream	m_ifs;
	struct STFileAttrib
	{
		string	m_strFileName;
		unsigned long dwAttrib;
		unsigned long dwOffsite;
		union
		{
			unsigned long	dwLength;
			struct 
			{
				unsigned short wDirCount;
				unsigned short wFileCount;
			}stDirInfo;
		};
	};
	unsigned long m_dwPackerFileCount;
	unsigned long m_dwPackerDirCount;
	vector<STFileAttrib> m_vAllFileAttrib;
	
	static bool CompareFileAttrib(const STFileAttrib & fa1,const STFileAttrib & fa2);

	struct STPackFileHeader
	{
		unsigned long  dwID;
		unsigned long  dwDirCount;
		unsigned long  dwFileCount;
		unsigned char  byVerMajor;
		unsigned char  byVerMinon;
		unsigned char  Res[2];
	};
	struct STPackerFile
	{
		char	szFileName[C_BSP_FILE_NAME_SIZE];
		unsigned long	dwAttrib;
		unsigned long	dwOffsite;
		union
		{
			unsigned long	dwLength;
			struct 
			{
				unsigned short wDirCount;
				unsigned short wFileCount;
			}stDirInfo;
		};
	};
	bool GetPackerFileName(ifstream & ifs,const STPackerFile & pfObject);
	unsigned long SearchFileIndex(const string & data);
};
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -