コード例 #1
0
ファイル: Autoclicker.c プロジェクト: Raslin777/snippets
BOOL CALLBACK Child_Callback(HWND ChildWindow , LPARAM param)
{
    char data[1024];
    char lpButton[]="button";
    char lpWindowsForms[]="forms";
    char lpDropdown[]="";
    
    ConvertToLowerCase(lpButton);
    GetClassNameA(ChildWindow,data,1024);
    
    ConvertToLowerCase(data);
    __strstr strstr = (__strstr)GetProcAddress(GetModuleHandleA("ntdll.dll"),"strstr");
    
    if((strstr(data,lpButton) || strstr(data,lpWindowsForms) ) && IsWindowVisible(ChildWindow) && IsWindowEnabled(ChildWindow))
    {      
        GetWindowText(ChildWindow,data,1024);
        ConvertToLowerCase(data);
        
        int i=-1;
        while(keywords[++i][0]!= '\0')
        if(strstr(data,keywords[i]))
        {
            printf("Found %s\n",keywords[i]);
            SetActiveWindow(ChildWindow);
            SetForegroundWindow(ChildWindow);
            SendMessage(ChildWindow, BM_CLICK , 0 , 0);
						
	    //RECT rect;
            //GetWindowRect(ChildWindow,&rect);
            //ClickMouse(rect.left+15,rect.top+15);
            break;
        }
    }
    return 1;
}
コード例 #2
0
ファイル: sh01_3.cpp プロジェクト: bjhw/bjcpphw
/*
Function: BumpCountForEachChar
Usage: BumpCountForEachChar(line, lCount)
-----------------------------------------
This function examines a line 'line' of text and for each alpha character
increments the associated index in 'lCount'.  Case-insensitive, letters only.
*/
void BumpCountForEachChar(string line, int lCount[]) {
    string chars_lc = ConvertToLowerCase(line);
    for (int i = 0; i < chars_lc.length(); i++) {
        if (isalpha(chars_lc[i]))
            lCount[ chars_lc[i] % 'a' ] ++;
    }
}
コード例 #3
0
ファイル: listtest.c プロジェクト: Afaren/reference
main()
{
    dataBlockT db;
    string line, cmd, token, var;
    int pos;
    printf("List structure test program\n");
    printf("Type \"help\" for help\n");
    db = NewDataBlock();
    while (TRUE) {
        printf(">");
        line = GetLine();
        SetScannerString(db->scanner, line);
        cmd = ConvertToLowerCase(ReadToken(db->scanner));
        if (IsVariableName(cmd)) {
            var = cmd;
            token = ReadToken(db->scanner);
            if (StringEqual(token, "")) {
                DisplayStringList(GetValue(db, var));
            } else if (StringEqual(token, "=")) {
                ParseOperation(db, var);
            } else {
                Error("Unexpected token %s", token);
            }
        } else if (StringEqual(cmd, "help")) {
            HelpCmd();
        } else if (StringEqual(cmd, "quit")) {
            break;
        } else {
            SaveToken(db->scanner, cmd);
            ParseOperation(db, NULL);
        }
    }
}
コード例 #4
0
ファイル: listtest.c プロジェクト: Afaren/reference
static void ConcatOperation(dataBlockT db, string lhs)
{
    listADT result;
    string v1, v2;

    CheckForToken(db->scanner, "(");
    v1 = ConvertToLowerCase(ReadToken(db->scanner));
    CheckForToken(db->scanner, ",");
    v2 = ConvertToLowerCase(ReadToken(db->scanner));
    CheckForToken(db->scanner, ")");
    result = ListConcat(GetValue(db, v1), GetValue(db, v2));
    if (lhs == NULL) {
        DisplayStringList(result);
    } else {
        SetValue(db, lhs, result);
    }
}
コード例 #5
0
ファイル: ConfigurableImpl.cpp プロジェクト: hfiguiere/exempi
bool ConfigurableImpl::RemoveParameter( const uint64 & actualKey ) {
    uint64 key = ModifyKey( actualKey );
    if ( mTreatKeyAsCaseInsensitiveCharBuffer )
        key = ConvertToLowerCase( key );
    AutoSharedLock lock( GetMutex(), true );
    bool returnValue = mMap.erase( key ) >= 1 ? true : false;
    return returnValue;
}
コード例 #6
0
ファイル: listtest.c プロジェクト: Afaren/reference
static void HeadOperation(dataBlockT db, string lhs)
{
    string var;

    if (lhs != NULL) Error("Head result cannot be assigned");
    CheckForToken(db->scanner, "(");
    var = ConvertToLowerCase(ReadToken(db->scanner));
    CheckForToken(db->scanner, ")");
    printf("%s\n", ListHead(GetValue(db, var)));
}
コード例 #7
0
///---------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------
bool RunConsoleCommandFromLine( const std::string& line )
{
    std::string lineLC = ConvertToLowerCase( line );

    std::vector< std::string> args;
    Tokenize( lineLC, args, "( ,;)" );

    DeveloperConsoleArguments argsObj( args, 1 );
    DeveloperConsole::WriteLine( line, INFO_TEXT_COLOR );
    return RunConsoleCommand( args[0], &argsObj );
}
コード例 #8
0
///---------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------
DeveloperConsoleCommand* DeveloperConsoleCommand::GetCommand( const std::string& name )
{
    std::string nameLC = ConvertToLowerCase( name );

    if (s_allCommands->find( nameLC ) != s_allCommands->end())
    {
        return s_allCommands->at( nameLC );
    }

    return nullptr;
}
コード例 #9
0
ファイル: ConfigurableImpl.cpp プロジェクト: hfiguiere/exempi
IConfigurable::eDataType ConfigurableImpl::GetDataType( const uint64 & actualKey ) const {
    uint64 key = ModifyKey( actualKey );
    if ( mTreatKeyAsCaseInsensitiveCharBuffer )
        key = ConvertToLowerCase( key );
    AutoSharedLock lock( GetMutex() );
    auto it = mMap.find( key );
    if ( it == mMap.end() )
        return kDTNone;
    else
        return it->second.first;
}
コード例 #10
0
ファイル: listtest.c プロジェクト: Afaren/reference
static void SelectionOperation(dataBlockT db, string lhs)
{
    string var;
    int pos;

    if (lhs != NULL) Error("NthElement result cannot be assigned");
    CheckForToken(db->scanner, "(");
    var = ConvertToLowerCase(ReadToken(db->scanner));
    CheckForToken(db->scanner, ",");
    pos = StringToInteger(ReadToken(db->scanner));
    CheckForToken(db->scanner, ")");
    printf("%s\n", NthElement(GetValue(db, var), pos));
}
コード例 #11
0
ファイル: ConfigurableImpl.cpp プロジェクト: hfiguiere/exempi
//definition of class methods
void ConfigurableImpl::SetParameter( const uint64 & actualKey, eDataType type, const CombinedDataValue & value ) {
    uint64 key = ModifyKey( actualKey );
    if ( mTreatKeyAsCaseInsensitiveCharBuffer )
        key = ConvertToLowerCase( key );
    eConfigurableErrorCode validKey = ValidateKey( key );
    eDataType oldType = kDTNone;
    CombinedDataValue oldValue;
    if ( validKey == kCECNone ) {
        AutoSharedLock lock( GetMutex(), true );
        if ( mKeysSet ) {
            auto it = mKeysSet->find( key );
            if ( it == mKeysSet->end() )
                NotifyError( "Key is not supported", key, kCECKeyNotSupported, type, value, oldType, oldValue );
        }

        eConfigurableErrorCode validValue = ValidateValue( key, type, value );

        if ( validValue == kCECNone && mKeyValueTypeMap ) {
            auto it = mKeyValueTypeMap->find( key );
            if ( it != mKeyValueTypeMap->end() ) {
                if ( type != it->second ) {
                    validValue = kCECValueTypeNotSupported;
                }
            }
        }

        if ( validValue == kCECNone && !mAllowDifferentValueTypesForExistingEntries ) {
            auto it = mMap.find( key );
            if ( it != mMap.end() && it->second.first != type )
                validValue = kCECPreviousTypeDifferent;
        }

        if ( validValue == kCECNone ) {
            TypeValuePair pair;
            pair.first = type;
            pair.second = value;
            mMap[ key ] = pair;
        } else {
            auto it = mMap.find( key );
            if ( it != mMap.end() ) {
                oldType = it->second.first;
                oldValue = it->second.second;
            }
            NotifyError( "Validation failed for the parameter, type and value combination", key, validValue, type,
                         value, oldType, oldValue );
        }
    } else {
        NotifyError( "Key is not valid", key, validKey, type, value, oldType, oldValue );
    }
}
コード例 #12
0
ファイル: listtest.c プロジェクト: Afaren/reference
static void TailOperation(dataBlockT db, string lhs)
{
    listADT result;
    string var;

    CheckForToken(db->scanner, "(");
    var = ConvertToLowerCase(ReadToken(db->scanner));
    CheckForToken(db->scanner, ")");
    result = ListTail(GetValue(db, var));
    if (lhs == NULL) {
        DisplayStringList(result);
    } else {
        SetValue(db, lhs, result);
    }
}
コード例 #13
0
///---------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------
bool DeveloperConsoleArguments::GetBool( bool& boolean )
{
    std::string string = "";
    if (PeekString( string ))
    {
        string = ConvertToLowerCase( string );
        if (string == "true")
            boolean = true;
        else if (string == "false")
            boolean = false;

        m_currentIndex++;
        return true;
    }

    return false;
}
コード例 #14
0
ファイル: ConfigurableImpl.cpp プロジェクト: hfiguiere/exempi
void APICALL ConfigurableImpl::SetAllowedKeys( uint64 * keysTable, sizet sizeOfTable ) {
    AutoSharedLock lock ( GetMutex(), true );
    if ( mKeysSet ) {
        delete mKeysSet;
        mKeysSet = NULL;
    }
    if ( sizeOfTable > 0 && keysTable != NULL ) {
        mKeysSet = new KeysSet();
        for ( sizet i = 0; i < sizeOfTable; i++ ) {
            uint64 key = keysTable[ i ];
            key = ModifyKey( key );
            if ( mTreatKeyAsCaseInsensitiveCharBuffer )
                key = ConvertToLowerCase( key );
            mKeysSet->insert( key );
        }
    }
}
コード例 #15
0
ファイル: ConfigurableImpl.cpp プロジェクト: hfiguiere/exempi
void APICALL ConfigurableImpl::SetAllowedValueTypesForKeys( KeyValueTypePair * keyValueTypePairTable, sizet sizeOfTable ) {
    AutoSharedLock lock( GetMutex(), true );
    if ( mKeyValueTypeMap ) {
        delete mKeyValueTypeMap;
        mKeyValueTypeMap = NULL;
    }
    if ( sizeOfTable > 0 && keyValueTypePairTable != NULL ) {
        mKeyValueTypeMap = new keyValueTypeMap();
        for ( sizet i = 0; i < sizeOfTable; i++ ) {
            uint64 key = keyValueTypePairTable[i].first;
            key = ModifyKey( key );
            if ( mTreatKeyAsCaseInsensitiveCharBuffer )
                key = ConvertToLowerCase( key );
            ( *mKeyValueTypeMap )[ key ] = keyValueTypePairTable[i].second;
        }
    }
}
コード例 #16
0
ファイル: ConfigurableImpl.cpp プロジェクト: hfiguiere/exempi
bool ConfigurableImpl::GetParameter( const uint64 & actualKey, eDataType type, CombinedDataValue & value ) const {
    uint64 key = ModifyKey( actualKey );
    if ( mTreatKeyAsCaseInsensitiveCharBuffer )
        key = ConvertToLowerCase( key );
    AutoSharedLock lock( GetMutex() );
    auto it = mMap.find( key );
    if ( it == mMap.end() )
        return false;
    if ( it->second.first != type ) {
        NOTIFY_ERROR( IError_v1::kEDConfigurable, kCECValueTypeMismatch,
                      "Type mismatch for a parameter", IError_v1::kESOperationFatal,
                      true, key, true, static_cast< uint64 >( it->second.first ), true, static_cast< uint64 >( type ) );
        return false;
    }
    value = it->second.second;
    return true;
}
コード例 #17
0
///---------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------
bool DeveloperConsoleArguments::GetColorFromString( Rgba& color )
{
    std::string string = "";
    if (PeekString( string ))
    {
        string = ConvertToLowerCase( string );
        if (string == "red")
            color = Rgba::RED;

        else if (string == "blue")
            color = Rgba::BLUE;

        else if (string == "green")
            color = Rgba::GREEN;

        else if (string == "black")
            color = Rgba::BLACK;

        else if (string == "white")
            color = Rgba::WHITE;

        else if (string == "aqua")
            color = Rgba::AQUA;

        else if (string == "orange")
            color = Rgba::ORANGE;

        else if (string == "yellow")
            color = Rgba::YELLOW;

        else if (string == "grey")
            color = Rgba::GREY;

        else if (string == "magenta")
            color = Rgba::MAGENTA;

        else
            return false;

        m_currentIndex++;
        return true;
    }

    return false;
}
コード例 #18
0
ファイル: p3.cpp プロジェクト: Markgggg/CS106B_Coursework
void CountLetters(string fileName){
    int numLetters = 26;
    
	// Open file and read lines into a vector
	ifstream fileStream;
    fileStream.open( fileName.c_str() );
	if ( fileStream.fail() ) {
        Error("File could not be opened.");
    }	
//	std::cout << "Here we opened the file named: " << fileName.c_str() << std::endl;
	
		
	// readEntireFile( fileStream, lines);
	
    //  Create 26 items in vector; initialize them to 0
    Vector<int> letterTable;
    for ( int i = 0; i < numLetters; i++ ){
        letterTable.add(0);
    }

	string tempString = "";
	while (true) {
		getline( fileStream, tempString );
		if (fileStream.fail()) break;
		
		tempString = ConvertToLowerCase( tempString );
		
		for (int j = 0; j < tempString.size(); j++){
			//  find the differnce between 'a' and the current letter
			int index = tempString.at( j ) - 'a';

			//  confirm current letter is 'a' or within 25 letters of 'a.'
			if ( index >= 0 && index < numLetters ){
				// increment value at index
				letterTable.setAt( index, letterTable.getAt( index ) + 1 );
			}
		}
	}
	
	// Print the vector
	for (int i = 0; i < numLetters; i++){
		char currLetter = 'a' + i;
		std::cout << currLetter << ": " << letterTable.getAt( i ) << std::endl;
	}
}
コード例 #19
0
ファイル: gboggle.cpp プロジェクト: sunil3loq/cpptrials
/* 
 * Function: RecordWordForPlayer
 * -----------------------------
 * Exported function to add a word to a player's list and update
 * their score accordingly.  It keeps track of the number of
 * words recorded for each player and position each successive word
 * in rows and columms from left to right, top to bottom.  It
 * also updates the scoreboards with point additions.
 */
void RecordWordForPlayer(string word, playerT player)
{
    if (player != Human && player != Computer)
	Error("RecordWordForPlayer called with invalid player argument.");
    word = ConvertToLowerCase(word);
    SetFont(WORD_FONT);
    SetPointSize(WORD_FONT_SIZE);
    SetPenColor("Word Color");
    int numWordsInRow = gState.scoreBox[player].w/gState.wordColumnWidth;
    int row = gState.numWords[player] / numWordsInRow;
    int col = gState.numWords[player] % numWordsInRow;
    MovePen(gState.scoreBox[player].x + col*gState.wordColumnWidth, 
	    gState.scoreBox[player].y -(row+1)*GetFontHeight());
    DrawTextString(word);
    gState.numWords[player]++;
    AddToScoreForPlayer(word.length() - 3, player); // +1 pt for each letter over length 4
    if (col == numWordsInRow -1) UpdateDisplay(); // force update when completing a row
}
コード例 #20
0
///---------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------    
DeveloperConsoleCommand::DeveloperConsoleCommand( std::string name, DeveloperConsoleCommandFunc command, std::string helpMessage )
{
    name = ConvertToLowerCase( name );
    m_name = name;
    m_command = command;
    m_help = helpMessage;

    if (!s_allCommands)
        s_allCommands = new std::map < std::string, DeveloperConsoleCommand* >();

    if (s_allCommands->find( name ) != s_allCommands->end())
    {
        ConsolePrintf( "Duplicate command registered: %s \n", name );
        return;
    }

    s_allCommands->insert( std::pair< std::string, DeveloperConsoleCommand*>( name, (this) ) );
}
コード例 #21
0
ファイル: listtest.c プロジェクト: Afaren/reference
static void ParseOperation(dataBlockT db, string lhs)
{
    string token;

    token = ConvertToLowerCase(ReadToken(db->scanner));
    if (StringEqual(token, "nthelement")) {
        SelectionOperation(db, lhs);
    } else if (StringEqual(token, "length")) {
        LengthOperation(db, lhs);
    } else if (StringEqual(token, "head")) {
        HeadOperation(db, lhs);
    } else if (StringEqual(token, "tail")) {
        TailOperation(db, lhs);
    } else if (StringEqual(token, "cons")) {
        ConsOperation(db, lhs);
    } else if (StringEqual(token, "concat")) {
        ConcatOperation(db, lhs);
    } else if (IsVariableName(token)) {
        if (lhs == NULL) Error("Null lhs in assignment");
        SetValue(db, lhs, GetValue(db, token));
    } else {
        Error("Illegal operation %s", token);
    }
}