www.pudn.com > FileGuard.zip > FGCommandLineInfo.cpp


// FGCommandLineInfo.cpp: implementation of the CFGCommandLineInfo class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "FileGuard.h" 
#include "FileGuardApp.h" 
#include "FGCommandLineInfo.h" 
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char THIS_FILE[]=__FILE__; 
#define new DEBUG_NEW 
#endif 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
 
CFGCommandLineInfo::CFGCommandLineInfo() 
{ 
	m_bIsOpenByRightKey=FALSE; 
} 
 
CFGCommandLineInfo::~CFGCommandLineInfo() 
{ 
 
} 
 
void CFGCommandLineInfo::ParsePath() 
{ 
	//AfxMessageBox("Parsing path now!"); 
 
	if(m_bIsOpenByRightKey==FALSE || m_strFileName.IsEmpty())	return; 
 
	if(m_protectedObjectType==DRIVE) 
	{ 
		//remove char " . 
		m_strFileName.Remove('"'); 
		if(m_strFileName.Right(1)!='\\') 
			m_strFileName+="\\*"; 
	} 
	else if(m_protectedObjectType==DIRECTORY) 
	{ 
		m_strFileName+="\\*"; 
	} 
	//else if((m_protectedObjectType==FILE)		needless to handle it. 
} 
 
void CFGCommandLineInfo::ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast) 
{ 
	//AfxMessageBox(pszParam); 
 
	//This param is passed from opening by right key. 
	if(!lstrcmpi(pszParam,"directory")) 
	{ 
		m_protectedObjectType=DIRECTORY; 
		m_bIsOpenByRightKey=TRUE; 
	} 
	else if(!lstrcmpi(pszParam,"file"))	 
	{ 
		m_protectedObjectType=FILE; 
		m_bIsOpenByRightKey=TRUE; 
	} 
	else if(!lstrcmpi(pszParam,"drive")) 
	{ 
		m_protectedObjectType=DRIVE; 
		m_bIsOpenByRightKey=TRUE; 
	} 
	else if(!lstrcmpi(pszParam, "systemstartup")) 
		bSysStartUp=TRUE; 
	else if(pszParam[0]=='#')		//Get file name.(file name is between two '*'.) 
		for(int i=1; pszParam[i]!='#' && i<=MAX_PATH; i++) 
			m_strFileName+=pszParam[i]? pszParam[i]: ' ';        //change NULL char to white-space char. 
	else if(!lstrcmpi(pszParam, "Watcher")) 
		bWatcher=TRUE; 
 
	CCommandLineInfo::ParseParam(pszParam, bFlag, bLast); 
	return; 
}