Beispiel #1
0
void CuDlgMain::OnRestore()
{
	// TODO: The property sheet attached to your project
	// via this function is not hooked up to any message
	// handler.  In order to actually use the property sheet,
	// you will need to associate this function with a control
	// in your project such as a menu item or tool bar button.
	POSITION pos = m_listDifference.GetHeadPosition();
	while (pos != NULL)
	{
		CaCdaDifference* pDiff = m_listDifference.GetNext(pos);
		if (pDiff->GetType() != CDA_GENERAL)
			break;
		if (pDiff->GetName().CompareNoCase(_T("VERSION")) == 0)
		{
			CString strMsg = _T("");
			CString strV1,strV2;
			int iPos1,iPos2;
			int iePos1,iePos2;
			iPos1 = pDiff->GetValue1().Find(_T('('));
			iPos2 = pDiff->GetValue2().Find(_T('('));
			iePos1 = pDiff->GetValue1().Find(_T('/'));
			iePos2 = pDiff->GetValue2().Find(_T('/'));
			if (iPos1!=-1 && (iePos1 > iPos1))
				strV1 = pDiff->GetValue1().Mid(iPos1,(iePos1-iPos1));
			else
				strV1 = pDiff->GetValue1();

			if (iPos2!=-1 && (iePos2 > iPos2))
				strV2 = pDiff->GetValue2().Mid(iPos2,(iePos2-iPos2));
			else
				strV2 = pDiff->GetValue2();

			strV1.TrimLeft();
			strV1.TrimRight();
			strV2.TrimLeft();
			strV2.TrimRight();
			if (strV1.CompareNoCase(strV2) != 0)
			{
				AfxFormatString2(strMsg, IDS_MSG_DIFF_PLATFORM, (LPCTSTR)strV1, (LPCTSTR)strV2);
				AfxMessageBox (strMsg);
				return;
			}
		}
	}

	CxPSheetRestore propSheet(m_listDifference, NULL);
	propSheet.m_Page3.SetSnapshot(m_strSnapshot2);

	CaRestoreParam& data = propSheet.GetData();
	data.m_plg1 = &m_lg1;
	data.m_plg2 = &m_lg2;
	data.m_plc1 = &m_lc1;
	data.m_plc2 = &m_lc2;
	data.m_ples1= &m_les1;
	data.m_ples2= &m_les2;
	data.m_pleu1= &m_leu1;
	data.m_pleu2= &m_leu2;
	data.m_plvn1= &m_lvn1;
	data.m_plvn2= &m_lvn2;
	data.m_plOtherhost1= &m_lOtherhost1;
	data.m_plOtherhost2= &m_lOtherhost2;
	data.m_plistDifference = &m_listDifference;
	data.m_pIngresVariable = &m_ingresVariable;

	int nAnswer = propSheet.DoModal();

	// This is where you would retrieve information from the property
	// sheet if propSheet.DoModal() returned IDOK.  We aren't doing
	// anything for simplicity.
	if (nAnswer != IDCANCEL)
	{
		CuVcdaCtrl* pParent = (CuVcdaCtrl*)GetParent();
		if (!pParent)
			return;
		pParent->DoCompare();
	}
}
Beispiel #2
0
void CuDlgMain::DisplayDifference(UINT nMask)
{
	CuDlgPageDifference* pDlgPageOtherHost = NULL;
	CuDlgPageDifference* pDlgPageVNode = NULL;
	TCITEM item;
	memset (&item, 0, sizeof (item));
	item.mask = TCIF_PARAM;
	m_cTab1.GetItem(0, &item);
	CuDlgPageDifference* pDlgPageConfig = (CuDlgPageDifference*)item.lParam;
	m_cTab1.GetItem(1, &item);
	CuDlgPageDifference* pDlgPageEnvSystem = (CuDlgPageDifference*)item.lParam;
	m_cTab1.GetItem(2, &item);
	CuDlgPageDifference* pDlgPageEnvUser = (CuDlgPageDifference*)item.lParam;
#if defined (_VIRTUAL_NODE_AVAILABLE)
	m_cTab1.GetItem(3, &item);
	pDlgPageVNode = (CuDlgPageDifference*)item.lParam;
#endif
	if (m_cTab1.GetItem(OTHER_HOST_INDEX, &item))
		pDlgPageOtherHost = (CuDlgPageDifference*)item.lParam;

	if (nMask & PARAM_GENERAL)
		m_compareParam.CleanIgnore();
	CString strValue1;
	CString strValue2;
	CaCdaDifference* pObj = NULL;
	POSITION pos = m_listDifference.GetHeadPosition();
	while (pos != NULL)
	{
		int nImage = -1;
		CaCdaDifference* pObj = m_listDifference.GetNext(pos);
		strValue1 = pObj->GetValue1();
		strValue2 = pObj->GetValue2();
		TCHAR& c = pObj->GetDifference();
		switch (c)
		{
		case _T('+'):
			nImage = 0;
			strValue2 = _T("n/a");
			break;
		case _T('-'):
			nImage = 1;
			strValue1 = _T("n/a");
			break;
		case _T('!'):
			nImage = 2;
			break;
		case _T('='):
			nImage = 3;
			break;
		default:
			break;
		}

		if (nMask & PARAM_GENERAL)
		{
			if (c != _T('=') && pObj->GetType() == CDA_GENERAL)
			{
				int nIdx = 0;
				int nCount = m_listMainParam.GetItemCount();
				nIdx = m_listMainParam.InsertItem (nCount, pObj->GetName(), nImage);
				m_listMainParam.SetItemText (nIdx, 1, strValue1);
				m_listMainParam.SetItemText (nIdx, 2, strValue2);
				if (PrecheckIgnore(pObj->GetName()))
				{
					m_listMainParam.SetCheck(nIdx, 3, TRUE);
					m_compareParam.AddIgnore(pObj->GetName());
				}
				m_listMainParam.SetItemData(nCount, (LPARAM)pObj);
			}
		}

		if (nMask & PARAM_CONFIGxENV)
		{
			switch (pObj->GetType())
			{
			case CDA_CONFIG:
				if (pDlgPageConfig)
				{
					if (!pObj->GetHost().IsEmpty())
					{
						if (pObj->GetHost().CompareNoCase(m_compareParam.GetHost1()) != 0 && 
							pObj->GetHost().CompareNoCase(m_compareParam.GetHost2()) != 0 )
							break;
					}
					CListCtrl* pListCtrl = pDlgPageConfig->GetListCtrl();
					int nIdx = 0;
					int nCount = pListCtrl->GetItemCount();
					nIdx = pListCtrl->InsertItem (nCount, pObj->GetName(), nImage);
					pListCtrl->SetItemText (nIdx, 1, strValue1);
					pListCtrl->SetItemText (nIdx, 2, strValue2);
				}
				break;
			case CDA_ENVSYSTEM:
				if (pDlgPageEnvSystem)
				{
					CListCtrl* pListCtrl = pDlgPageEnvSystem->GetListCtrl();
					int nIdx = 0;
					int nCount = pListCtrl->GetItemCount();
					nIdx = pListCtrl->InsertItem (nCount, pObj->GetName(), nImage);
					pListCtrl->SetItemText (nIdx, 1, strValue1);
					pListCtrl->SetItemText (nIdx, 2, strValue2);
				}
				break;
			case CDA_ENVUSER:
				if (pDlgPageEnvUser)
				{
					CListCtrl* pListCtrl = pDlgPageEnvUser->GetListCtrl();
					int nIdx = 0;
					int nCount = pListCtrl->GetItemCount();
					nIdx = pListCtrl->InsertItem (nCount, pObj->GetName(), nImage);
					pListCtrl->SetItemText (nIdx, 1, strValue1);
					pListCtrl->SetItemText (nIdx, 2, strValue2);
				}
				break;
			case CDA_VNODE:
#if defined (_VIRTUAL_NODE_AVAILABLE)
				if (pDlgPageVNode)
				{
					CListCtrl* pListCtrl = pDlgPageVNode->GetListCtrl();
					int nIdx = 0;
					int nCount = pListCtrl->GetItemCount();
					nIdx = pListCtrl->InsertItem (nCount, pObj->GetName(), nImage);
					pListCtrl->SetItemText (nIdx, 1, strValue1);
					pListCtrl->SetItemText (nIdx, 2, strValue2);
				}
#endif
				break;
			default:
				break;
			}
		}
	}

	//
	// Other configured host names:
	if (nMask && PARAM_OTHERHOST)
	{
		pos = m_listDifferenceOtherHost.GetHeadPosition();
		while (pos != NULL)
		{
			CaCdaDifference* pObj = m_listDifferenceOtherHost.GetNext(pos);
			strValue1 = pObj->GetValue1();
			strValue2 = pObj->GetValue2();
			TCHAR& c = pObj->GetDifference();
			int nImage = GetImageIndex(c);
			switch (c)
			{
			case _T('+'):
				strValue2 = _T("n/a");
				break;
			case _T('-'):
				strValue1 = _T("n/a");
				break;
			default:
				break;
			}

			switch (pObj->GetType())
			{
			case CDA_CONFIG:
				if (pDlgPageOtherHost)
				{
					CListCtrl* pListCtrl = pDlgPageOtherHost->GetListCtrl();
					int nIdx = 0;
					int nCount = pListCtrl->GetItemCount();
					nIdx = pListCtrl->InsertItem (nCount, pObj->GetName(), nImage);
					pListCtrl->SetItemText (nIdx, 1, strValue1);
					pListCtrl->SetItemText (nIdx, 2, strValue2);
				}
				break;
			default:
				break;
			}
		}
	}
}