Exemplo n.º 1
0
void filename_collector::walk(xhn::path_node* node)
{
    if (!node->is_folder) {
        xhn::pair<xhn::string, xhn::static_string> p =
        xhn::make_pair(node->path_name, m_base_folder);
        m_result->push_back(p);
    }
}
Exemplo n.º 2
0
void xhn::path_node::get_paths(xhn::vector<xhn::string>& result)
{
	if (!children) {
		if (!is_folder)
		    result.push_back(path_name);
		return;
	}
    path_node_ptr child;
	child = children;
	while (child) {
		child->get_paths(result);
		child = child->next;
	}
}
Exemplo n.º 3
0
void input_Proc(const xhn::vector<input_buffer>& buffer)
{
    if(g_pMouse != NULL)
    {
        DIDEVICEOBJECTDATA didod[DINPUT_BUFFERSIZE]; // Receives buffered data
        DWORD               dwElements;
        HRESULT             hr;

        hr = DIERR_INPUTLOST;

        memset(didod, 0, sizeof(didod));
        dwElements = DINPUT_BUFFERSIZE;
        hr = g_pMouse->GetDeviceData(sizeof(DIDEVICEOBJECTDATA), didod, &dwElements, 0);
        if (hr != DI_OK)
        {
            hr = g_pMouse->Acquire();
            if(FAILED(hr))
                return;
            hr = g_pMouse->GetDeviceData(sizeof(DIDEVICEOBJECTDATA), didod, &dwElements, 0);
        }

        if(FAILED(hr))
        {
            if (hr == (HRESULT)DIERR_INPUTLOST)
                printf("DIERR_INPUTLOST\n");
            if (hr == (HRESULT)DIERR_INVALIDPARAM)
                printf("DIERR_INVALIDPARAM\n");
            if (hr == (HRESULT)DIERR_NOTACQUIRED)
                printf("DIERR_NOTACQUIRED\n");
            if (hr == (HRESULT)DIERR_NOTBUFFERED)
                printf("DIERR_NOTBUFFERED\n");
            if (hr == (HRESULT)DIERR_NOTINITIALIZED)
                printf("DIERR_NOTINITIALIZED\n");

            return;
        }
        else
        {
            for(DWORD i=0; i<dwElements; i++)
            {
                input_event event;
                memset(&event, 0, sizeof(event));

                event.time_stamp = didod[i].dwTimeStamp;
                if (didod[i].dwOfs == (DWORD)DIMOFS_X)
                {
                    int disp = didod[i].dwData;
                    event.info.mouse_info.mouse_move_info.x = disp;
                    event.type = MouseMoveEvent;
                }
                else if (didod[i].dwOfs == (DWORD)DIMOFS_Y)
                {
                    int disp = didod[i].dwData;
                    event.info.mouse_info.mouse_move_info.y = disp;
                    event.type = MouseMoveEvent;
                }
                else if (didod[i].dwOfs == (DWORD)DIMOFS_BUTTON0)
                {
                    if (didod[i].dwData & 0x80)
                        event.type = MouseButtonDownEvent;
                    else
                        event.type = MouseButtonUpEvent;
                    event.info.mouse_info.mouse_button_info = LeftButton;
                }
                else if (didod[i].dwOfs == (DWORD)DIMOFS_BUTTON1)
                {
                    if (didod[i].dwData & 0x80)
                        event.type = MouseButtonDownEvent;
                    else
                        event.type = MouseButtonUpEvent;
                    event.info.mouse_info.mouse_button_info = RightButton;
                }
                else if (didod[i].dwOfs == (DWORD)DIMOFS_BUTTON2)
                {
                    if (didod[i].dwData & 0x80)
                        event.type = MouseButtonDownEvent;
                    else
                        event.type = MouseButtonUpEvent;
                    event.info.mouse_info.mouse_button_info = MiddleButton;
                }
                else
                    continue;
				for (euint i = 0; i < buffer.size(); i++) {
					RWBuffer input_buffer = buffer[i].input_buffer;
					InterRWBuffer inter_input_buffer = buffer[i].inter_input_buffer;
					inter_input_buffer.write(input_buffer, (const euint*)&event, sizeof(event));
				}
            }
            POINT curPos;
            GetCursorPos(&curPos);
            ScreenToClient(g_hwnd, &curPos);
            input_event event;
            event.type = MouseAbsolutePositionEvent;
            event.info.mouse_info.mouse_abs_pos.x = curPos.x;
            event.info.mouse_info.mouse_abs_pos.y = curPos.y;
            ///inter_input_buffer.write(input_buffer, (const euint*)&event, sizeof(event));
			for (euint i = 0; i < buffer.size(); i++) {
				RWBuffer input_buffer = buffer[i].input_buffer;
				InterRWBuffer inter_input_buffer = buffer[i].inter_input_buffer;
				inter_input_buffer.write(input_buffer, (const euint*)&event, sizeof(event));
			}
        }

    }
    if(g_pKeyboard != NULL)
    {
        DIDEVICEOBJECTDATA didod[DINPUT_BUFFERSIZE]; // Receives buffered data
        DWORD               dwElements;
        HRESULT             hr;

        hr = DIERR_INPUTLOST;

        memset(didod, 0, sizeof(didod));
        dwElements = DINPUT_BUFFERSIZE;
        hr = g_pKeyboard->GetDeviceData(sizeof(DIDEVICEOBJECTDATA), didod, &dwElements, 0);
        if (hr != DI_OK)
        {
            hr = g_pKeyboard->Acquire();
            if(FAILED(hr))
                return;
            hr = g_pKeyboard->GetDeviceData(sizeof(DIDEVICEOBJECTDATA), didod, &dwElements, 0);
        }

        if(FAILED(hr))
        {
            if (hr == (HRESULT)DIERR_INPUTLOST)
                printf("DIERR_INPUTLOST\n");
            if (hr == (HRESULT)DIERR_INVALIDPARAM)
                printf("DIERR_INVALIDPARAM\n");
            if (hr == (HRESULT)DIERR_NOTACQUIRED)
                printf("DIERR_NOTACQUIRED\n");
            if (hr == (HRESULT)DIERR_NOTBUFFERED)
                printf("DIERR_NOTBUFFERED\n");
            if (hr == (HRESULT)DIERR_NOTINITIALIZED)
                printf("DIERR_NOTINITIALIZED\n");

            return;
        }
        else
        {
            for(DWORD i=0; i<dwElements; i++)
            {
                input_event event;
                memset(&event, 0, sizeof(event));

                event.time_stamp = didod[i].dwTimeStamp;
                if (didod[i].dwData & 0x80)
                    event.type = KeyDownEvent;
                else
                    event.type = KeyUpEvent;
                event.info.key_info = didod[i].dwOfs & 0xff;
                ///inter_input_buffer.write(input_buffer, (const euint*)&event, sizeof(event));
				for (euint i = 0; i < buffer.size(); i++) {
					RWBuffer input_buffer = buffer[i].input_buffer;
					InterRWBuffer inter_input_buffer = buffer[i].inter_input_buffer;
					inter_input_buffer.write(input_buffer, (const euint*)&event, sizeof(event));
				}
            }
        }

    }
}