projectzip6.cpp

来自「壓縮及解壓縮的原始碼(Microsoft visual c++)」· C++ 代码 · 共 95 行

CPP
95
字号
// ProjectZip6.cpp: implementation of the CProjectZip6 class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ProjectZip6.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

enum { PZIP_OK, PZIP_CREATEFILE, PZIP_CANCELLED };

CProjectZip6::CProjectZip6(LPCTSTR szProjectFilePath, HWND hwndParent)
	 : CProjectZipBase(szProjectFilePath, hwndParent)
{
	AddWorkspaceExtension("dsw");
	AddProjectExtension("dsp");
	AddOtherProjFileExtension("clw");
	AddOtherProjFileExtension("ncb");
	AddOtherProjFileExtension("opt");
}

CProjectZip6::~CProjectZip6()
{

}

BOOL CProjectZip6::GetNextFile(CStdioFile& fileProject, CString& sFilePath)
{
	CString sLine;
	sFilePath.Empty();

	// read to start of next source
	while (fileProject.ReadString(sLine) && sLine.Find("# Begin Source File") == -1);

	// then read to actual file
	while (fileProject.ReadString(sLine) && sLine.Find("SOURCE=") == -1);

	// extract path to right of 'SOURCE='
	int nFind = sLine.Find("SOURCE=");

	if (nFind != -1)
	{
		sFilePath = sLine.Mid(nFind + lstrlen("SOURCE="));

		// cleanup
		sFilePath.Replace('\"', ' ');
		sFilePath.TrimLeft();
		sFilePath.TrimRight();

		TRACE ("%s\n", sFilePath);
	}

	return !sFilePath.IsEmpty();
}

BOOL CProjectZip6::GetNextProjectFile(CStdioFile& fileWorkspace, CString& sFilePath)
{
	CString sLine;
	sFilePath.Empty();

	// read to start of next source
	while (fileWorkspace.ReadString(sLine) && sLine.Find("Project:") == -1);

	// extract path to right of '"='
	int nFind = sLine.Find("\"=");

	if (nFind != -1)
	{
		sFilePath = sLine.Mid(nFind + lstrlen("\"="));

		nFind = sFilePath.Find("- Package Owner");

		if (nFind != -1)
			sFilePath = sFilePath.Left(nFind - 1);

		// cleanup
		sFilePath.Replace('\"', ' ');
		sFilePath.TrimLeft();
		sFilePath.TrimRight();

		TRACE ("%s\n", sFilePath);
	}

	return !sFilePath.IsEmpty();
}

⌨️ 快捷键说明

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