Exemplo n.º 1
0
BOOL CSmtShell::IsWorkEvn(char *pCrtPath, char *pRetPath)
{
	if(NULL == pCrtPath || NULL == pRetPath){
		return FALSE;
	}

	char CrtPath[255], tempPath[255];
	memset(CrtPath, 0, sizeof(CrtPath));
	memcpy(CrtPath, pCrtPath, strlen(pCrtPath));

	while(1){
		memset(tempPath, 0, sizeof(tempPath));
		sprintf(tempPath, "%s\\SmtRec.dat", CrtPath);
		if(!PathFileExists(tempPath)){
			char FatherPath[255];
			memset(FatherPath, 0, sizeof(FatherPath));
			if(!GetFatherPath(CrtPath, FatherPath)){
				return FALSE;
			}
			memset(CrtPath, 0, sizeof(CrtPath));
			memcpy(CrtPath, FatherPath, sizeof(FatherPath));
		}
		else{
			memcpy(pRetPath, CrtPath, sizeof(CrtPath));
			break;
		}
	}

	return TRUE;
}
Exemplo n.º 2
0
BOOL CSmtShell::IsFatherAdd()
{
	if(!strcmp(m_EnvPath, m_szFile[0])){
		return FALSE;
	}

	char FatherPath[255];
	memset(FatherPath, 0, sizeof(FatherPath));

	if(!GetFatherPath(m_szFile[0], FatherPath)){
		return FALSE;
	}

	if(!strcmp(m_EnvPath, FatherPath)){
		return FALSE;
	}

	string StatusStr;
	string StatusCmd = "svn status ";
	StatusCmd += "\"";
	StatusCmd += FatherPath;
	StatusCmd += "\"";
	StatusStr += ExeCmd((char *)StatusCmd.c_str());
	if(0 == StatusStr.find("A       ")){
		if(IsSamePath(StatusStr, FatherPath)){
			return TRUE;
		}
	}

	return FALSE;
}
Exemplo n.º 3
0
BOOL CSmtShell::IsFatherInCtr()
{
	char FatherPath[255];
	memset(FatherPath, 0, sizeof(FatherPath));

	if(!GetFatherPath(m_szFile[0], FatherPath)){
		return FALSE;
	}

	if(!strcmp(FatherPath, m_EnvPath)){
		char SvnPath[255];
		memset(SvnPath, 0, sizeof(SvnPath));
		sprintf(SvnPath, "%s\\.svn", m_EnvPath);
		if(PathFileExists(SvnPath)){
			return TRUE;
		}
	}

	char FilePath[255];
	memset(FilePath, 0, sizeof(FilePath));
	sprintf(FilePath, "%s\\SmtRec.dat", m_EnvPath);

	FILE *fp = fopen(FilePath, "r");
	if(NULL == fp){
		return FALSE;
	}

	fseek(fp, 0, SEEK_END);
	long fileLength = ftell(fp);
	int CycleTimes = (int)fileLength/255 - 1;
	fseek(fp, 255, SEEK_SET);

	char ReadBuff[255];
	int i = 0;

	for(i = 0; i < CycleTimes; i++){
		memset(ReadBuff, 0, sizeof(ReadBuff));
		fread(ReadBuff, 1, sizeof(ReadBuff), fp);
		if(!strcmp(ReadBuff, FatherPath+strlen(m_EnvPath))){
			break;
		}
	}

	fclose(fp);

	if(i < CycleTimes){
		return TRUE;
	}

	return FALSE;
}
Exemplo n.º 4
0
void CRegisterDlg::OnTvnSelchangedTree(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);

	if(!m_isEnable)	
	{
		return;
	}
	m_isEnable=FALSE;;

	TVITEM Item = pNMTreeView->itemNew;

	if(Item.hItem == m_hRoot)
	{
		m_isEnable=TRUE;;
		return;
	}


	m_hSelectedItem=Item.hItem;			//保存用户打开的子树节点句柄   //0  1 2 2 3
	m_ControlList.DeleteAllItems();

	CString strFullPath=GetFullPath(m_hSelectedItem);    //获得键值路径  

	char bToken=GetFatherPath(strFullPath);       //[2] \1\2\3
	//愈加一个键
	int nitem=m_ControlList.InsertItem(0,"(默认)",0);
	m_ControlList.SetItemText(nitem,1,"REG_SZ");	
	m_ControlList.SetItemText(nitem,2,"(数据未设置值)");


	strFullPath.Insert(0,bToken);//插入  那个根键
	bToken=COMMAND_REG_FIND;
	strFullPath.Insert(0,bToken);      //插入查询命令  [COMMAND_REG_FIND][x]

	m_iocpServer->OnClientPreSending(m_ContextObject, (LPBYTE)(strFullPath.GetBuffer(0)), strFullPath.GetLength()+1);
	
	m_isEnable = TRUE;


	*pResult = 0;
}
Exemplo n.º 5
0
BOOL IsWorkCopy(string sCrtPath, string &sWcPath)
{
	string sSvnPath, sFathPath;

	while(1){
		sSvnPath = sCrtPath + "\\.svn";
		if(PathFileExists(sSvnPath.c_str())){
			sWcPath = sCrtPath;
			break;
		}
		else{
			if(!GetFatherPath(sCrtPath, sFathPath)){
				return FALSE;
			}
			sCrtPath = sFathPath;
			sFathPath = "";
		}
	}

	return TRUE;
}
Exemplo n.º 6
0
bool GetWcPath(string sCrtPath, string &sWcPath)
{
	string sFatherPath = sCrtPath;
	string sSvnPath;

	while(1){
		sSvnPath = sCrtPath + "\\.svn";
		if(PathFileExists(sSvnPath.c_str())){
			sWcPath = sCrtPath;
			return true;
		}

		if(GetFatherPath(sCrtPath, sFatherPath)){
			sCrtPath = sFatherPath;
		}
		else{
			break;
		}
	}

	return false;
}