コード例 #1
0
ファイル: dlg_main.cpp プロジェクト: JohnnyonFlame/odamex
// manually connect to a server
void dlgMain::OnManualConnect(wxCommandEvent &event)
{
    wxString ped_result;
    wxString ted_result;
    
    wxTextEntryDialog ted(this, wxT("Please enter IP Address and Port"), 
        wxT("Please enter IP Address and Port"), wxT("0.0.0.0:0"));

    wxPasswordEntryDialog ped(this, wxT("Enter an optional password"), 
        wxT("Enter an optional password"), wxT(""));

    // Keep asking for a valid ip/port number
    while (1)
    {
        if (ted.ShowModal() == wxID_CANCEL)
            return;
    
        ted_result = ted.GetValue();

        if (IsAddressValid(ted_result) == false)
        {
            wxMessageBox(wxT("Invalid IP address/Port number"));
            continue;
        }
        else
            break;
    }

    // Show password entry dialog
    if (ped.ShowModal() == wxID_CANCEL)
        return;
    
    LaunchGame(ted_result, launchercfg_s.odamex_directory, 
        launchercfg_s.wad_paths, ped.GetValue());
}
コード例 #2
0
	virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
	{
		switch (msg) {
		case WM_TIMER:
			if (WaitForSingleObject(m_hFileNotify, 0) == WAIT_OBJECT_0) {
				m_profileList.DeleteAllItems();
				ProfileEnumData ped(m_profileList, m_pd->ptszProfile);
				findProfiles(m_pd->ptszProfileDir, EnumProfilesForList, (LPARAM)&ped);
				FindNextChangeNotification(m_hFileNotify);
			}
			break;

		case WM_FOCUSTEXTBOX:
			SetFocus(m_profileList.GetHwnd());
			if (m_pd->ptszProfile[0] == 0 || m_profileList.GetSelectedCount() == 0)
				m_profileList.SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
			break;

		case WM_SHOWWINDOW:
			if (wParam)
				CheckRun();
			break;

		case WM_CONTEXTMENU:
			ExecuteMenu(lParam);
			break;
		}

		return CDlgBase::DlgProc(msg, wParam, lParam);
	}
コード例 #3
0
ファイル: dlg_main.cpp プロジェクト: JohnnyonFlame/odamex
// manually connect to a server
void dlgMain::OnManualConnect(wxCommandEvent &event)
{
    wxString ted_result = _T("");
    wxTextEntryDialog ted(this, 
                            _T("Please enter IP Address and Port"), 
                            _T("Please enter IP Address and Port"),
                            _T("0.0.0.0:0"));
                            
    // show it
    ted.ShowModal();
    ted_result = ted.GetValue();
    
    wxString ped_result = _T("");
    wxPasswordEntryDialog ped(this, 
                            _T("Enter an optional password"), 
                            _T("Enter an optional password"),
                            _T(""));
                            
    ped.ShowModal();
    
    if (!ted_result.IsEmpty() && ted_result != _T("0.0.0.0:0"))
        LaunchGame(ted_result, 
                    launchercfg_s.odamex_directory, 
                    launchercfg_s.wad_paths,
                    ped.GetValue());
}
コード例 #4
0
ファイル: dlg_main.cpp プロジェクト: JohnnyonFlame/odamex
// Launch button click
void dlgMain::OnLaunch(wxCommandEvent &event)
{
    wxString Password;
    wxString UsrPwHash;
    wxString SrvPwHash;
    wxInt32 i;
    
    i = GetSelectedServerArrayIndex();
    
    if (i == -1)
        return;

    // If the server is passworded, pop up a password entry dialog for them to
    // specify one before going any further
    SrvPwHash = QServer[i].Info.PasswordHash;

    if (SrvPwHash.IsEmpty() == false)
    {                           
        wxPasswordEntryDialog ped(this, wxT("Please enter a password"),
            wxT("This server is passworded"), wxT(""));
        
        SrvPwHash.MakeUpper();
        
        while (1)
        {          
            // Show the dialog box and get the resulting value
            ped.ShowModal();
        
            Password = ped.GetValue();
        
            // User possibly hit cancel or did not enter anything, just exit
            if (Password.IsEmpty())
                return;
            
            UsrPwHash = MD5SUM(Password);
            UsrPwHash.MakeUpper();
            
            // Do an MD5 comparison of the password with the servers one, if it
            // fails, keep asking the user to enter a valid password, otherwise 
            // dive out and connect to the server
            if (SrvPwHash != UsrPwHash)
            {
                wxMessageDialog Message(this, wxT("Incorrect password"), 
                    wxT("Incorrect password"), wxOK | wxICON_HAND);
                
                Message.ShowModal();
                
                // Reset the text so weird things don't happen
                ped.SetValue(wxT(""));
            }
            else
                break;
        }
    }
    
    LaunchGame(QServer[i].GetAddress(), launchercfg_s.odamex_directory,
        launchercfg_s.wad_paths, Password);
}
コード例 #5
0
	virtual void OnInitDialog()
	{
		// set columns
		LVCOLUMN col;
		col.mask = LVCF_TEXT | LVCF_WIDTH;
		col.pszText = TranslateT("Profile");
		col.cx = 100;
		m_profileList.InsertColumn(0, &col);

		col.pszText = TranslateT("Driver");
		col.cx = 150 - GetSystemMetrics(SM_CXVSCROLL);
		m_profileList.InsertColumn(1, &col);

		col.pszText = TranslateT("Size");
		col.cx = 60;
		m_profileList.InsertColumn(2, &col);

		// icons
		HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 1);
		ImageList_AddIcon_NotShared(hImgList, MAKEINTRESOURCE(IDI_USERDETAILS));
		ImageList_AddIcon_NotShared(hImgList, MAKEINTRESOURCE(IDI_DELETE));
		ImageList_AddIcon_NotShared(hImgList, MAKEINTRESOURCE(IDI_MWARNING));
		ImageList_AddIcon_NotShared(hImgList, MAKEINTRESOURCE(IDI_MFATAL));

		// LV will destroy the image list
		m_profileList.SetImageList(hImgList, LVSIL_SMALL);
		m_profileList.SetExtendedListViewStyle(m_profileList.GetExtendedListViewStyle() | LVS_EX_DOUBLEBUFFER | LVS_EX_INFOTIP | LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT);

		// find all the profiles
		ProfileEnumData ped(m_profileList, m_pd->ptszProfile);
		findProfiles(m_pd->ptszProfileDir, EnumProfilesForList, (LPARAM)&ped);
		PostMessage(m_hwnd, WM_FOCUSTEXTBOX, 0, 0);

		m_hFileNotify = FindFirstChangeNotification(m_pd->ptszProfileDir, TRUE, FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE);
		if (m_hFileNotify != INVALID_HANDLE_VALUE)
			SetTimer(m_hwnd, 0, 1200, NULL);
	}
コード例 #6
0
ファイル: dlg_main.cpp プロジェクト: JohnnyonFlame/odamex
// Launch button click
void dlgMain::OnLaunch(wxCommandEvent &event)
{
    if (!m_LstCtrlServers->GetItemCount() || !m_LstCtrlServers->GetSelectedItemCount())
        return;
        
    wxInt32 i = m_LstCtrlServers->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        
    wxListItem item;
    item.SetId(i);
    item.SetColumn(7);
    item.SetMask(wxLIST_MASK_TEXT);
        
    m_LstCtrlServers->GetItem(item);
        
    i = FindServer(item.GetText()); 

    wxPasswordEntryDialog ped(this, 
                            _T("Please enter a password"), 
                            _T("Server is passworded"),
                            _T(""));

    if (QServer[i].info.passworded)
    {                           
        ped.ShowModal();
        
        if (ped.GetValue().IsEmpty())
            return;
    }
    
    if (i > -1)
    {
        LaunchGame(QServer[i].GetAddress(), 
                    launchercfg_s.odamex_directory, 
                    launchercfg_s.wad_paths,
                    ped.GetValue());
    }
}