Beispiel #1
0
long CuDlgMain::OnUpdataData (WPARAM wParam, LPARAM lParam)
{
	BOOL bCheck = (BOOL)wParam;
	int  nItem  = (int)lParam;
	CWaitCursor doWaitCursor;
	int i, nCount = m_cTab1.GetItemCount();
	TCITEM item;
	memset (&item, 0, sizeof (item));
	item.mask = TCIF_PARAM;
	for (i=0; i<nCount; i++)
	{
		m_cTab1.GetItem(i, &item);
		CWnd* pDlgPage = (CWnd*)item.lParam;
		if (pDlgPage && IsWindow(pDlgPage->m_hWnd))
		{
			pDlgPage->SendMessage(WMUSRMSG_UPDATEDATA, 0, 0);
		}
	}

	//
	// Clean up the current differences:
	POSITION p, pos = m_listDifference.GetHeadPosition();
	while (pos != NULL)
	{
		p = pos;
		CaCdaDifference* pObj = m_listDifference.GetNext(pos);
		if (pObj->GetType() != CDA_GENERAL)
		{
			m_listDifference.RemoveAt(p);
			delete pObj;
		}
	}
	m_compareParam.CleanIgnore();
	nCount = m_listMainParam.GetItemCount();
	for (i=0; i<nCount; i++)
	{
		CaCdaDifference* pObj = (CaCdaDifference*)m_listMainParam.GetItemData(i);
		CString strName = pObj->GetName();
		strName.MakeLower();
		if (m_listStrPrecheckIgnore.Find(strName) != NULL)
		{
			if (m_listMainParam.GetCheck (i, 3))
			{
				m_compareParam.AddIgnore (strName);
			}
		}
	}
	UINT nMask = PARAM_CONFIGxENV;
	UpdateDifferences(nMask);
	return 0;
}
Beispiel #2
0
BOOL CuPropertyPageRestoreOption::OnInitDialog()
{
    CPropertyPage::OnInitDialog();
    CxPSheetRestore* pParent = (CxPSheetRestore*)GetParent();
    CaRestoreParam& Restore = pParent->GetData();

    HICON hIcon = theApp.LoadStandardIcon(IDI_EXCLAMATION);
    m_cIconWarning.SetIcon(hIcon);
    m_cIconWarning.Invalidate();
    DestroyIcon(hIcon);

#if !defined (_VIRTUAL_NODE_AVAILABLE)
    m_cCheckVNode.ShowWindow(SW_HIDE);
#endif

    CTypedPtrList<CObList, CaNameValue*> listEnvirenment;
    CaNameValue* pEnv = new CaNameValue(_T("II_TEMPORARY"), _T(""));
    listEnvirenment.AddTail(pEnv);
    INGRESII_CheckVariable (listEnvirenment);

    CString strBackupFile = pEnv->GetValue();
    if (!strBackupFile.IsEmpty())
    {
        strBackupFile += consttchszPathSep;
    }

    int i = 0;
    CString strFile = strBackupFile + _T("backup.ii_vcda");
    for (i=0; i<1024; i++)
    {
        if (i==0)
        {
            if (_taccess(strFile, 0) == -1)
                break;
        }
        else
        {
            strFile.Format (_T("backup%04d.ii_vcda"), i);
            strFile = strBackupFile + strFile;
            if (_taccess(strFile, 0) == -1)
                break;
        }
    }
    if (i == 1024)
    {
        CString strMsg;
        AfxFormatString1(strMsg, IDS_MSG_TOOMANAY_BACKUPFILE, (LPCTSTR)pEnv->GetValue());
        AfxMessageBox (strMsg);
    }
    else
    {
        m_cEditBackup.SetWindowText(strFile);
    }

    while (!listEnvirenment.IsEmpty())
        delete listEnvirenment.RemoveHead();

    //
    // Initialize the list of READONLY variables:
    BOOL bVariableDiff = FALSE;
    CString strII = INGRESII_QueryInstallationID(FALSE);
    CTypedPtrList< CObList, CaCdaDifference* >* pLd = Restore.m_plistDifference;
    if (pLd)
    {
        POSITION pos = pLd->GetHeadPosition();
        while (pos != NULL)
        {
            CaCdaDifference* pDiff = pLd->GetNext(pos);
            if (pDiff->GetType() == CDA_ENVSYSTEM || pDiff->GetType() == CDA_ENVUSER)
            {
                if (CaIngresVariable::IsReadOnly(pDiff->GetOriginalName(), strII))
                {
                    m_cListROVariable.AddString(pDiff->GetName());
                    bVariableDiff = TRUE;
                }
            }
        }
    }

    if (!bVariableDiff)
    {
        HICON hIcon = theApp.LoadStandardIcon(IDI_ASTERISK);
        m_cIconWarning.SetIcon(hIcon);
        m_cIconWarning.Invalidate();
        DestroyIcon(hIcon);
        m_cListROVariable.ShowWindow(SW_HIDE);
        CString strMsgInfo;
        strMsgInfo.LoadString(IDS_MSG_VARIABLE_RO);
        m_cStaticNonEditVariableInfo.SetWindowText(strMsgInfo);
    }

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Beispiel #3
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 #4
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;
			}
		}
	}
}