duanjianjun 2 роки тому
батько
коміт
080404b4c2

+ 397 - 0
MFCApplication1/Buffers.cpp

@@ -0,0 +1,397 @@
+/***********************************************************************/
+//文 件 名:CBuffers.cpp
+//功	能:CBuffers类实现
+/***********************************************************************/
+#include "pch.h"
+#include "Buffers.h"
+#include <windows.h>
+
+#ifdef _DEBUG
+#include "stdio.h"
+#include <iostream>
+using namespace std;
+#endif
+
+//直接从zwl_memory中搬过来
+//属于粗放型的内存管理
+
+template<class _Tc>class template_malloc
+{
+#ifdef _DEBUG
+	//检测用
+public:
+	unsigned int nItems;
+#endif 
+#pragma pack(push,1)	//强制本结构1字节对齐
+	typedef	struct tagItem
+	{
+		union
+		{
+			tagItem*next;
+			size_t size;
+		};
+		_Tc	data;
+	}ITEM,*PITEM;
+#pragma pack(pop)
+public:
+	char* mlloc(void)
+	{
+		if(!__item__) return(NULL);
+		PITEM pitem = __item__;
+		__item__ = __item__->next;
+		pitem->size = sizeof(_Tc);
+#ifdef _DEBUG
+		nItems--;
+#endif 
+		return(pitem->data);
+	}
+
+#ifdef _DEBUG
+	int getItemCount(){
+		return nItems;
+	}
+#endif 
+
+	void release(char*pdata)
+	{
+		PITEM pitem=(PITEM)pdata;
+		memset(pitem,0,sizeof(ITEM));
+		pitem->next = __item__;
+		__item__ = pitem;
+
+#ifdef _DEBUG
+		nItems++;
+#endif
+	}
+	void clean(void)
+	{
+		char*lpData=NULL;
+		for(PITEM pnext=NULL;__item__;__item__=pnext)
+		{
+			pnext = __item__->next;
+			lpData = (char*)__item__;
+			delete[] lpData;
+		}
+	}
+	template_malloc(void):__item__(NULL)
+	{
+#ifdef _DEBUG
+		nItems = 0;
+#endif 
+	}
+	~template_malloc(void)
+	{
+		clean();
+	}
+	PITEM	__item__;
+};
+
+#define	__malloc__(T,P)\
+	else if(lsize<=T)\
+{\
+	lpData=P.mlloc();\
+	_size = T;\
+}
+class memory_factory
+{
+public:
+	char*malloc( size_t lsize, size_t* msize )
+	{
+		char*lpData=NULL;
+		size_t _size(0);
+
+		EnterCriticalSection(&__lock__);
+
+		if(lsize<=16)
+		{
+			lpData = _alloc_16.mlloc();
+			_size = 16;
+		}
+		__malloc__(32,_alloc_32)
+		__malloc__(64,_alloc_64)
+		__malloc__(128,_alloc_128)
+		__malloc__(256,_alloc_256)
+		__malloc__(512,_alloc_512)
+		__malloc__(1024,_alloc_1k)
+		__malloc__(1024*2L,_alloc_2k)
+		__malloc__(1024*4L,_alloc_4k)
+		__malloc__(1024*8L,_alloc_8k)
+		__malloc__(1024*16L,_alloc_16k)
+		__malloc__(1024*32L,_alloc_32k)
+		__malloc__(1024*64L,_alloc_64k)
+		__malloc__(1024*128L,_alloc_128k)
+		__malloc__(1024*256L,_alloc_256k)
+		__malloc__(1024*512L,_alloc_512k)
+		__malloc__(1024*1024L,_alloc_1m)
+		//__malloc__(2*1024*1024L,_alloc_2m)
+		//__malloc__(3*1024*1024L,_alloc_3m)
+		//__malloc__(4*1024*1024L,_alloc_4m)
+		//__malloc__(8*1024*1024L,_alloc_8m)
+		//__malloc__(16*1024*1024L,_alloc_16m)
+		//__malloc__(32*1024*1024L,_alloc_32m)
+		else
+		{
+			_size=lsize;
+		}
+		LeaveCriticalSection(&__lock__);
+		if(!lpData)
+		{
+			char*lpMalloc=new char[ _size + sizeof( size_t ) ];
+			if(!lpMalloc) return(NULL);
+			*(size_t*)lpMalloc = _size;
+			memset(lpData=lpMalloc + sizeof( size_t ), 0, _size );
+		}
+#ifdef _DEBUG
+		else {
+			nCount --;
+		}
+#endif
+		if(msize) *msize = _size;
+		return(lpData);
+	}
+	void release(char*lpData)
+	{
+		if( lpData == NULL )
+			return;
+
+		char* lpMalloc = lpData - sizeof( size_t );
+		EnterCriticalSection(&__lock__);
+		switch( *( size_t* )lpMalloc )
+		{
+		case    16:		    _alloc_16.release(lpMalloc); break;
+		case    32:		    _alloc_32.release(lpMalloc); break;
+		case    64:		    _alloc_64.release(lpMalloc); break;
+		case    128:	    _alloc_128.release(lpMalloc); break;
+		case    256:	    _alloc_256.release(lpMalloc); break;
+		case	512:		_alloc_512.release(lpMalloc); break;
+		case	1024:		_alloc_1k.release(lpMalloc); break;
+		case	1024*2L:	_alloc_2k.release(lpMalloc); break;
+		case	1024*4L:	_alloc_4k.release(lpMalloc); break;
+		case	1024*8L:	_alloc_8k.release(lpMalloc); break;
+		case	1024*16L:	_alloc_16k.release(lpMalloc); break;
+		case	1024*32L:	_alloc_32k.release(lpMalloc); break;
+		case	1024*64L:	_alloc_64k.release(lpMalloc); break;
+		case	1024*128L:	_alloc_128k.release(lpMalloc); break;
+		case	1024*256L:	_alloc_256k.release(lpMalloc); break;
+		case	1024*512L:	_alloc_512k.release(lpMalloc); break;
+		case	1024*1024L:	_alloc_1m.release(lpMalloc); break;
+//		case	2*1024*1024L:	_alloc_2m.release(lpMalloc); break;
+//		case	3*1024*1024L:	_alloc_3m.release(lpMalloc); break;
+//		case	4*1024*1024L:	_alloc_4m.release(lpMalloc); break;
+//		case	8*1024*1024L:	_alloc_8m.release(lpMalloc); break;
+//		case	16*1024*1024L:	_alloc_16m.release(lpMalloc); break;
+//		case	32*1024*1024L:	_alloc_32m.release(lpMalloc); break;
+		default: delete[] lpMalloc;
+		}
+		LeaveCriticalSection(&__lock__);
+
+#ifdef _DEBUG
+		nCount ++;
+#endif
+	}
+	void clean(void)
+	{
+		EnterCriticalSection(&__lock__);
+		_alloc_16.clean();
+		_alloc_32.clean();
+		_alloc_64.clean();
+		_alloc_128.clean();
+		_alloc_256.clean();
+		_alloc_512.clean();
+		_alloc_1k.clean();
+		_alloc_2k.clean();
+		_alloc_4k.clean();
+		_alloc_8k.clean();
+		_alloc_16k.clean();
+		_alloc_32k.clean();
+		_alloc_64k.clean();
+		_alloc_128k.clean();
+		_alloc_256k.clean();
+		_alloc_512k.clean();
+		_alloc_1m.clean();
+		_alloc_2m.clean();
+		_alloc_3m.clean();
+		_alloc_4m.clean();
+		_alloc_8m.clean();
+		_alloc_16m.clean();
+		_alloc_32m.clean();
+
+		LeaveCriticalSection(&__lock__);
+
+	}
+	memory_factory(void)
+	{
+
+		InitializeCriticalSection(&__lock__);
+
+#ifdef _DEBUG
+		nCount = 0;;
+#endif
+	}
+
+	~memory_factory(void)
+	{
+		clean();
+		DeleteCriticalSection(&__lock__);
+	}
+
+#ifdef _DEBUG
+	int getItemCount(){
+		return nCount;
+	}
+#endif 
+	template_malloc<char[16]>				_alloc_16;
+	template_malloc<char[32]>				_alloc_32;
+	template_malloc<char[64]>				_alloc_64;
+	template_malloc<char[128]>				_alloc_128;
+	template_malloc<char[256]>				_alloc_256;
+	template_malloc<char[512]>				_alloc_512;
+	template_malloc<char[1024]>				_alloc_1k;
+	template_malloc<char[1024*2L]>			_alloc_2k;
+	template_malloc<char[1024*4L]>			_alloc_4k;
+	template_malloc<char[1024*8L]>			_alloc_8k;
+	template_malloc<char[1024*16L]>			_alloc_16k;
+	template_malloc<char[1024*32L]>			_alloc_32k;
+	template_malloc<char[1024*64L]>			_alloc_64k;
+	template_malloc<char[1024*128L]>		_alloc_128k;
+	template_malloc<char[1024*256L]>		_alloc_256k;
+	template_malloc<char[1024*512L]>		_alloc_512k;
+	template_malloc<char[1024*1024L]>		_alloc_1m;
+	template_malloc<char[1024*1024L*2]>		_alloc_2m;
+	template_malloc<char[1024*1024L*3]>		_alloc_3m;
+	template_malloc<char[1024*1024L*4]>		_alloc_4m;
+	template_malloc<char[1024*1024L*8]>		_alloc_8m;
+	template_malloc<char[1024*1024L*16]>	_alloc_16m;
+	template_malloc<char[1024*1024L*32]>	_alloc_32m;
+
+	CRITICAL_SECTION __lock__;
+
+#ifdef _DEBUG
+	int nCount;
+#endif
+
+}__memory__;
+
+CBuffers::CBuffers(LPVOID lpBuffer):
+bufData((LPSTR)lpBuffer),sizeData(0),sizeMalloc(0)
+{
+	if(bufData){
+		sizeMalloc = *( size_t* )( (char*)lpBuffer - sizeof( size_t ) );
+	}
+}
+
+CBuffers::~CBuffers(void)
+{
+	if(bufData)
+	{
+		__memory__.release(bufData);
+		bufData = 0;
+	}
+}
+/////////////////////////////////////////////////////////////////////////////
+LPSTR CBuffers::GetBuf(size_t lsize)
+{
+	if( ( lsize + 1 ) > sizeMalloc )
+	{
+		if(bufData)
+		{
+			__memory__.release(bufData);
+			bufData = 0;
+		}
+		bufData=__memory__.malloc( lsize + 1, &sizeMalloc );
+	}
+	if( bufData && sizeMalloc )
+		memset( bufData, 0, sizeMalloc );
+	sizeData = lsize;
+	return(bufData);
+}
+
+void CBuffers::Release(void)
+{
+	if(bufData)
+	{
+		__memory__.release(bufData);
+		bufData = 0;
+	}
+	sizeData = sizeMalloc = 0;
+}
+
+char * CBuffers::Copy(void * lpData, size_t lsize)
+{
+	if(!GetBuf(lsize+1)) return(0); //避免字符串等不注意的情形,多分配一点
+	if(lsize)
+	{
+		memcpy(bufData,lpData,lsize);
+	}
+	sizeData = lsize;
+	return(bufData);
+}
+
+char *  CBuffers::Append(void * lpData, size_t lsize)
+{
+	if(lsize)
+	{
+		if(!Extern(sizeData+lsize+1)) return(0);
+		memcpy(bufData+sizeData,lpData,lsize);
+		sizeData += lsize;
+	}
+	return(bufData);
+}
+
+char *  CBuffers::Extern( size_t maxSize)
+{
+	if(maxSize>sizeMalloc)
+	{
+		size_t sizeNew(0);
+		char * bufNew=__memory__.malloc(maxSize, &sizeNew );
+		if(!bufNew) return(0);
+		if(bufData)
+		{
+			if(sizeData) memcpy(bufNew,bufData,sizeData);
+			if(bufData)
+			{
+				__memory__.release(bufData);
+				bufData = 0;
+			}
+		}
+		bufData = bufNew;
+		sizeMalloc = sizeNew;
+	}
+	return(bufData);
+}
+
+CBuffers::operator const char *(void) const
+{
+	return(bufData);
+}
+
+const CBuffers&CBuffers::operator=(const char * lpString)
+{
+	Copy((void*)lpString,lstrlenA(lpString));
+	return(*this);
+}
+
+const CBuffers&CBuffers::operator+=(const char * lpString)
+{
+	Append((void*)lpString,lstrlenA(lpString));
+	return(*this);
+}
+
+void CBuffers::Attach(CBuffers*pMemory)
+{
+	if(bufData)
+	{
+		__memory__.release(bufData);
+		bufData = 0;
+	}
+	sizeData = pMemory->sizeData;
+	sizeMalloc = pMemory->sizeMalloc;
+	bufData = pMemory->bufData;
+	pMemory->sizeData = pMemory->sizeMalloc = 0;
+	pMemory->bufData = 0;
+}
+
+void CBuffers::Detach()
+{
+	bufData = NULL;
+}

+ 43 - 0
MFCApplication1/Buffers.h

@@ -0,0 +1,43 @@
+/***********************************************************************/
+//文 件 名:CBuffers.h
+//功	能:CBuffers类声明
+//			CBuffers类是一个利用内存池机制来分配内存的工具类
+/***********************************************************************/
+#ifndef __CBuffers__
+#define __CBuffers__
+
+class CBuffers
+{
+public:
+	char*	GetBuf(size_t lsize);
+	char*	Extern(size_t maxSize);
+	char*	Copy( void * lpData, size_t lsize );
+	char*	Append( void * lpData, size_t lsize );
+	void	Attach( CBuffers*pMemory );
+	void    Detach();
+	void	Release(void);
+
+	inline operator const char * (void) const;
+	const CBuffers& operator=(const char * lpString);
+	const CBuffers& operator+=(const char * lpString);
+	//绑定地址:自动释放
+	CBuffers(void * lpBuffer=0);
+	~CBuffers(void);
+
+	size_t sizeData,sizeMalloc;
+	char *bufData;
+};
+
+#define		FREE_BUFFER( x )		\
+{									\
+	CBuffers buf( x );				\
+}
+
+#define		INIT_BUFFER( x, n )		\
+{									\
+	CBuffers	buf;				\
+	x = buf.GetBuf( ( n ) );		\
+	buf.Detach();					\
+}
+
+#endif //__CBuffers__

+ 17 - 0
MFCApplication1/Instance.h

@@ -0,0 +1,17 @@
+#ifndef __INSTANCE_H__
+#define __INSTANCE_H__
+
+template < typename T >
+
+class Instance
+{
+
+public:
+	static T* GetInstance()
+	{
+		static T _instance;
+		return &_instance;
+	};
+};
+
+#endif

+ 199 - 0
MFCApplication1/Log.cpp

@@ -0,0 +1,199 @@
+// Log.cpp: implementation of the CLog class.
+//
+//////////////////////////////////////////////////////////////////////
+#include "pch.h"
+#include "Log.h"
+#include <string>
+#include <tchar.h>
+#include <atlconv.h>
+#include "Buffers.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+using namespace std;
+
+typedef std::basic_string<char> TString;
+inline void string_trim(std::string &str, char* pszMask = " \t\r\n")
+{
+	std::string::size_type st;
+	if ((st = str.find_last_not_of(pszMask)) == std::string::npos){
+		str.erase();
+		return;
+	}
+	str.erase(++st);
+	if ((st = str.find_first_not_of(pszMask)) != 0)
+		str.erase(0, st);
+}
+
+#ifdef _LOGCONSOLE
+	#pragma comment( lib, "libPrintLogd.lib" )
+#endif // _LOGCONSOLE
+
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+CLog::CLog()
+	: m_hFile(INVALID_HANDLE_VALUE)
+	, m_nMinLevel(LogLvlAll)
+	, m_nMaxLogSize(10*1024*1024)
+{
+	InitializeCriticalSection(&m_cs);
+	Init("pdf.log", LogLvlAll, 60);
+}
+
+CLog::~CLog()
+{
+	if(m_hFile!=INVALID_HANDLE_VALUE)
+		CloseHandle(m_hFile);
+	DeleteCriticalSection(&m_cs);
+}
+
+BOOL CLog::Init(const char* pszFileName,UINT nMinLevel,UINT nMaxSizeMB)
+{
+	EnterCriticalSection(&m_cs);
+
+	m_nMinLevel=nMinLevel;
+	if(nMaxSizeMB<=0)
+		nMaxSizeMB=10;
+	m_nMaxLogSize=nMaxSizeMB*1024*1024;
+
+	if(m_hFile!=INVALID_HANDLE_VALUE)
+	{
+		if(CloseHandle(m_hFile))
+			m_hFile = INVALID_HANDLE_VALUE;
+	}
+
+
+	m_hFile = CreateFileA(pszFileName,GENERIC_WRITE,FILE_SHARE_READ,
+		NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
+	if (m_hFile == INVALID_HANDLE_VALUE)
+	{
+		LeaveCriticalSection(&m_cs);
+		return FALSE;
+	}
+
+	TString str(pszFileName);
+	TString::size_type pos= str.rfind(_T('.'));
+	if(pos!=TString::npos)
+		str=str.substr(0,pos);
+	strcpy(m_chFileName,str.c_str());
+
+	DWORD dwLen=GetFileSize(m_hFile,NULL);
+	m_idx.dwLen=dwLen;
+	m_idx.dwPos=0;
+
+	SetFilePointer(m_hFile,m_idx.dwPos+m_idx.dwLen,NULL,FILE_BEGIN);
+	SetEndOfFile(m_hFile);
+	LeaveCriticalSection(&m_cs);
+
+	return TRUE;
+}
+
+void CLog::Put(const wchar_t* pszMsg,UINT nLevel)
+{
+	if(nLevel>m_nMinLevel || pszMsg==NULL )
+		return;
+	if( m_hFile==INVALID_HANDLE_VALUE )
+		return;
+	USES_CONVERSION;
+	Put(W2A(pszMsg), nLevel);
+}
+
+void CLog::Put(char* pszMsg, UINT nLevel)
+{
+	if(nLevel>m_nMinLevel || pszMsg==NULL )
+		return;
+
+	EnterCriticalSection(&m_cs);
+
+	if( m_hFile==INVALID_HANDLE_VALUE )
+	{
+		LeaveCriticalSection(&m_cs);
+		return;
+	}
+
+	SYSTEMTIME st;
+	GetLocalTime(&st);
+	char chBuf[24]={0};
+//	_stprintf(chBuf,_T("%02d-%02d-%02d %02d:%02d:%02d "),
+//		st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute,st.wSecond);
+	sprintf(chBuf,"%02d-%02d-%02d %02d:%02d:%02d ",
+		st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute,st.wSecond);
+
+	
+	while(pszMsg!=NULL && strlen(pszMsg)>0){
+		string str,str2;
+//		TCHAR *pch=_tcschr(pszMsg,_T('\n'));
+		char *pch=strchr(pszMsg,'\n');
+		if(pch>0){
+			str2.assign(pszMsg,pch);
+			pszMsg=pch+1;
+		}
+		else{
+			str2=pszMsg;
+			pszMsg=NULL;
+		}
+		string_trim(str2);
+		str.reserve(1024);
+		str=chBuf;
+		str+=str2;
+		str+="\r\n";
+		DWORD dw;
+		SetFilePointer(m_hFile,m_idx.dwPos+m_idx.dwLen,NULL,FILE_BEGIN);
+		size_t nLen=str.length();
+		if(WriteFile(m_hFile,str.c_str(),nLen,&dw,NULL) && dw==nLen){
+			m_idx.dwPos+=m_idx.dwLen;
+			m_idx.dwLen=nLen;
+			m_idx.nLevel=nLevel;			
+		}
+	}
+	if(GetFileSize(m_hFile,NULL)>m_nMaxLogSize){
+		//н¨LogÎļþ
+		CloseHandle(m_hFile);
+		m_hFile=INVALID_HANDLE_VALUE;
+
+		TString str=m_chFileName;
+		TString  strSrc,strDest;
+		strSrc=str+TString(".log");
+		strDest=str+TString("_bak.log");
+		MoveFileExA(strSrc.c_str(),strDest.c_str(),MOVEFILE_REPLACE_EXISTING);
+		str+=".log";
+		m_idx.dwPos=0L;
+		Init(str.c_str(),m_nMinLevel);
+	}
+	LeaveCriticalSection(&m_cs);
+}
+
+void CLog::PutMsg(const char *szFmt, ...)
+{
+	if (!szFmt)
+		return;
+
+	va_list ap;
+	va_start(ap, szFmt);
+	size_t nLength = _vsnprintf(nullptr, 0, szFmt, ap) + 1;
+	CBuffers buffer;
+	char* szLogMsg = buffer.GetBuf(nLength);
+	_vsnprintf(szLogMsg, nLength, szFmt, ap);
+	va_end(ap);
+	Put(szLogMsg);
+}
+
+void CLog::PutMsg(const wchar_t *szFmt, ...)
+{
+	if (!szFmt)
+		return;
+
+	va_list ap;
+	va_start(ap, szFmt);
+	size_t nLength = _vsntprintf(nullptr, 0, szFmt, ap) + 1;
+	CBuffers buffer;
+	TCHAR* szLogMsg = (TCHAR*)buffer.GetBuf(nLength*2);
+	_vsntprintf(szLogMsg, nLength, szFmt, ap);
+	va_end(ap);
+	Put((char*)UnicodeToGB2312(szLogMsg).c_str());
+}

+ 65 - 0
MFCApplication1/Log.h

@@ -0,0 +1,65 @@
+// Log.h: interface for the CLog class.
+//
+//////////////////////////////////////////////////////////////////////
+//ÈÕÖ¾Éú³ÉÀà
+#if !defined(AFX_LOG_H__AAF3D405_307B_4E82_897B_1B2DA3810F1B__INCLUDED_)
+#define AFX_LOG_H__AAF3D405_307B_4E82_897B_1B2DA3810F1B__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+#include "BaseUtility.h"
+#include "Instance.h"
+
+class CLog : public Instance<CLog>
+{
+	enum enmLogLevel{
+		LogLvlFatal = 0,
+		LogLvlFailed,
+		LogLvlError,
+		LogLvlWarnning,
+		LogLvlInfo,
+		LogLvlTrace,
+		LogLvlDebug,
+		LogLvlAll
+	};
+	friend class Instance<CLog>;
+private:
+	CLog();
+public:
+	~CLog();
+public:
+	void SetMinLevel(UINT nLevel){m_nMinLevel=nLevel;};
+	void Put(const wchar_t* pszMsg, UINT nLevel = LogLvlFatal);
+	void Put(char* pszMsg, UINT nLevel = LogLvlFatal);
+	void PutMsg(const char *szFmt, ...);
+
+	void PutMsg(const wchar_t * szFmt, ...);
+
+	BOOL Init(const char* pszFileName,UINT nMinLevel,UINT nMaxSizeMB=10);
+
+protected:
+	UINT m_nMinLevel;
+	UINT m_nMaxLogSize;
+
+#ifdef _LOGCONSOLE
+	CThreadPrintLog			_loger;
+#else
+	typedef struct __tagLogIndex{
+		DWORD dwPos;
+		DWORD dwLen;
+		BYTE nLevel;
+		__tagLogIndex():dwPos(0L),dwLen(0L),nLevel(LogLvlAll)
+		{
+		};
+	}LOGINDEX;
+
+	HANDLE m_hFile;
+	
+	LOGINDEX m_idx;
+	char m_chFileName[260];
+	CRITICAL_SECTION m_cs;
+#endif // _DEBUG
+};
+
+#endif // !defined(AFX_LOG_H__AAF3D405_307B_4E82_897B_1B2DA3810F1B__INCLUDED_)

+ 5 - 0
MFCApplication1/MFCApplication1.vcxproj

@@ -192,8 +192,11 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClInclude Include="BaseUtility.h" />
+    <ClInclude Include="Buffers.h" />
     <ClInclude Include="CvxText.h" />
     <ClInclude Include="framework.h" />
+    <ClInclude Include="Instance.h" />
+    <ClInclude Include="Log.h" />
     <ClInclude Include="MFCApplication1.h" />
     <ClInclude Include="MFCApplication1Dlg.h" />
     <ClInclude Include="pch.h" />
@@ -202,7 +205,9 @@
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="BaseUtility.cpp" />
+    <ClCompile Include="Buffers.cpp" />
     <ClCompile Include="CvxText.cpp" />
+    <ClCompile Include="Log.cpp" />
     <ClCompile Include="MFCApplication1.cpp" />
     <ClCompile Include="MFCApplication1Dlg.cpp" />
     <ClCompile Include="pch.cpp">

+ 15 - 0
MFCApplication1/MFCApplication1.vcxproj.filters

@@ -39,6 +39,15 @@
     <ClInclude Include="BaseUtility.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="Instance.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="Log.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="Buffers.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="MFCApplication1.cpp">
@@ -56,6 +65,12 @@
     <ClCompile Include="BaseUtility.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="Log.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="Buffers.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="MFCApplication1.rc">