BOOL CNetworkMonitorBox::ProcessXML(POSITION posNext) { CXMLElement* pXML = Profiles.FindProcess( NULL, posNext ); if ( pXML == NULL ) return FALSE; CSingleLock pLock( &Network.m_pSection, TRUE ); CString strValue = pXML->GetAttributeValue( "Host" ); if ( CChannel* pChannel = Network.FindChannel( strValue ) ) { if ( pChannel->m_hSocket == INVALID_SOCKET && pChannel->TimeOut( 60 * 1000 ) ) { CXMLAttribute* pAttri = pXML->GetAttribute( "Retry" ); if ( ! pAttri ) pAttri = pXML->AddAttribute( "Retry" ); if ( _ttoi( pAttri->GetValue() ) >= 2 ) { AlarmToShortMessage( (LPCTSTR)strValue ); strValue = pXML->GetAttributeValue( _T("Path") ); RestartMachine( (LPCTSTR)strValue ); pXML->DeleteAttribute( "Retry" ); } else { strValue.Format( "%i", _ttoi( pAttri->GetValue() ) + 1 ); pAttri->SetValue( (LPCTSTR)strValue ); pChannel->LinkRestart(); pChannel->m_tConnected = GetTickCount(); } } else if ( pChannel->IsConnected() ) { pXML->DeleteAttribute( "Retry" ); } } else { CChannel* pChannel = new CSentryChannel( pXML ); Network.SetChannel( pChannel ); pChannel->LinkRestart(); } if ( posNext ) return ProcessXML( posNext ); return TRUE; }
CString CLocalSearch::GetXMLString() { CString strXML; for ( POSITION pos1 = m_pSchemas.GetStartPosition() ; pos1 ; ) { CXMLElement* pGroup; CSchema* pSchema; m_pSchemas.GetNextAssoc( pos1, (void*&)pSchema, (void*&)pGroup ); strXML += _T("<?xml version=\"1.0\"?>\r\n"); pGroup->ToString( strXML, TRUE ); for ( POSITION pos2 = pGroup->GetElementIterator() ; pos2 ; ) { CXMLElement* pChild = pGroup->GetNextElement( pos2 ); pChild->DeleteAttribute( _T("index") ); pChild->Detach(); } delete pGroup; } m_pSchemas.RemoveAll(); return strXML; }