Exemple #1
0
BOOL CGProfile::Load()
{
	const CString strPath = Settings.General.DataPath + L"Profile.xml";

	const CXMLElement* pXML = CXMLElement::FromFile( strPath, TRUE );
	if ( pXML == NULL )
	{
		Create();

		return FALSE;
	}

	if ( ! FromXML( pXML ) )
	{
		delete pXML;
		return FALSE;
	}

	if ( ! (Hashes::BtGuid)oGUIDBT )
	{
		// Upgrade
		CreateBT();
		Save();
	}

	return TRUE;
}
Exemple #2
0
BOOL CSecurity::Import(LPCTSTR pszFile)
{
	CString strText;
	CBuffer pBuffer;
	CFile pFile;

	if ( ! pFile.Open( pszFile, CFile::modeRead ) ) return FALSE;
	pBuffer.EnsureBuffer( (DWORD)pFile.GetLength() );
	pBuffer.m_nLength = (DWORD)pFile.GetLength();
	pFile.Read( pBuffer.m_pBuffer, pBuffer.m_nLength );
	pFile.Close();

	CXMLElement* pXML = CXMLElement::FromBytes( pBuffer.m_pBuffer, pBuffer.m_nLength, TRUE );
	BOOL bResult = FALSE;

	if ( pXML != NULL )
	{
		bResult = FromXML( pXML );
		delete pXML;
	}
	else
	{
		CString strLine;

		while ( pBuffer.ReadLine( strLine ) )
		{
			strLine.Trim();
			if ( strLine.IsEmpty() ) continue;
			if ( strLine.GetAt( 0 ) == ';' ) continue;

			CSecureRule* pRule = new CSecureRule();

			if ( pRule->FromGnucleusString( strLine ) )
			{
				CQuickLock oLock( m_pSection );
				m_pRules.AddTail( pRule );
				bResult = TRUE;
			}
			else
			{
				delete pRule;
			}
		}
	}

	// Check all lists for newly denied hosts
	PostMainWndMessage( WM_SANITY_CHECK );

	return bResult;
}
Exemple #3
0
bool BXObject::Parse() 
{
	return FromXML(m_doc.FirstChild("object"));
}