void WeatherXML::parseCurrentConditions() { string currentElement = GetFullCurrentElementName(); string strData = ""; if(strcmp(currentElement.c_str(), "--weather--cc--tmp") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.nCurrentTemp = atoi(strData.c_str()); } if(strcmp(currentElement.c_str(), "--weather--cc--flik") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.nFeelsLikeTemp = atoi(strData.c_str()); } if(strcmp(currentElement.c_str(), "--weather--cc--t") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.strCurrentCondition = strData; } if(strcmp(currentElement.c_str(), "--weather--cc--icon") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.nConditionIcon = atoi(strData.c_str()); } if(strcmp(currentElement.c_str(), "--weather--cc--bar--r") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.nBarPressure = atof(strData.c_str()); } if(strcmp(currentElement.c_str(), "--weather--cc--bar--d") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.strBarChange = strData; } if(strcmp(currentElement.c_str(), "--weather--cc--wind--s") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.nWindVelocity = atoi(strData.c_str()); } if(strcmp(currentElement.c_str(), "--weather--cc--wind--t") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.strWindDirection = strData; } if(strcmp(currentElement.c_str(), "--weather--cc--hmid") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.nHumidity = atoi(strData.c_str()); } if(strcmp(currentElement.c_str(), "--weather--cc--vis") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.nVisibility = atof(strData.c_str()); } if(strcmp(currentElement.c_str(), "--weather--cc--uv--i") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.nUvIndex = atoi(strData.c_str()); } if(strcmp(currentElement.c_str(), "--weather--cc--uv--t") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.strUvDesc = strData; } if(strcmp(currentElement.c_str(), "--weather--cc--dewp") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.nDewPoint = atoi(strData.c_str()); } if(strcmp(currentElement.c_str(), "--weather--cc--moon--icon") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.nMoonPhaseIcon = atoi(strData.c_str()); } if(strcmp(currentElement.c_str(), "--weather--cc--moon--t") == 0) { strData = wstrtostr(m_CurrentElementData); currentConditions.strMoonPhase = strData; } }
INT_PTR CALLBACK NewH86ProjectDlg::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg){ case WM_CLOSE: EndDialog(hWnd, WM_QUIT); break; case WM_COMMAND: switch(LOWORD(wParam)){ case IDC_BROWSE_PROJECT_PATH: { wchar_t path[MAX_PATH]={ 0 }; OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize=sizeof(ofn); ofn.hwndOwner=m_hWnd; ofn.hInstance=Application::hInstance; ofn.lpstrFilter=L"Hard86 Project files\0*.h86\0\0All files\0*.*\0\0"; ofn.nFilterIndex=1; ofn.lpstrFile=path; ofn.nMaxFile=MAX_PATH; if(!GetSaveFileName(&ofn)) break; // if user pressed cancel, abort operation SetDlgItemText(hWnd, IDC_PROJECT_PATH, path); } break; case IDC_BROWSE_BINARY_PATH: { wchar_t path[MAX_PATH]={ 0 }; OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize=sizeof(ofn); ofn.hwndOwner=m_hWnd; ofn.hInstance=Application::hInstance; ofn.lpstrFilter=L"Binary files\0*.com\0\0All files\0*.*\0\0"; ofn.nFilterIndex=1; ofn.lpstrFile=path; ofn.nMaxFile=MAX_PATH; if(!GetSaveFileName(&ofn)) break; // if user pressed cancel, abort operation SetDlgItemText(hWnd, IDC_BINARY_PATH, path); } break; case IDC_BROWSE_FAS_PATH: { wchar_t path[MAX_PATH]={ 0 }; OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize=sizeof(ofn); ofn.hwndOwner=m_hWnd; ofn.hInstance=Application::hInstance; ofn.lpstrFilter=L"FASM symbol files\0*.fas\0\0All files\0*.*\0\0"; ofn.nFilterIndex=1; ofn.lpstrFile=path; ofn.nMaxFile=MAX_PATH; if(!GetSaveFileName(&ofn)) break; // if user pressed cancel, abort operation SetDlgItemText(hWnd, IDC_FAS_PATH, path); } break; case IDOK: { wchar_t tmp_path[MAX_PATH]={ 0 }; GetDlgItemText(hWnd, IDC_PROJECT_PATH, tmp_path, MAX_PATH); m_projectPath=tmp_path; GetDlgItemText(hWnd, IDC_BINARY_PATH, tmp_path, MAX_PATH); m_binPath=File::GetRelativePath(tmp_path, m_projectPath); GetDlgItemText(hWnd, IDC_FAS_PATH, tmp_path, MAX_PATH); m_fasPath=File::GetRelativePath(tmp_path, m_projectPath); try{ xml_document<>* doc=new xml_document<>(); doc->append_node(doc->allocate_node(node_element, "Hard86Project")); xml_node<>* node=doc->first_node(); node->append_node(doc->allocate_node(node_element, "Variables")); node=node->first_node(); node->append_node(doc->allocate_node(node_element, "LoadSegAddr")); node=node->first_node(); node->append_attribute(doc->allocate_attribute("seg", doc->allocate_string("0"))); node->append_attribute(doc->allocate_attribute("addr", doc->allocate_string("0"))); node=node->parent(); // Variables node=node->parent(); // Hard86Project node->append_node(doc->allocate_node(node_element, "Paths")); node=node->first_node("Paths"); node->append_attribute(doc->allocate_attribute("binaryPath", doc->allocate_string(wstrtostr(m_binPath).c_str()))); node->append_attribute(doc->allocate_attribute("FASPath", doc->allocate_string(wstrtostr(m_fasPath).c_str()))); node->append_attribute(doc->allocate_attribute("userVDevPath", "")); node=node->parent(); // Hard86Project node->append_node(doc->allocate_node(node_element, "VDevs")); node->append_node(doc->allocate_node(node_element, "BPList")); File projectFile(m_projectPath); if(projectFile.Exists()){ projectFile.Delete(); } projectFile.Create(); projectFile.Open(); char* xmlBuffer=new char[1024*1024]; *(print(xmlBuffer, *doc, 0))=NULL; projectFile.Write(xmlBuffer); projectFile.Close(); delete[] xmlBuffer; } catch(rapidxml::parse_error e){ OUT_DEBUG("RapidXML error encountered"); } Application::GetInstance()->mainFrame->LoadProjectToFrontend(m_projectPath); EndDialog(hWnd, WM_QUIT); } break; } default: return 0; } return 0; }
/////////////////////////////////////////////////////////////////////////////// // // os_audio_info // /////////////////////////////////////////////////////////////////////////////// // void os_audio_info() { std::cout << " asio:" << std::endl; if (AsioDrivers* asio = new AsioDrivers()) for(long i = 0; i < asio->asioGetNumDev(); i++) { char tmp[0x100]; asio->asioGetDriverName(i, tmp, sizeof tmp); std::cout << (std::string(tmp).find(kTCAT_DICE_USR_ASIO_STR)!=std::string::npos ?" * ":" ") << i << ":" << tmp << std::endl; } std::cout << " MM midi.in:" << std::endl; for (unsigned int i=0; i<::midiInGetNumDevs(); i++) { MIDIINCAPS2 io; LPOLESTR guidStr; memset( &io, 0, sizeof(io) ); TCAT_EXCEPTION_THROW (::midiInGetDevCaps(i, (LPMIDIINCAPS)&io, sizeof io), tcat::xptn_os_midi); std::string namestr = wstrtostr(io.szPname); std::cout << (namestr.find(kTCAT_DICE_USR_MIDI_STR)!=std::string::npos ?" * ":" ") << i << ":" << io.szPname << " [ver:" << std::hex << io.vDriverVersion << ", mid:" << io.wMid << ", pid:" << io.wPid << "]" << std::endl; if (::StringFromCLSID( io.ManufacturerGuid, &guidStr ) == S_OK) { std::wcout << " [mguid: " << guidStr << "]" << std::endl; CoTaskMemFree( guidStr ); } if (::StringFromCLSID( io.ProductGuid, &guidStr ) == S_OK) { std::wcout << " [pguid: " << guidStr << "]" << std::endl; CoTaskMemFree( guidStr ); } } std::cout << " MM midi.out:" << std::endl; for (unsigned int i=0; i<::midiOutGetNumDevs(); i++) { MIDIOUTCAPS2 io; LPOLESTR guidStr; memset( &io, 0, sizeof(io) ); TCAT_EXCEPTION_THROW (::midiOutGetDevCaps(i, (LPMIDIOUTCAPS)&io, sizeof io), tcat::xptn_os_midi); std::string namestr = wstrtostr(io.szPname); std::cout << (namestr.find(kTCAT_DICE_USR_MIDI_STR)!=std::string::npos ?" * ":" ") << i << ":" << io.szPname << " [ver:" << std::hex << io.vDriverVersion << ", mid:" << io.wMid << ", pid:" << io.wPid << ", channel_mask:" << io.wChannelMask << ", notes:" << io.wNotes << ", technology:" << io.wTechnology << ", voices:" << io.wVoices << "]" << std::endl; if (::StringFromCLSID( io.ManufacturerGuid, &guidStr ) == S_OK) { std::wcout << " [mguid: " << guidStr << "]" << std::endl; CoTaskMemFree( guidStr ); } if (::StringFromCLSID( io.ProductGuid, &guidStr ) == S_OK) { std::wcout << " [pguid: " << guidStr << "]" << std::endl; CoTaskMemFree( guidStr ); } } std::cout << " MM wave.in:" << std::endl; for (unsigned int i=0; i<::waveInGetNumDevs(); i++) { WAVEINCAPS io; TCAT_EXCEPTION_THROW (::waveInGetDevCaps(i, &io, sizeof io), tcat::xptn_os_audio); std::string namestr = wstrtostr(io.szPname); std::cout << (namestr.find(kTCAT_DICE_USR_AUDIO_STR)!=std::string::npos ?" * ":" ") << i << ":" << io.szPname << " [ver:" << std::hex << io.vDriverVersion << ", mid:" << io.wMid << ", pid:" << io.wPid << ", formats:" << io.dwFormats << ", channels:" << io.wChannels << "]" << std::endl; } std::cout << " MM wave.out:" << std::endl; for (unsigned int i=0; i<::waveInGetNumDevs(); i++) { WAVEOUTCAPS io; TCAT_EXCEPTION_THROW (::waveOutGetDevCaps(i, &io, sizeof io), tcat::xptn_os_audio); std::string namestr = wstrtostr(io.szPname); std::cout << (namestr.find(kTCAT_DICE_USR_AUDIO_STR)!=std::string::npos ?" * ":" ") << i << ":" << io.szPname << " [ver:" << std::hex << io.vDriverVersion << ", mid:" << io.wMid << ", pid:" << io.wPid << ", formats:" << io.dwFormats << ", channels:" << io.wChannels << ", support:" << io.dwSupport << "]" << std::endl; } }