Esempio n. 1
0
BOOL CBitprintsDownloader::DecodeResponse()
{
	if ( m_pXML ) delete m_pXML;

	theApp.Message( MSG_DEBUG | MSG_FACILITY_INCOMING, L"[Bitprints] Got response: %s", (LPCTSTR)m_sResponse );

	m_pXML = CXMLElement::FromString( m_sResponse, TRUE );
	if ( m_pXML == NULL )
		return FALSE;

	for ( POSITION pos = SchemaCache.GetIterator(); pos; )
	{
		CSchemaPtr pSchema = SchemaCache.GetNext( pos );

		if ( pSchema->m_sBitprintsTest.GetLength() &&
			LookupValue( pSchema->m_sBitprintsTest ).GetLength() )
		{
			CXMLElement* pMetadata = ImportData( pSchema );

			if ( pMetadata == NULL )
				return FALSE;

			return SubmitMetaData( pMetadata );
		}
	}

	return FALSE;
}
Esempio n. 2
0
//-----------------------------------------------------------------------------
// Name: MainDlgProc()
// Desc: Handles dialog messages
//-----------------------------------------------------------------------------
INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
    switch( msg ) 
    {
        case WM_INITDIALOG:
            OnInitDialog( hDlg );
            break;

        case WM_COMMAND:
            switch( LOWORD(wParam) )
            {
                case IDC_LOOKUP:
                    LookupValue( hDlg );
                    break;

                case IDCANCEL:
                    EndDialog( hDlg, IDCANCEL );
                    break;

                default:
                    return FALSE; // Didn't handle message
            }
            break;

        case WM_DESTROY:
            break; 

        default:
            return FALSE; // Didn't handle message
    }

    return TRUE; // Handled message
}
Esempio n. 3
0
CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
                                           const CFX_ByteStringC& sName) {
  CPDF_Object* pValue = LookupValue(sName);
  if (!pValue) {
    CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictBy("Dests");
    if (!pDests)
      return nullptr;
    pValue = pDests->GetElementValue(sName);
  }
  if (!pValue)
    return nullptr;
  if (CPDF_Array* pArray = pValue->AsArray())
    return pArray;
  if (CPDF_Dictionary* pDict = pValue->AsDictionary())
    return pDict->GetArrayBy("D");
  return nullptr;
}
Esempio n. 4
0
void CServerRemoteAccess::RequestValue(int requestID, const char *variable)
{
	CUtlBuffer value(0, 0x100, true);
	LookupValue(variable, value);

	int i = m_ResponsePackets.AddToTail();
	DataResponse_t& resp = m_ResponsePackets.Element(i);

	resp.packet.PutInt(requestID);
	resp.packet.PutInt(0);
	resp.packet.PutString(variable);
	resp.packet.PutInt(value.TellPut());

	if (value.TellPut())
		resp.packet.Put(value.Base(), value.TellPut());

}
CXMLElement* CBitziDownloader::ImportData(CSchema* pSchema)
{
	CXMLElement* pRoot	= pSchema->Instantiate( TRUE );
	CXMLElement* pXML	= pRoot->AddElement( pSchema->m_sSingular );
	int nCount = 0;

	for ( POSITION pos = pSchema->m_pBitziMap.GetHeadPosition() ; pos ; )
	{
		CSchemaBitzi* pMap = (CSchemaBitzi*)pSchema->m_pBitziMap.GetNext( pos );

		CString strValue = LookupValue( pMap->m_sFrom );
		if ( strValue.IsEmpty() ) continue;

		if ( pMap->m_nFactor )
		{
			double nValue;

			if ( _stscanf( strValue, _T("%lf"), &nValue ) == 1 )
			{
				nValue *= pMap->m_nFactor;

				if ( nValue == (double)( (int)nValue ) )
				{
					strValue.Format( _T("%i"), (int)nValue );
				}
				else
				{
					strValue.Format( _T("%f"), nValue );
				}
			}
		}

		pXML->AddAttribute( pMap->m_sTo, strValue );
		nCount++;
	}

	if ( nCount ) return pRoot;
	delete pRoot;

	return NULL;
}
Esempio n. 6
0
CPDF_Array*	CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, FX_BSTR sName)
{
    CPDF_Object* pValue = LookupValue(sName);
    if (pValue == NULL) {
        CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDict(FX_BSTRC("Dests"));
        if (pDests == NULL) {
            return NULL;
        }
        pValue = pDests->GetElementValue(sName);
    }
    if (pValue == NULL) {
        return NULL;
    }
    if (pValue->GetType() == PDFOBJ_ARRAY) {
        return (CPDF_Array*)pValue;
    }
    if (pValue->GetType() == PDFOBJ_DICTIONARY) {
        return ((CPDF_Dictionary*)pValue)->GetArray(FX_BSTRC("D"));
    }
    return NULL;
}
BOOL CBitziDownloader::DecodeResponse()
{
	if ( m_pXML ) delete m_pXML;

	m_pXML = CXMLElement::FromString( m_sResponse, TRUE );
	if ( m_pXML == NULL ) return FALSE;

	for ( POSITION pos = SchemaCache.GetIterator() ; pos ; )
	{
		CSchema* pSchema = SchemaCache.GetNext( pos );

		if ( pSchema->m_sBitziTest.GetLength() && LookupValue( pSchema->m_sBitziTest ).GetLength() )
		{
			CXMLElement* pMetadata = ImportData( pSchema );

			if ( pMetadata == NULL ) return FALSE;

			return SubmitMetaData( pMetadata );
		}
	}

	return FALSE;
}
//-----------------------------------------------------------------------------
// Purpose: looks up a cvar and posts a return value
//-----------------------------------------------------------------------------
void CServerRemoteAccess::RequestValue( ra_listener_id listener, int requestID, const char *variable)
{
	// look up the cvar
	CUtlBuffer value(0, 256, CUtlBuffer::TEXT_BUFFER);		// text-mode buffer
	LookupValue(variable, value);

	// allocate a spot in the list for the response
	int i = m_ResponsePackets.AddToTail();
	m_ResponsePackets[i].responderID = listener; // record who we need to respond to

	CUtlBuffer &response = m_ResponsePackets[i].packet;

	// build the response
	response.PutInt(requestID);
	response.PutInt(SERVERDATA_RESPONSE_VALUE);
	response.PutString(variable);

	//Assert(value.TellPut() > 0);
	response.PutInt(value.TellPut());
	if (value.TellPut())
	{
		response.Put(value.Base(), value.TellPut());
	}
}
Esempio n. 9
0
static const char *
fieldText(enum action_field field)
{
    return LookupValue(fieldStrings, field);
}