Ejemplo n.º 1
1
BOOL CAutoUpdateDlg::CheckVersionUpdate(CString& strUpdateURL)
{
	BOOL bHasUpdate = FALSE;

	HRESULT hr = S_OK;
	IXMLHTTPRequestPtr pHttpRequest;
	IDispatchPtr pDispatch;
	MSXML2::IXMLDOMDocumentPtr pXmlDoc;
	MSXML2::IXMLDOMNodeListPtr pList;
	MSXML2::IXMLDOMElementPtr pChild;

	UINT nFileSize;
	CString strFileName, strFileVer, strMD5String;
	LONG lElementCount = 0L;

	try
	{
		hr = pHttpRequest.CreateInstance(TEXT("Msxml2.XMLHTTP.3.0"));
		if( FAILED(hr) )
			_com_issue_error(hr);

		hr = pHttpRequest->open(TEXT("GET"), (_bstr_t)strUpdateURL, false);
		if( FAILED(hr) )
			_com_issue_error(hr);

		hr = pHttpRequest->send();
		if( FAILED(hr) )
			_com_issue_error(hr);

		if (pHttpRequest->Getstatus() != 200)
			throw (0);

		pDispatch = pHttpRequest->GetresponseXML();
		hr = pDispatch->QueryInterface(pXmlDoc.GetIID(), (void**)&pXmlDoc);
		if( FAILED(hr) )
			_com_issue_error(hr);

		pList = pXmlDoc->selectNodes("/manifest/filelist/file");
		lElementCount = pList->Getlength();
		for( LONG i = 0; i < lElementCount; i++ )
		{
			pChild = pList->Getitem(i);
			strFileName = pChild->getAttribute("filename");
			nFileSize = pChild->getAttribute("filesize");
			strFileVer = pChild->getAttribute("fileversion");
			strMD5String = pChild->getAttribute("md5");

			//如果本地文件存在则效验文件,不存在就下载这个文件
			if (PathFileExists(m_strCurrentDir+strFileName))
			{
				//效验文件,如果MD5码不相同则重新下载
				if (CMD5Checksum::GetMD5(m_strCurrentDir+strFileName) != strMD5String)
				{
					m_ulTotalLength += nFileSize;
					m_DownloadMgr.AddTask(strFileName);
					bHasUpdate = TRUE;
				}	
			}
			else
			{
				m_ulTotalLength += nFileSize;
				m_DownloadMgr.AddTask(strFileName);
				bHasUpdate = TRUE;
			}
		}

		return bHasUpdate;
	}
#ifdef _DEBUG
	catch(_com_error& e)
	{
		CString strError;
		strError.Format(_T("Error code:%d\nMessage:%s\nDescrption:%s"), (int)e.WCode(), e.ErrorMessage(), (TCHAR*)e.Description());
		MessageBox(strError, _T("提示"), MB_OK|MB_ICONWARNING);
		return FALSE;
	}
#endif
	catch(...)
	{
		return FALSE;
	}
}
Ejemplo n.º 2
0
void CShootManagerSys::LoadShootSolutionSector(int iSector, LPCTSTR szFilename)
{
	if(iSector >= m_ShootSolutionSectorArray.Num())		return;
	
	int i;
	MSXML2::IXMLDOMDocument2Ptr pDoc;
	pDoc.CreateInstance(__uuidof(DOMDocument40));
	pDoc->load((_variant_t)szFilename);
	
	
	// 성공한 슛부터 로드한다.
	MSXML2::IXMLDOMNodeListPtr pNodeListSuccess = pDoc->selectNodes(L"root/success");
	for(i=0; i<pNodeListSuccess->Getlength(); i++)
	{
		MSXML2::IXMLDOMNodePtr pNodeSuccess = pNodeListSuccess->Getitem(i);
		
		CShootSolution Solution;
		Solution.Create(pNodeSuccess, true, this);
		m_ShootSolutionSectorArray[iSector].first.push_back(Solution);
	}

	MSXML2::IXMLDOMNodeListPtr pNodeListFail = pDoc->selectNodes(L"root/fail");
	for(i=0; i<pNodeListFail->Getlength(); i++)
	{
		MSXML2::IXMLDOMNodePtr pNodeFail = pNodeListFail->Getitem(i);

		CShootSolution Solution;
		Solution.Create(pNodeFail, false, this);
		m_ShootSolutionSectorArray[iSector].second.push_back(Solution);
	}

	pDoc.Release();			
}
Ejemplo n.º 3
0
/******************************************************************************
Function Name  :  nLoadTestCases
Input(s)       :  MSXML2::IXMLDOMNodePtr& pTSDOM
Output         :  INT
Functionality  :
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam, GT-Derka
Date Created   :  06/04/2011
Modifications  :
Codetag        :  CS004
******************************************************************************/
INT CTestSetupEntity::nLoadTestCases(MSXML2::IXMLDOMNodePtr& pTSDOM)
{
    LONG lDefaultChannelUsed = 0;
    LONG lCount;
    _bstr_t bstrNodeName(def_STR_TESTCASE_NODE);

    MSXML2::IXMLDOMNodeListPtr pDOMTCNodeList;
    MSXML2::IXMLDOMNodePtr pIXMLDOMTestCase;
    pDOMTCNodeList = pTSDOM->selectNodes(bstrNodeName);
    pDOMTCNodeList->get_length(&lCount);
    for(int i=0; i<lCount; i++)
    {
        CTestCaseEntity odTestCaseEntity;

        pIXMLDOMTestCase = pDOMTCNodeList->Getitem(i);
        odTestCaseEntity.GetData(pIXMLDOMTestCase);
        m_odTestCaseEntityList.AddTail(odTestCaseEntity);
        lDefaultChannelUsed += odTestCaseEntity.m_lDefaultChannelUsed;
    }
    if(lDefaultChannelUsed == 1)
    {
        AfxMessageBox(_("1 entity without channel-information loaded.\nCAN-Channel 1 selected."), MB_OK | MB_ICONINFORMATION );
    }
    else if(lDefaultChannelUsed > 1)
    {
        CString str;
        str.Format("%d", lDefaultChannelUsed);
        AfxMessageBox(str + _(" entities without channel-information loaded.\nCAN-Channel 1 selected in each case."), MB_OK | MB_ICONINFORMATION );
    }
    return S_OK;

}
Ejemplo n.º 4
0
	void readVerticesNormalsTexcoords(MSXML2::IXMLDOMNodePtr mesh, geometry_t &geometry)
	{
		MSXML2::IXMLDOMNodeListPtr sourceList = mesh->selectNodes("r:source");
		vector<float> vertices;
		vector<float> normals;
		vector<float> texcoords;

		for (int i = 0; i < sourceList->length; i++)
		{
			MSXML2::IXMLDOMNodePtr source = sourceList->Getitem(i);
			MSXML2::IXMLDOMNamedNodeMapPtr attributes = source->attributes;

			for (int j = 0; j < attributes->length; j++)
			{
				_bstr_t attributeName = attributes->getNamedItem("id")->text;

				if (wcsstr(_wcslwr(attributeName), L"position"))
				{
					geometry.vertices = readArray<float>(source);
				} else if (wcsstr(_wcslwr(attributeName), L"normal"))
				{
					geometry.normals = readArray<float>(source);
				} else if (wcsstr(_wcslwr(attributeName), L"map") ||	// belnder
						   wcsstr(_wcslwr(attributeName), L"-uv"))		// 3dsmax
				{
					geometry.texcoords = readArray<float>(source);
				}
			}
		}
	}
Ejemplo n.º 5
0
//设置指定xpath的节点值
BOOL CXmlBase::SetNodeValue(LPCTSTR lpszValue, LPCTSTR lpszXPath 
	, MSXML2::IXMLDOMDocument2Ptr pDoc)
{
	if (pDoc == NULL || lpszXPath == NULL) return FALSE;
	MSXML2::IXMLDOMNodeListPtr pNodeList = pDoc->selectNodes(lpszXPath);
	long lCnt = pNodeList->Getlength();
	if (lCnt == 0) return FALSE;
	MSXML2::IXMLDOMNodePtr pNode = pNodeList->Getitem(0);
	return SetNodeValue(lpszValue, pNode);
}
Ejemplo n.º 6
0
BOOL CIconImgList::PickUpGroups( MSXML2::IXMLDOMElementPtr& piGroup, int& nIndex)
{
    MSXML2::IXMLDOMNodeListPtr piGroupList;
    piGroupList = piGroup->GetchildNodes();

    MSXML2::IXMLDOMElementPtr piNode;
    MSXML2::IXMLDOMElementPtr piChild;

    int nParent = nIndex;

    _bstr_t cBstr;
    _variant_t cVariant;
    long lCount = piGroupList->Getlength();
    for( long lIndex = 0; lIndex < lCount; lIndex++)
    {
        piNode = piGroupList->Getitem( lIndex);
        if( _bstr_t( _T( "GROUP")) == piNode->GetbaseName())
        {
            cBstr = piNode->getAttribute( _bstr_t( _T( "TITLE")));
            cVariant = piNode->getAttribute( _bstr_t( _T( "ENABLE")));
            cVariant.ChangeType( VT_BOOL);

            m_astGroupData[ nIndex] = ( GROUPDATA*)malloc( sizeof( GROUPDATA) + ( sizeof( TCHAR) * ( cBstr.length() + 1)));

            m_astGroupData[ nIndex]->nParent = nParent;
            if( 1 <= nIndex)
            {
                if( FALSE == m_astGroupData[ nParent]->blEnable)
                {
                    cVariant.boolVal = VARIANT_FALSE;
                }
            }
            m_astGroupData[ nIndex]->blEnable = ( VARIANT_FALSE == cVariant.boolVal) ? FALSE : TRUE;
            lstrcpy( m_astGroupData[ nIndex]->szName, cBstr);

            nIndex++;

            PickUpGroups( piNode, nIndex);
        }
        else if( _bstr_t( _T( "ITEM")) == piNode->GetbaseName())
        {
            cVariant = piNode->getAttribute( _bstr_t( _T( "REF")));
            cVariant.ChangeType( VT_I4);
            for( int nIndex = 0; nIndex < m_nEnableCount; nIndex++)
            {
                if( cVariant.intVal == ( m_astIconStatus[ nIndex].nID + 1))
                {
                    m_astIconStatus[ nIndex].nParent = nParent;
                }
            }
        }
    }

    return TRUE;
}
Ejemplo n.º 7
0
/******************************************************************************
Function Name  :  GetData
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CVerifyEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :
******************************************************************************/
HRESULT CVerifyEntity::GetCommonVerifyData(MSXML2::IXMLDOMNodePtr& pIDomNode, CVerifyData *verifyData)
{
	m_ouData = verifyData;
    _bstr_t bstrNodeName = def_STR_VERIFYMSG_NODE;
    CComVariant NodeValue;
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMVerifyAtrributes;
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;

    pDOMVerifyAtrributes = pIDomNode->Getattributes();
    //bstrNodeName = L"failure";
    bstrNodeName.Assign(SysAllocString(CT2W("failure")));
    pIDOMChildNode = pDOMVerifyAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);
    CString strTemp;
    strTemp = strCopyBSTRToCString(NodeValue);

	//m_ouData = new CVerifyData();
    if(strTemp == "SUCCESS")
    {
        m_ouData->m_eAttributeError = SUCCESS;
    }
    else if(strTemp == "WARNING")
    {
        m_ouData->m_eAttributeError = WARNING;
    }
    else if(strTemp == "ERRORS")
    {
        m_ouData->m_eAttributeError = ERRORS;
    }
    else
    {
        m_ouData->m_eAttributeError = FATAL;
    }
    MSXML2::IXMLDOMNodeListPtr pIDOMSendList;

    LONG lCount;
    //bstrNodeName = def_STR_VERIFYMSG_NODE;
    bstrNodeName.Assign(SysAllocString(CT2W(def_STR_VERIFYMSG_NODE)));
    pIDOMSendList = pIDomNode->selectNodes(bstrNodeName);
    pIDOMSendList->get_length(&lCount);

    for(int i = 0; i < lCount; i++)
    {
        CVerifySubEntity *odVerifySubEntity;
        MSXML2::IXMLDOMNodePtr pIXMLDOMVerifyMsgEntity;
        pIXMLDOMVerifyMsgEntity = pIDOMSendList->Getitem(i);
		//if(CVerifySubEntity::GetData(&odVerifySubEntity, pIXMLDOMVerifyMsgEntity) == S_OK)
		if(this->GetSubEntityData(&odVerifySubEntity, pIXMLDOMVerifyMsgEntity) == S_OK)
        {
            m_ouData->m_odVerifySubEntityList.push_back(odVerifySubEntity);
        }
    }
    return S_OK;
}
Ejemplo n.º 8
0
	void readGeometry(dae_reader_t *reader, MSXML2::IXMLDOMDocument2Ptr xmlDoc)
	{
		MSXML2::IXMLDOMNodeListPtr nodeList;
		nodeList = xmlDoc->selectNodes("/r:COLLADA/r:library_geometries/r:geometry");
		int count = nodeList->length;

		for (int i = 0; i < count; i++)
		{
			MSXML2::IXMLDOMNodePtr node = nodeList->Getitem(i);
			readMesh(reader, node);
		}
	}
Ejemplo n.º 9
0
void CShootManagerSys::LoadShootSolutionSector(int iSector, SFullName nameFile)
{
	if(iSector >= m_ShootSolutionSectorArray.Num())		return;
	
	int i;
	MSXML2::IXMLDOMDocument2Ptr pDoc = NULL;
	DFileGPack packFile;
	packFile.Open(nameFile);
	CFileSys::LoadBinaryXML(pDoc, packFile.GetFile(), packFile.GetSize());
	packFile.Close();

	// 성공한 슛부터 로드한다.
	MSXML2::IXMLDOMNodeListPtr pNodeListSuccess = pDoc->selectNodes(L"root/success");
	for(i=0; i<pNodeListSuccess->Getlength(); i++)
	{
		MSXML2::IXMLDOMNodePtr pNodeSuccess = pNodeListSuccess->Getitem(i);
		
		CShootSolution Solution;
		Solution.Create(pNodeSuccess, true, this);
		Solution.SetSectorIndex(iSector);
		m_ShootSolutionSectorArray[iSector].first.push_back(Solution);
	}
	
	MSXML2::IXMLDOMNodeListPtr pNodeListFail = pDoc->selectNodes(L"root/fail");
	for(i=0; i<pNodeListFail->Getlength(); i++)
	{
		MSXML2::IXMLDOMNodePtr pNodeFail = pNodeListFail->Getitem(i);
		
		CShootSolution Solution;
		Solution.Create(pNodeFail, false, this);
		Solution.SetSectorIndex(iSector);
		m_ShootSolutionSectorArray[iSector].second.push_back(Solution);
	}
	
	CFileSys::UnloadXML(pDoc);
}
Ejemplo n.º 10
0
//装入项目
void CUpdateBuilderDlg::OnBnClickedLoadItem()
{
	CFileDialog dlg(TRUE, _T("*.xml"), _T("update.xml"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, _T("XML File(*.xml)|*.xml||"));
	if (dlg.DoModal() == IDOK)
	{
		HRESULT hr = S_OK;
		MSXML2::IXMLDOMDocumentPtr	pXmlDoc;
		MSXML2::IXMLDOMNodeListPtr pNodeList;
		MSXML2::IXMLDOMElementPtr pElement;

		try
		{
			hr = pXmlDoc.CreateInstance(__uuidof(MSXML2::DOMDocument30));
			if( FAILED( hr ) ) 
				_com_issue_error(hr);

			pXmlDoc->load(CComVariant(dlg.GetPathName()));
			
			pNodeList = pXmlDoc->selectNodes("/manifest/filelist/file");
			
			m_FileListCtrl.DeleteAllItems();
			LONG lItemCount = pNodeList->Getlength();
			int nItem; 

			for (LONG lIndex = 0; lIndex < lItemCount; lIndex++)
			{
				pElement = pNodeList->Getitem(lIndex);
				nItem = m_FileListCtrl.InsertItem(0, CString(pElement->getAttribute("filename")));
				m_FileListCtrl.SetItemText(nItem, 1, CString(pElement->getAttribute("filesize")));
				m_FileListCtrl.SetItemText(nItem, 2, CString(pElement->getAttribute("fileversion")));
				m_FileListCtrl.SetItemText(nItem, 3, CString(pElement->getAttribute("md5")));
				m_FileListCtrl.SetItemData(nItem, (ULONG)pElement->getAttribute("filesize"));
			}

			SetWindowText(dlg.GetPathName());
			GetDlgItem(IDC_UPDATE_ITEM)->EnableWindow(TRUE);
		}
		catch(_com_error& e)
		{
			CString strError;
			strError.Format(_T("Error code:%d\nError Message:%s\nError Description:%s"), 
				(int)e.WCode(), e.ErrorMessage(), (char*)e.Description());
			MessageBox(strError, _T("错误"),MB_OK|MB_ICONSTOP);
		}
	}
}
Ejemplo n.º 11
0
	void CXmlNodeWrapper::RemoveNodes(LPCTSTR searchStr)
	{
		if (!IsValid())
			return;
		MSXML2::IXMLDOMNodeListPtr nodeList = m_xmlnode->selectNodes(searchStr);
		for (int i = 0; i < nodeList->Getlength(); i++)
		{
			try
			{
				MSXML2::IXMLDOMNode* pNode = nodeList->Getitem(i).Detach();
				pNode->GetparentNode()->removeChild(pNode);
			}
			catch (_com_error er)
			{
				AfxMessageBox(er.ErrorMessage());
			}
		}
	}
Ejemplo n.º 12
0
/******************************************************************************
Function Name  :  nLoadTestCases
Input(s)       :  MSXML2::IXMLDOMNodePtr& pTSDOM
Output         :  INT
Functionality  :   
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
Codetag        : CS004
******************************************************************************/
INT CTestSetupEntity::nLoadTestCases(MSXML2::IXMLDOMNodePtr& pTSDOM)
{
    LONG lCount;
    _bstr_t bstrNodeName(def_STR_TESTCASE_NODE);
    
    MSXML2::IXMLDOMNodeListPtr pDOMTCNodeList;
    MSXML2::IXMLDOMNodePtr pIXMLDOMTestCase;
    pDOMTCNodeList = pTSDOM->selectNodes(bstrNodeName);
    pDOMTCNodeList->get_length(&lCount);
    for(int i=0; i<lCount;i++)
    {
        CTestCaseEntity odTestCaseEntity;
        pIXMLDOMTestCase = pDOMTCNodeList->Getitem(i);
        odTestCaseEntity.GetData(pIXMLDOMTestCase);
        m_odTestCaseEntityList.AddTail(odTestCaseEntity);
    }
    return S_OK;

}
Ejemplo n.º 13
0
void Translator::Translate(IEnginePtr engine, InputStreamPtr readStream, SequenceFilePtr seqFile, TSError *error, char* errorMsg, long maxErrorMsgLengthInBytes)
{	
	GetParser()->LoadFile(readStream);
	std::string seqName = GetParser()->GetSequenceName();
	SequencePtr seq = engine->NewSequence();
	seq->Name = seqName.c_str();
	seqFile->InsertSequence(seq);
	m_totalSteps = 0;
	MSXML2::IXMLDOMNodeListPtr stepList = GetParser()->GetStepList();
	for ( int i = 0; i < stepList->length; ++i)
	{
		MSXML2::IXMLDOMNodePtr currentStep = stepList->Getitem(i);
		AddStep(engine, currentStep, GetParser()->GetStepProperties(currentStep), GetParser()->GetStepName(currentStep), seqFile, seqName);
	}
	//set the version property on the SequenceFile object
	std::string versionInfo;
	GetFileVersion(versionInfo, readStream, error, errorMsg, maxErrorMsgLengthInBytes);
	if( *error == TS_Err_NoError)
		seqFile->AsPropertyObjectFile()->Version = versionInfo.c_str();
}
Ejemplo n.º 14
0
//设置指定xpath的节点属性
BOOL CXmlBase::SetAttrValue(LPCTSTR lpszValue, LPCTSTR lpszAttrName, LPCTSTR lpszXPath 
	, MSXML2::IXMLDOMDocument2Ptr pDoc)
{
	MSXML2::IXMLDOMNodePtr pNode = NULL;
	MSXML2::IXMLDOMNodeListPtr pNodeList = NULL;
	long lCnt = 0;
	if (pDoc == NULL || lpszXPath == NULL) return FALSE;
	try
	{
		pNodeList = pDoc->selectNodes(lpszXPath);
		lCnt = pNodeList->Getlength();
		if (lCnt == 0) return FALSE;
		pNode = pNodeList->Getitem(0);
	}
	catch (_com_error e)
	{
		::MessageBox(NULL, e.ErrorMessage(), NULL, MB_OK|MB_ICONERROR);
		return FALSE;
	}
	return SetAttrValue(lpszValue, lpszAttrName, pNode);
}
Ejemplo n.º 15
0
long CIconImgList::GetGroupCount( MSXML2::IXMLDOMElementPtr piGroups)
{
    long lCount = 0;

    MSXML2::IXMLDOMNodeListPtr piGroupsList;
    piGroupsList = piGroups->selectNodes( _bstr_t( _T( "GROUP")));
    if( NULL != piGroupsList)
    {
        long lChildCount = piGroupsList->Getlength();

        lCount = lChildCount;

        MSXML2::IXMLDOMElementPtr piGroupChild;
        for( long lIndex = 0; lIndex < lChildCount; lIndex++)
        {
            piGroupChild = piGroupsList->Getitem( lIndex);
            lCount += GetGroupCount( piGroupChild);
        }
    }
    return lCount;
}
Ejemplo n.º 16
0
	void readTriangles(MSXML2::IXMLDOMNodePtr mesh, geometry_t &geometry)
	{
		MSXML2::IXMLDOMNodeListPtr polyLists = mesh->selectNodes("r:polylist"); // blender
		MSXML2::IXMLDOMNodePtr p;

		if (polyLists->length == 0)
			polyLists = mesh->selectNodes("r:triangles"); // 3dsmax

		for (int i = 0; i < polyLists->length; i++)
		{
			MSXML2::IXMLDOMNodePtr polylist = polyLists->item[i];
			MSXML2::IXMLDOMNodePtr p = polylist->selectSingleNode("r:p");
			if (p == NULL) continue;

			geometry.vertexOffset.push_back(-1);
			geometry.normalOffset.push_back(-1);
			geometry.texcoordOffset.push_back(-1);

			MSXML2::IXMLDOMNodeListPtr inputList = polylist->selectNodes("r:input");
			for (int j = 0; j < inputList->length; j++)
			{
				MSXML2::IXMLDOMNodePtr input = inputList->Getitem(j);
				MSXML2::IXMLDOMNamedNodeMapPtr attributes = input->attributes;

				string semantic = (_bstr_t)_wcslwr((wchar_t *)attributes->getNamedItem("semantic")->text);
				int offset = _wtoi(attributes->getNamedItem("offset")->text);

				if (semantic == "vertex")
					geometry.vertexOffset[geometry.vertexOffset.size() - 1] = offset;
				else if (semantic == "normal")
					geometry.normalOffset[geometry.normalOffset.size() - 1] = offset;
				else if (semantic == "texcoord")
					geometry.texcoordOffset[geometry.texcoordOffset.size() - 1] = offset;
			}

			vector<int> v = readValues<int>(p);
			geometry.triangles.push_back(v);
		}
	}
Ejemplo n.º 17
0
/******************************************************************************
Function Name  :  GetData
Input(s)       :  MSXML2::IXMLDOMNodePtr& pIDomNode
Output         :  HRESULT
Functionality  :  Reads the XML node and constructs the data structure 
Member of      :  CSendEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CSendEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
    MSXML2::IXMLDOMNodeListPtr pIDOMSendList;
    _bstr_t bstrNodeName = def_STR_SENDMSG_NODE;
    long lCount;
    
    pIDOMSendList = pIDomNode->selectNodes(bstrNodeName);
    pIDOMSendList->get_length(&lCount);
    
    for(int i = 0; i < lCount; i++)
    {
        CSend_MessageEntity odSend_MessageEntity;
        MSXML2::IXMLDOMNodePtr pIXMLDOMSendMsgEntity;
        pIXMLDOMSendMsgEntity = pIDOMSendList->Getitem(i);
        if(odSend_MessageEntity.GetData(pIXMLDOMSendMsgEntity)==S_OK)
        {
            m_ouData.m_odSend_MessageDataList.AddTail(odSend_MessageEntity);
        }
    }
    
    return  S_OK;
}
Ejemplo n.º 18
0
/******************************************************************************
Function Name  :  nLoadHeader
Input(s)       :  MSXML2::IXMLDOMNodePtr& pHeaderDOMNode
Output         :  INT
Functionality  :  Retrives the Header info 
Member of      :  CTestSetupEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
Codetag        :  
******************************************************************************/
INT CTestSetupEntity::nLoadHeader(MSXML2::IXMLDOMNodePtr& pHeaderDOMNode)
{
   // CComPtr<IXMLDOMNode> pHeaderDOMNode;
    MSXML2::IXMLDOMNodeListPtr pXMLDOMInfoList;
    MSXML2::IXMLDOMNodePtr pInfoNode;
    MSXML2::IXMLDOMNodePtr pInfoCategoryNode;
    MSXML2::IXMLDOMNodePtr pInfoValueNode;
    _bstr_t bstrNodeName = "info";
    CComVariant NodeValue;		
    pXMLDOMInfoList = pHeaderDOMNode->selectNodes(bstrNodeName);

    LONG lCount = 0;
    pXMLDOMInfoList->get_length(&lCount);
    SInfo ouTempSInfo;
    for(int i = 0; i<lCount; i++)
    {
        pInfoNode = pXMLDOMInfoList->Getitem(i);

        //bstrNodeName = def_STR_CATEGORY_NODE;
		bstrNodeName.Assign(SysAllocString(CT2W(def_STR_CATEGORY_NODE)));
        pInfoCategoryNode = pInfoNode->selectSingleNode(bstrNodeName);
        pInfoCategoryNode->get_nodeTypedValue(&NodeValue);		
				
		ouTempSInfo.m_omCategory = strCopyBSTRToCString(NodeValue);
		
        pInfoCategoryNode.Release();
        
        //bstrNodeName = def_STR_VALUE_NODE;
		bstrNodeName.Assign(SysAllocString(CT2W(def_STR_VALUE_NODE)));
        pInfoCategoryNode = pInfoNode->selectSingleNode(bstrNodeName);
        pInfoCategoryNode->get_nodeTypedValue(&NodeValue);			
		ouTempSInfo.m_omValue = strCopyBSTRToCString(NodeValue);
        pInfoCategoryNode.Release();
        
        pInfoNode.Release();


        if(ouTempSInfo.m_omCategory == def_STR_MODULENAME)
        {
            m_ouTestSetupHeader.m_sModuleName.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sModuleName.m_omValue = ouTempSInfo.m_omValue;
        }
        if(ouTempSInfo.m_omCategory == def_STR_ENGINEERNAME)
        {
            m_ouTestSetupHeader.m_sEngineerInfo1.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sEngineerInfo1.m_omValue = ouTempSInfo.m_omValue;
        }
        if(ouTempSInfo.m_omCategory == def_STR_ENGINERROLE)
        {
            m_ouTestSetupHeader.m_sEngineerInfo2.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sEngineerInfo2.m_omValue = ouTempSInfo.m_omValue;
        }
        if(ouTempSInfo.m_omCategory == def_STR_VERSION)
        {
            m_ouTestSetupHeader.m_sVersion.m_omCategory = ouTempSInfo.m_omCategory;
            m_ouTestSetupHeader.m_sVersion.m_omValue = ouTempSInfo.m_omValue;
        }
    }
//Taking Database
    
    //bstrNodeName = def_STR_LISTOFDB;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_LISTOFDB)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);		
	m_ouTestSetupHeader.m_omDatabasePath = strCopyBSTRToCString(NodeValue);
    //Set The Database Path
    SetDatabaseFile(m_ouTestSetupHeader.m_omDatabasePath);
    pInfoNode.Release();

    //bstrNodeName = def_STR_REPORT_FORMAT;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_REPORT_FORMAT)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);
	CString omStrExt;	
	omStrExt = strCopyBSTRToCString(NodeValue);
    pInfoNode.Release();

    
    if(omStrExt == "HTM")
    {
        m_ouTestSetupHeader.m_sReportFile.m_eType = HTM;
    }
    else
    {
        m_ouTestSetupHeader.m_sReportFile.m_eType = TXT;
    }

    //bstrNodeName = def_STR_REPORT_PATH;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_REPORT_PATH)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);		
	m_ouTestSetupHeader.m_sReportFile.m_omPath = strCopyBSTRToCString(NodeValue);
    pInfoNode.Release();
    
    


    //bstrNodeName = def_STR_REPORT_TIMEMODE;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_REPORT_TIMEMODE)));
    pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);
	CString strTemp;	
	strTemp = strCopyBSTRToCString(NodeValue);
    if(strTemp == "ABS")
    {
        m_ouTestSetupHeader.m_sReportFile.m_eTimeMode = ABS;
    }
    else                    //Default
    {
        m_ouTestSetupHeader.m_sReportFile.m_eTimeMode = REL;
    }
    pInfoNode.Release();


    //bstrNodeName = def_STR_BUS_TYPE;
	bstrNodeName.Assign(SysAllocString(CT2W(def_STR_BUS_TYPE)));
    pInfoNode= pHeaderDOMNode->selectSingleNode(bstrNodeName);
    pInfoNode->get_nodeTypedValue(&NodeValue);		
	strTemp = strCopyBSTRToCString(NodeValue);

    if(strTemp == "CAN")
    {
        m_ouTestSetupHeader.m_eBus = CAN;
    }

    pInfoNode.Release();
    
    return 0;
}
Ejemplo n.º 19
0
bool Engine::LoadContent()
{
	// Setup our SpriteBatch.
	m_pSpriteBatch = new DirectX::SpriteBatch(d3dContext_);

	m_pFont->Initialize(d3dDevice_, std::wstring(L"Calibri18.spritefont"));
	m_pSprite->Initialize(d3dDevice_, std::wstring(L"Test.dds"), 10.0f, 10.0f); 
	
	m_textToDisplay = Text();
	m_textToDisplay.Initialize(std::wstring(L"Sarah"), DirectX::SimpleMath::Vector2(200.0f, 200.0f));

	try
	{
		MSXML2::IXMLDOMDocument2Ptr xmlDoc;
		HRESULT hr = xmlDoc.CreateInstance(__uuidof(MSXML2::DOMDocument60), NULL, CLSCTX_INPROC_SERVER);

		teamStats.InitializeTeam("Players.xml");

		// Make sure the file was loaded correctly before trying to load the players.
		if (xmlDoc->load("Players.xml") == VARIANT_TRUE)
		{
			//xmlDoc->setProperty("SelectionLanguage", "XPath");
			//teamStats.LoadPlayers(xmlDoc);
		}


		if (xmlDoc->load("input.xml") != VARIANT_TRUE)
		{
			DXTRACE_MSG("Unable to load input.xml\n");

			xmlDoc->save("input.xml");
			//xmlDoc->
		}
		else
		{
			DXTRACE_MSG("XML was successfully loaded \n");

			xmlDoc->setProperty("SelectionLanguage", "XPath");
			MSXML2::IXMLDOMNodeListPtr wheels = xmlDoc->selectNodes("/Car/Wheels/*");
			DXTRACE_MSG("Car has %u wheels\n", wheels->Getlength());
		
			DXTRACE_MSG(wheels->Getitem(0)->text);

			//ptr->

			MSXML2::IXMLDOMNodePtr node;
			node = xmlDoc->createNode(MSXML2::NODE_ELEMENT, ("Engine"), (""));
			node->text = ("Engine 1.0");
			xmlDoc->documentElement->appendChild(node);
			hr = xmlDoc->save("output.xml");

			if (SUCCEEDED(hr))
			{
				DXTRACE_MSG("output.xml successfully saved\n");
			}
		}
	}
	catch (_com_error &e)
	{
		DXTRACE_MSG(e.ErrorMessage());
	}










	return true;
}
Ejemplo n.º 20
0
void CShootManagerSys::LoadShootSolutionSet(LPCTSTR szFilename)
{
	int i;
	MSXML2::IXMLDOMDocument2Ptr pDoc;
	pDoc.CreateInstance(__uuidof(DOMDocument40));
	pDoc->load((_variant_t)szFilename);


	// 시뮬레이터에서 사용하는 거리 범위들을 로드한다.
	MSXML2::IXMLDOMNodeListPtr pNodeListDistance;
	MSXML2::IXMLDOMNodePtr pNodeDistance;
	float fDistance;
	pNodeListDistance = pDoc->selectNodes(L"root/distance_range/distance");
	for(i=0; i<pNodeListDistance->Getlength(); i++)
	{
		pNodeDistance = pNodeListDistance->Getitem(i);
		_bstr_t distance = pNodeDistance->GetnodeTypedValue();
		sscanf((LPCTSTR)distance, "%f", &fDistance);
		m_DistanceList.push_back(fDistance);
	}

	
	// 시뮬레이터에서 사용하는 각도 범위들을 로드한다.
	// 여기서 각도는 (골대 - 슈터) 와 양의 z 축 사이의 각도를 말한다.
	// degree 로 저장되어 있으므로 Angle 로 변환시킨다.
	MSXML2::IXMLDOMNodeListPtr pNodeListAngle;
	MSXML2::IXMLDOMNodePtr pNodeAngle;
	float fDegree;
	int iAngle;
	pNodeListAngle = pDoc->selectNodes(L"root/angle_range/degree");
	for(i=0; i<pNodeListAngle->Getlength(); i++)
	{
		pNodeAngle = pNodeListAngle->Getitem(i);
		_bstr_t degree = pNodeAngle->GetnodeTypedValue();
		sscanf((LPCTSTR)degree, "%f", &fDegree);
		iAngle = Degree2Angle(fDegree);					// degree 에서 Angle 로 변환한다.
		m_AngleList.push_back(iAngle);
	}

	// 전체 섹터 개수를 계산하고 여기에 맞게 메모리를 생성한다.
	int iNumSector = m_DistanceList.size() * (m_AngleList.size() + 1) + 6;
	for(i=0; i<iNumSector; i++)
	{
		ShootSolutionSector *pShootSolutionSector = new (m_ShootSolutionSectorArray) ShootSolutionSector;
	}

	// 각 섹터별로 섹터안의 Shoot Solution 들을 로드한다.
	MSXML2::IXMLDOMNodeListPtr pNodeListSector = pDoc->selectNodes(L"root/sector");
	MSXML2::IXMLDOMNodePtr pNodeSector;
	MSXML2::IXMLDOMNodePtr pNodeIndex;
	MSXML2::IXMLDOMNodePtr pNodePath;
	for(i=0; i<pNodeListSector->Getlength(); i++)
	{
		pNodeSector = pNodeListSector->Getitem(i);
		pNodeIndex = pNodeSector->selectSingleNode(L"index");
		pNodePath = pNodeSector->selectSingleNode(L"path");
		_bstr_t index = pNodeIndex->GetnodeTypedValue();
		_bstr_t path = pNodePath->GetnodeTypedValue();

		int iIndex = atoi((LPCTSTR)index);
		SString sFilePath = szFilename;
		sFilePath = DGetPathOnly(sFilePath);
		sFilePath += "\\";
		sFilePath += (LPCTSTR)path;
//		sFilePath.Format("%s\\%s\\%s", g_szCurrentPath, g_szSimulatorPath, (LPCTSTR)path);

		LoadShootSolutionSector(iIndex, (LPCTSTR)sFilePath);
	}

	pDoc.Release();		
}
Ejemplo n.º 21
0
void CShootManagerSys::LoadShootSolutionSet(SFullName nameFile)
{
	int i;
	MSXML2::IXMLDOMDocument2Ptr pDoc = NULL;
	
	DFileGPack packFile;
	packFile.Open(nameFile);
	CFileSys::LoadBinaryXML(pDoc, packFile.GetFile(), packFile.GetSize());
	packFile.Close();
	
	// 시뮬레이터에서 사용하는 거리 범위들을 로드한다.
	MSXML2::IXMLDOMNodeListPtr pNodeListDistance;
	MSXML2::IXMLDOMNodePtr pNodeDistance;
	float fDistance;
	pNodeListDistance = pDoc->selectNodes(L"root/distance_range/distance");
	for(i=0; i<pNodeListDistance->Getlength(); i++)
	{
		pNodeDistance = pNodeListDistance->Getitem(i);
		_bstr_t distance = pNodeDistance->GetnodeTypedValue();
		sscanf((LPCTSTR)distance, "%f", &fDistance);
		m_DistanceList.push_back(fDistance);
	}
	
	
	// 시뮬레이터에서 사용하는 각도 범위들을 로드한다.
	// 여기서 각도는 (골대 - 슈터) 와 양의 z 축 사이의 각도를 말한다.
	// degree 로 저장되어 있으므로 Angle 로 변환시킨다.
	MSXML2::IXMLDOMNodeListPtr pNodeListAngle;
	MSXML2::IXMLDOMNodePtr pNodeAngle;
	float fDegree;
	int iAngle;
	pNodeListAngle = pDoc->selectNodes(L"root/angle_range/degree");
	for(i=0; i<pNodeListAngle->Getlength(); i++)
	{
		pNodeAngle = pNodeListAngle->Getitem(i);
		_bstr_t degree = pNodeAngle->GetnodeTypedValue();
		sscanf((LPCTSTR)degree, "%f", &fDegree);
		iAngle = Degree2Angle(fDegree);					// degree 에서 Angle 로 변환한다.
		m_AngleList.push_back(iAngle);
	}
	
	// 전체 섹터 개수를 계산하고 여기에 맞게 메모리를 생성한다.
	int iNumSector = m_DistanceList.size() * (m_AngleList.size() + 1) + 6;
	for(i=0; i<iNumSector; i++)
	{
		ShootSolutionSector *pShootSolutionSector = new (m_ShootSolutionSectorArray) ShootSolutionSector;
	}
	
	// 각 섹터별로 섹터안의 Shoot Solution 들을 로드한다.
	MSXML2::IXMLDOMNodeListPtr pNodeListSector = pDoc->selectNodes(L"root/sector");
	MSXML2::IXMLDOMNodePtr pNodeSector;
	MSXML2::IXMLDOMNodePtr pNodeIndex;
	MSXML2::IXMLDOMNodePtr pNodePath;
	for(i=0; i<pNodeListSector->Getlength(); i++)
	{
		pNodeSector = pNodeListSector->Getitem(i);
		pNodeIndex = pNodeSector->selectSingleNode(L"index");
		pNodePath = pNodeSector->selectSingleNode(L"path");
		_bstr_t index = pNodeIndex->GetnodeTypedValue();
		_bstr_t path = pNodePath->GetnodeTypedValue();
		
		SString strName = (LPCTSTR)path;

		DCutPath(strName);
		DCutFileExt(strName);
		strName[strName.Len()-3] = 'b';
		
		int iIndex = atoi((LPCTSTR)index);
		LoadShootSolutionSector(iIndex, SFullName("simulator",strName));

	//	int iIndex = atoi((LPCTSTR)index);
	//	SString sFilePath = szFilename;
	//	sFilePath = DGetPathOnly(sFilePath);
	//	sFilePath += "\\";
	//	sFilePath += (LPCTSTR)path;
		//		sFilePath.Format("%s\\%s\\%s", g_szCurrentPath, g_szSimulatorPath, (LPCTSTR)path);
		
	//	LoadShootSolutionSector(iIndex, (LPCTSTR)sFilePath);
	}
	
	CFileSys::UnloadXML(pDoc);	
}
Ejemplo n.º 22
0
void CQuickConnection::Initial(void)
{
	IXMLDOMDocument2Ptr pConfig;
#ifdef _DEBUG
	CFileSys::ConvertBinaryXML( "script\\QuickConnection.xml","script\\QuickConnection.bml" );
	FILE* fIn;
	if( NULL != (fIn=fopen( "script\\QuickConnection.bml","rb" )))
	{
		CFileSys::LoadBinaryXML( pConfig, fIn );
	}
	fclose( fIn );
#else
	DFileGPack packFile;
	packFile.Open(SFullName("script","QuickConnection.bml"));
	CFileSys::LoadBinaryXML(pConfig, packFile.GetFile(), packFile.GetSize());
	packFile.Close();
#endif

	MSXML2::IXMLDOMNodePtr pNode = NULL;

	if( pNode = pConfig->selectSingleNode( L"./root/quick_mode" ) )
	{
		long nIsQuickMode = pNode->GetnodeTypedValue(); 
		m_nIsQuickMode = nIsQuickMode;
	}

	if( pNode = pConfig->selectSingleNode( L"./root/frame_speed_on" ) )
	{
		long nFrameSpeedOn = pNode->GetnodeTypedValue(); 
	    m_nFrameSpeedOn = nFrameSpeedOn;
	}

	if( pNode = pConfig->selectSingleNode( L"./root/full_court" ) )
	{
		long nFullCourt = pNode->GetnodeTypedValue(); 
	    m_nIsFullCourt = nFullCourt;
	}


	if( pNode = pConfig->selectSingleNode( L"./root/select_host" ) )
	{
		long nIsHost = pNode->GetnodeTypedValue(); // long, short.
		m_nIsHost = nIsHost;
//
	}

	// 중앙 서버의 ip 주소를 얻어 온다. 
	if(pNode = pConfig->selectSingleNode(L"./root/server_option/server_addr"))
	{
		_bstr_t server_addr = pNode->GetnodeTypedValue();
		m_sServerAddr = server_addr;
	}

	// 중앙 서버의 Port 를 얻어 온다. 
	if(pNode = pConfig->selectSingleNode(L"./root/server_option/server_port"))
	{
		long nServerPort = pNode->GetnodeTypedValue();
		m_iServerPort = nServerPort;
	}

	if(pNode = pConfig->selectSingleNode( L"./root/host_config/host_port" ))
	{
		long nHostPort = pNode->GetnodeTypedValue();
		m_nHostPort = nHostPort;
	}
	
	if(pNode = pConfig->selectSingleNode( L"./root/host_config/player_on_player" ))
	{
		long nPlayerOn = pNode->GetnodeTypedValue();
		m_nPlayerOn = nPlayerOn;
	}

	if(pNode = pConfig->selectSingleNode( L"./root/host_config/play_mode" ))
	{
		_bstr_t sPlayMode = pNode->GetnodeTypedValue();
		m_sPlayMode = sPlayMode;

	}


/////
	MSXML2::IXMLDOMNodeListPtr pObjectList = pConfig->selectNodes(L"./root/host_db/character");
	int nObject   = pObjectList->Getlength();
	for( int j = 0; j < nObject; j++ )
	{
		MSXML2::IXMLDOMNodePtr   pNode;
		MSXML2::IXMLDOMNodePtr pObject = pObjectList->Getitem(j);
		pNode = pObject->selectSingleNode(L"./position/x");
		m_vecPos[j].X = pNode->GetnodeTypedValue();
		pNode = pObject->selectSingleNode(L"./position/y");
		m_vecPos[j].Y = pNode->GetnodeTypedValue();
		pNode = pObject->selectSingleNode(L"./position/z");
		m_vecPos[j].Z = pNode->GetnodeTypedValue();
	}
/////
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/connection_addr" ))
	{
		_bstr_t sConnectAddr = pNode->GetnodeTypedValue();
		m_sConnectAddr = sConnectAddr;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/connection_id" ))
	{
		_bstr_t sConnectionId = pNode->GetnodeTypedValue();
		m_sConnectionId = sConnectionId;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/char_id" ))
	{
		long nCharID = pNode->GetnodeTypedValue();
		m_nCharID = nCharID;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/char_type" ))
	{
		long nCharType = pNode->GetnodeTypedValue();
		m_nCharType = nCharType;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/client_port" ))
	{
		long nClientPort = pNode->GetnodeTypedValue();
		m_nClientPort = nClientPort;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/with_ball" ))
	{
		long nWithBall = pNode->GetnodeTypedValue();
		m_nWithBall = nWithBall;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/teamID" ))
	{
		long dwTeamID = pNode->GetnodeTypedValue();
		m_dwTeamID = dwTeamID;
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/scale" ))
	{
		m_fScale = pNode->GetnodeTypedValue();
	}
	if(pNode = pConfig->selectSingleNode( L"./root/client_option/latency" ))
	{
		m_fLatency = pNode->GetnodeTypedValue();
	}

    /////
	MSXML2::IXMLDOMNodeListPtr pItemList = pConfig->selectNodes(L"./root/client_option/item");
	int nItemCnt = pItemList->Getlength();
	
	m_nHaveItemCnt = nItemCnt;
	for( int k = 0; k < nItemCnt; k++ )
	{
		MSXML2::IXMLDOMNodePtr   pItemNode;
		MSXML2::IXMLDOMNodePtr pItmeObj = pItemList->Getitem(k);
		pItemNode = pItmeObj->selectSingleNode(L"./path");
		_bstr_t ItemName = pItemNode->GetnodeTypedValue();
		m_sHaveItemList[k] = ItemName;
	}
   ////
	pConfig.Release();
}
Ejemplo n.º 23
0
/******************************************************************************
Function Name  :  GetData
Input(s)       :  MSXML2::IXMLDOMNodePtr& pIDomNode
Output         :  HRESULT
Functionality  :  Fills the datastructure from the XML node 
Member of      :  CTestCaseEntity
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  06/04/2011
Modifications  :  
******************************************************************************/
HRESULT CTestCaseEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
//Getting Attributes
    _bstr_t bstrNodeName;
    CComVariant NodeValue;	
    MSXML2::IXMLDOMNamedNodeMapPtr pDOMTCAtrributes;
    pDOMTCAtrributes = pIDomNode->Getattributes();
    MSXML2::IXMLDOMNodePtr pIDOMChildNode;

    //bstrNodeName = L"identifier";
	bstrNodeName.Assign(SysAllocString(CT2W("identifier")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);		
	m_ouData.m_omID = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();
    
    //bstrNodeName = L"title";
	bstrNodeName.Assign(SysAllocString(CT2W("title")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);		
	m_ouData.m_omTitle = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();

    //bstrNodeName = L"exp_handler";
	bstrNodeName.Assign(SysAllocString(CT2W("exp_handler")));
    pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
    pIDOMChildNode->get_nodeTypedValue(&NodeValue);
	CString strTemp;	
	strTemp = strCopyBSTRToCString(NodeValue);
    pIDOMChildNode.Release();
    
    if(strTemp == "CONTINUE")
    {
        m_ouData.m_eExcpAction = CONTINUE;
    }
    else
    {
        m_ouData.m_eExcpAction = EXIT;
    }

//Getting Testcases
    MSXML2::IXMLDOMNodeListPtr pDOMChildList = pIDomNode->GetchildNodes();
    LONG lCount;
    pDOMChildList->get_length(&lCount);
    CComBSTR NodeName;
    for(int i = 0;i < lCount; i++)
    {
        pIDOMChildNode = pDOMChildList->Getitem(i);
        pIDOMChildNode->get_nodeName(&NodeName);        
		
        CBaseEntityTA *odpBaseEntity = NULL;
		if(NodeName == def_STR_SEND_NODE)
        {
            odpBaseEntity = new CSendEntity();
        }
        else if(NodeName == def_STR_VERIFY_NODE)
        {
            odpBaseEntity = new CVerifyEntity();
        }
        else if(NodeName == def_STR_WAIT_NODE)
        {
            odpBaseEntity = new CWaitEntity();
        }
        else if(NodeName == def_STR_REPLAY_NODE)
        {
            odpBaseEntity = new CReplayEntity();
        }
        else if(NodeName == def_STR_VERIFYRES_NODE)
        {
            odpBaseEntity = new CVerifyResponse();
        }
        if(odpBaseEntity == NULL)
        {
            //TODO::return a correct value
            return -1;
        }
        odpBaseEntity->GetData(pIDOMChildNode);
        m_ouData.m_odTAEntityList.AddTail(odpBaseEntity);
        //pIDOMChildNode->Release();
    }
    return S_OK;
}
Ejemplo n.º 24
0
BOOL CVoucherFile::LoadXml(const CString& strFileName, VoucherFileInfo &voucherInfo)
{	
	CString strFullPath = strFileName;
	BOOL bRet = FALSE;
	try
	{
		voucherInfo.Reset();

		::CoInitialize(NULL);
		MSXML2::IXMLDOMDocumentPtr pXmlDoc(__uuidof(MSXML2::DOMDocument));
		MSXML2::IXMLDOMElementPtr pRootNode = NULL;
		CString strTemp;
		
		pXmlDoc->put_async(VARIANT_FALSE);
		pXmlDoc->load(_bstr_t(strFullPath.AllocSysString()));
		pRootNode = pXmlDoc->GetdocumentElement();
		if (pRootNode == NULL)
			return FALSE;

		// 错误类型
		MSXML2::IXMLDOMElementPtr pNode = pRootNode->selectSingleNode(_T("error"));
		if (pNode != NULL)
		{
			voucherInfo.strError = _GetNodeText(pNode);
		}

		// 模型信息
		pNode = pRootNode->selectSingleNode(_T("model"));
		if (pNode != NULL)
		{
			// 版本
			MSXML2::IXMLDOMElementPtr pChildNode = pNode->selectSingleNode(_T("version"));
			if (pChildNode != NULL)
				voucherInfo.strModelVersion = _GetNodeText(pChildNode);

			// 日期
			pChildNode = pNode->selectSingleNode(_T("date"));
			if (pChildNode != NULL)
				voucherInfo.strModelDate = _GetNodeText(pChildNode);

			// 时间
			pChildNode = pNode->selectSingleNode(_T("time"));
			if (pChildNode != NULL)
				voucherInfo.strModelTime = _GetNodeText(pChildNode);

			// 大小
			pChildNode = pNode->selectSingleNode(_T("size"));
			if (pChildNode != NULL)
				voucherInfo.strModelSize = _GetNodeText(pChildNode);
		}
		
		// 用户列表
		MSXML2::IXMLDOMElementPtr pUserNode = pRootNode->selectSingleNode(_T("nodeinfo"));
		if (pUserNode != NULL)
		{
			CString strText;
			MSXML2::IXMLDOMNodeListPtr pList = pUserNode->selectNodes(_bstr_t("username"));
			if (pList != NULL)
			{
				int nUserCount = pList->Getlength();
				for(int i = 0; i < nUserCount; i++)
				{
					MSXML2::IXMLDOMNodePtr pChiledNode = pList->Getitem(i);
					if (pChiledNode != NULL)
					{
						strText = _GetNodeText(pChiledNode);
						voucherInfo.vecUser.push_back(strText);
					}
				}
			}
		}
		bRet = TRUE;
	}
	catch (...)
	{
		bRet = FALSE;
	}
	return bRet;
}