Esempio n. 1
0
bool COptionsDlgSelector::ValidateFiles( const CStdString& sDocOne, const int nIndex, const CStdString& sDocTwo )
{	
	CStdString sResolvedDocID1, sResolvedDocID2;
	sResolvedDocID1 = m_documentIDLookup[sDocOne];
	sResolvedDocID2 = m_documentIDLookup[sDocTwo];
	//If the lookup failed it means that a MRU was not selected
	//So we're trying to load the original selection from a right-click compare.
	// Lookup display name in file name/display name pairs retrieved from command line
	if ( sResolvedDocID1.IsEmpty())
	{
		sResolvedDocID1 = sDocOne;
	}
	if ( sResolvedDocID2.IsEmpty())
	{		
		sResolvedDocID2 = GetModifiedDocumentPathFromDisplayName(sDocTwo);
		if ( sResolvedDocID2.IsEmpty())
			sResolvedDocID2 = sDocTwo;
	}

	if (sResolvedDocID1.IsEmpty() || sResolvedDocID2.IsEmpty())
		return false;

	// We don't allow PDF compare within Compare Standalone
	if( !ValidateFileFormats(sResolvedDocID1, nIndex, sResolvedDocID2) )
		return false;

	// TODO: Need more logic after we have decided to compare the same documents, 
	if( sResolvedDocID1.CompareNoCase(sResolvedDocID2) == 0 )
	{
		// Shouldn't get here if the doc ID is empty
		_ASSERTE(!sResolvedDocID1.IsEmpty());

		if (GetApp()->ShowMessageEx(this->m_hWnd, 
			CStdStringW::LoadResource(IDS_TXTEX_theOriginalAndModifiedDocumentsAreSameDoYouWantToContinue5084,_T("The original and modified documents are the same!  Do you want to continue?")),
			WsYesNo, 
			WsDefault, 
			WsInfoIcon,
			L"Same Document", 
			CDeltaVwApp::GetProductHelpID(HIDC_COMPARE_SAME_DOCUMENTS),
			LOG_LOCATION) != IDYES)
		{
			return false;
		}
	}	

	if ( GetServiceID(sResolvedDocID1).GetLength() == 0 )
	{
		sResolvedDocID1 = GetLFSServiceName() + sResolvedDocID1;
	}

	if ( GetServiceID(sResolvedDocID2).GetLength() == 0 )
	{
		sResolvedDocID2 = GetLFSServiceName() + sResolvedDocID2;
	}

	SetDocumentPathDisplayOne( sResolvedDocID1, sResolvedDocID1 );
	SetDocumentPathDisplayTwo( nIndex, sResolvedDocID2, sDocTwo );

	return true;
}
Esempio n. 2
0
HRESULT DocProvHelper::CheckConnection(CStdString szDocumentID)
{
	HRESULT hRes = E_FAIL;

	if(FAILED(hRes = VerifyConnection( GetServiceID( szDocumentID ), true, true )))
	{
		/* TXTEX_IGNORE */ 		if (FAILED(VerifyConnection(_T("file"), true, false)))
			return hRes;	
		else
			hRes = S_FALSE;
	}
	return hRes;
}
Esempio n. 3
0
bool LogServer::RegToRouter(int nRouterServiceID)
{
	ROUTER* poRouter = g_poContext->GetRouterMgr()->GetRouterByServiceID(nRouterServiceID);
	assert(poRouter != NULL);
	Packet* poPacket = Packet::Create(nPACKET_DEFAULT_SIZE, nPACKET_OFFSET_SIZE, __FILE__, __LINE__);

	PacketWriter oPW(poPacket);
	oPW << (int)Service::SERVICE_LOG;

	INNER_HEADER oHeader(NSSysCmd::ssRegServiceReq, g_poContext->GetServerID(), GetServiceID(), 0, nRouterServiceID, 0);
	poPacket->AppendInnerHeader(oHeader, NULL, 0);
	if (!m_poInnerNet->SendPacket(poRouter->nSession, poPacket))
	{
		poPacket->Release(__FILE__, __LINE__);
		return false;
	}
	return true;
}
Esempio n. 4
0
void LogServer::OnInnerNetMsg(int nSessionID, Packet* poPacket)
{
	assert(poPacket != NULL);
	INNER_HEADER oHeader;
	int* pSessionArray = NULL;
	if (!poPacket->GetInnerHeader(oHeader, &pSessionArray, true))
	{
		XLog(LEVEL_INFO, "%s: Get inner header fail\n", GetServiceName());
		poPacket->Release(__FILE__, __LINE__);
		return;
	}
	if (oHeader.uTarServer != g_poContext->GetServerID() || oHeader.nTarService != GetServiceID())
	{
		XLog(LEVEL_INFO, "%s: Tar server:%d service:%d error\n", GetServiceName(), oHeader.uTarServer, oHeader.nTarService);
		poPacket->Release(__FILE__, __LINE__);
		return;
	}
	g_poContext->GetPacketHandler()->OnRecvInnerPacket(nSessionID, poPacket, oHeader, pSessionArray);
}