void CGenericDoc::Serialize(CArchive& ar) { TRACE("CGenericDoc::Serialize called\n"); BOOL bCanSerialize = TRUE; if(ar.IsLoading()) { #ifdef XP_WIN32 // Determine name of actual document. CFile *pFile = ar.GetFile(); CString csFile; if(pFile) { csFile = pFile->GetFilePath(); } // Determine if this is the same file that was passed into the // OnOpenDocument function. // If so, then we can not read our OLE format. bCanSerialize = (csFile.CompareNoCase(m_csOpenDocumentFile) != 0); // However, if they're both empty, then we need to allow this. if(csFile.IsEmpty() && m_csOpenDocumentFile.IsEmpty()) { bCanSerialize = TRUE; } TRACE("%d = !(%s==%s)\n", bCanSerialize, (const char *)csFile, (const char *)m_csOpenDocumentFile); #else // 16 bit can not turn a file handle into a file name. // If our document name is set, then say we can't serialize. bCanSerialize = !(m_bOpenDocumentFileSet && !m_csOpenDocumentFile.IsEmpty()); TRACE("%d = !(%d && !%d)\n", m_bOpenDocumentFileSet, !m_csOpenDocumentFile.IsEmpty()); #endif } // We can only serialize if we're not looking at a local file which we've opened up. if(bCanSerialize) { // Fleshed out for OLE server work. // The below is the common implementation that should work across the // board for all versions of the navigator. // All it does is either read in or write out a URL. if(GetContext() && GetContext()->IsDestroyed() == FALSE) { if (ar.IsStoring()) { TRACE("Storing\n"); // Just shove our current URL into the file. // Get the current history entry. History_entry *pHist = SHIST_GetCurrent(&(GetContext()->GetContext()->hist)); if(pHist != NULL && pHist->address != NULL) { CString csAddress = pHist->address; ar << csAddress; TRACE("URL is %s\n", (const char *)csAddress); } else { TRACE("no history!\n"); CString csEmpty; ar << csEmpty; } } else { TRACE("Reading\n"); // Pretty much just read this in as internet shortcut // format and load it. CString csLoadMe; ar >> csLoadMe; // Do it. TRACE("URL is %s\n", (const char *)csLoadMe); GetContext()->NormalGetUrl(csLoadMe); } } else { TRACE("no context!\n"); if (ar.IsStoring()) { TRACE("Storing\n"); // Hope that ephemeral data were cached, otherwise, no real // harm done. ar << m_csEphemeralHistoryAddress; } else { TRACE("Reading\n"); CString csDontcare; ar >> csDontcare; } } // Next in line should be a string identifying the client which wrote // out the information. // ALL NUMBERS TO BE CONVERTED TO NETWORK BYTE ORDER, SO WORKS ACROSS PLATFORMS. CString csNetscapeVersion; if(ar.IsStoring()) { // Write out our document version number. // This is initially 2.0 ar << theApp.ResolveAppVersion(); TRACE("App version is %s\n", (const char *)theApp.ResolveAppVersion()); // Write out any other information for a particular version here, // prepended by the amount of total bytes to be written. // Hold all integer values (all XP values) to a size that will // translate between win16 and win32. TRACE("Writing version specific information.\n"); // Figure up the size of extra info we'll be writing out. u_long arExtraBytes = 0; // 3.0 beta 6 has some extra information arExtraBytes += sizeof(u_long); // extent.cx arExtraBytes += sizeof(u_long); // extent.cy arExtraBytes += sizeof(u_long); // extent.cx arExtraBytes += sizeof(u_long); // extent.cy // For version 2.0, there was no extra information. ar << htonl(arExtraBytes); // Now, begin writing out extra information. // 3.0 beta 6 TRACE("3.0 beta 6 and later information being written\n"); ar << htonl((u_long)m_csViewExtent.cx); ar << htonl((u_long)m_csViewExtent.cy); TRACE("Write cx=%lu cy=%lu\n", (uint32)m_csViewExtent.cx, (uint32)m_csViewExtent.cy); ar << htonl((u_long)m_csDocumentExtent.cx); ar << htonl((u_long)m_csDocumentExtent.cy); TRACE("Write cx=%lu cy=%lu\n", (uint32)m_csDocumentExtent.cx, (uint32)m_csDocumentExtent.cy); } else { // Read in our document version number. ar >> csNetscapeVersion; TRACE("App version is %s\n", (const char *)csNetscapeVersion); // Next, read in the amount of bytes that are stored. u_long lBytes; ar >> lBytes; lBytes = ntohl(lBytes); if(lBytes != 0) { // Now, depending on which version we're reading from, // figure out the information in the file if we understand // that particular version's file format. // 2.0 won't understand anything, so just read in the number of // extra bytes and continue. // Let the caller of serialize handle thrown exceptions. TRACE("Reading version specific information of %lu bytes.\n", lBytes); char *pBuf = new char[lBytes]; if(pBuf == NULL) { AfxThrowMemoryException(); } ar.Read((void *)pBuf, CASTUINT(lBytes)); // Use and increment this pointer appropriately to read in // extra information. char *va_start = pBuf; // If and only if there are extra bytes, decide what was written out. // In 3.0 beta 6, we wrote out two uint32's first. u_long arVersion30b6 = 0; arVersion30b6 += sizeof(u_long); arVersion30b6 += sizeof(u_long); arVersion30b6 += sizeof(u_long); arVersion30b6 += sizeof(u_long); // Read in this information, otherwise, use a default. if(lBytes >= arVersion30b6) { TRACE("3.0 beta 6 information being retrieved\n"); m_csViewExtent.cx = CASTINT(ntohl(*((u_long *)va_start))); va_start += sizeof(u_long); m_csViewExtent.cy = CASTINT(ntohl(*((u_long *)va_start))); va_start += sizeof(u_long); TRACE("Read cx=%lu cy=%lu\n", (uint32)m_csViewExtent.cx, (uint32)m_csViewExtent.cy); m_csDocumentExtent.cx = CASTINT(ntohl(*((u_long *)va_start))); va_start += sizeof(u_long); m_csDocumentExtent.cy = CASTINT(ntohl(*((u_long *)va_start))); va_start += sizeof(u_long); TRACE("Read cx=%lu cy=%lu\n", (uint32)m_csDocumentExtent.cx, (uint32)m_csDocumentExtent.cy); } else { TRACE("Using default 3.0 beta 6 information\n"); m_csViewExtent = CSize(HIX, HIY); m_csDocumentExtent = CSize(HIX, HIY); } delete[] pBuf; } } // Calling the base class CGenericDoc enables serialization // of the conainer document's COleclientItem objects. TRACE("Calling base serialize\n"); COleServerDoc::Serialize(ar); }
// Return the size of an element (if it only contains data and/or struct elements) checking // the size of struct children if necessary. If any children are DATA elements with calc'd // size (or FOR or IF) then -1 is returned. long get_size(const CXmlTree::CElt &ee, int first /*=0*/, int last /*=999999999*/) { long retval = 0; CXmlTree::CElt child; int ii; int bits_used = 0; // Bits used by all consec. bitfields so far (0 if previous elt not a bitfield) int last_size; // Storage unit size of previous element if a bitfield (1,2,4, or 8) or 0 bool last_down; // Direction for previous bitfield (must be same dirn to be put in same stg unit) for (child = ee.GetChild(first), ii = first; !child.IsEmpty() && ii < last; ++child, ++ii) { CString elt_type = child.GetName(); if (elt_type != "data" && bits_used > 0) { // End of bit-field stg unit ASSERT(last_size == 1 || last_size == 2 || last_size == 4 || last_size == 8); retval += last_size; bits_used = 0; } if (elt_type == "data") { CString ss = child.GetAttr("type"); int data_bits = 0; // bits used in this element (or zero if not a bit-field) int data_size; bool data_down; // Check for bit-field (type is "int") if (ss.CompareNoCase("int") == 0) { data_bits = atoi(child.GetAttr("bits")); if (data_bits > 0) { data_size = atoi(child.GetAttr("len")); data_down = child.GetAttr("direction") == "down"; } } if (bits_used > 0 && (data_bits == 0 || // not bit-field data_size != last_size || // diff size data_down != last_down || // diff dirn bits_used + data_bits > data_size*8) // overflow stg unit ) { // Previous elt was end of the bit-field stg unit ASSERT(last_size == 1 || last_size == 2 || last_size == 4 || last_size == 8); retval += last_size; bits_used = 0; } if (data_bits > 0) { // Save info about current bit-field bits_used += data_bits; last_size = data_size; last_down = data_down; } else if (ss.CompareNoCase("char") == 0) { // Work out the size of a character (normally 1 unless Unicode) ss = child.GetAttr("format"); if (ss.CompareNoCase("unicode") == 0) retval += 2; else retval += 1; } else if (ss.CompareNoCase("date") == 0) { // Work out the size of the date field depending on the format ss = child.GetAttr("format"); if (ss.CompareNoCase("c") == 0) retval += 4; else if (ss.CompareNoCase("c51") == 0) retval += 4; else if (ss.CompareNoCase("c7") == 0) retval += 4; else if (ss.CompareNoCase("cmin") == 0) retval += 4; else if (ss.CompareNoCase("c64") == 0) retval += 8; else if (ss.CompareNoCase("ole") == 0) retval += 8; else if (ss.CompareNoCase("systemtime") == 0) retval += 16; else if (ss.CompareNoCase("filetime") == 0) retval += 8; else if (ss.CompareNoCase("msdos") == 0) retval += 4; else { ASSERT(0); return -1; } } else { // Get the size of the child by checking ss = child.GetAttr("len"); char *endp; //ss.TrimLeft(); //ss.TrimRight(); // Note: we could use expression parser to handle constant expression (eg, "10+1") but is it necessary? long len = strtoul(ss, &endp, 10); // Make sure the string was not empty and there was nothing after the number (eg, not "5+n") if (endp > (const char *)ss && endp - (const char *)ss == ss.GetLength()) retval +=len; else return -1L; // Does not appear to be a simple number so assume it is an expression } } else if (elt_type == "struct" || elt_type == "binary_file_format") { // Get the size of child by looking at its children long child_size = get_size(child); if (child_size > -1) retval += child_size; else return -1L; // Child size is indeterminate, therefore so is our size } else if (elt_type == "use_struct") { long tmp = -1; // Find define_struct and get its size CString ss = child.GetAttr("type_name"); // Find struct name to use CXmlTree::CElt ee = child.GetOwner()->GetRoot().GetFirstChild(); for ( ; !ee.IsEmpty() && ee.GetName() == "define_struct"; ++ee) if (ss == ee.GetAttr("type_name")) tmp = get_size(ee); // Not found if (tmp == -1) return -1L; else retval += tmp; } else if (elt_type == "eval" || elt_type == "jump" || elt_type == "define_struct") ; // zero size so just do nothing to retval else if (elt_type == "for") { // Get the size of the FOR elt's (only) child and multiply by the number of array elts long child_size = get_size(child); if (child_size <= -1) return -1L; // Child size is indeterminate, therefore so is our size // Handle FOR that contains a constant integer in count CString ss = child.GetAttr("count"); char *endp; ss.TrimLeft(); ss.TrimRight(); // Note: we could use expression parser to handle constant expression (eg, "10+1") but is it necessary? long count = strtoul(ss, &endp, 10); // Make sure the string was not empty and there was nothing after the number (eg not "10*n") if (endp > (const char *)ss && endp - (const char *)ss == ss.GetLength()) retval += count * child_size; else return -1L; // Does not appear to be a simple number so assume it is an expression } else return -1L; // xxx handle constant size IF/FOR } // Add last bit-field stg unit if there was one if (bits_used > 0) { ASSERT(last_size == 1 || last_size == 2 || last_size == 4 || last_size == 8); // Don't add stg unit if elt after the range (ie last) is part of the same unit as the previous elt bool add_last = true; if (last < ee.GetNumChildren()) // make sure we are not off the end { ASSERT(!child.IsEmpty()); int data_bits; // Check if last (elt one past the end) is part of the previous bit-field stg unit if (child.GetName() == "data" && // data field child.GetAttr("type").CompareNoCase("int") == 0 && // integer type (data_bits = atoi(child.GetAttr("bits"))) > 0 && // bitfield atoi(child.GetAttr("len")) == last_size && // same size as previous one (child.GetAttr("direction") == "down") == last_down && // same dirn as previous one bits_used + data_bits <= last_size*8) { add_last = false; // part way through a stg unit so don't add it to the size } } if (add_last) retval += last_size; } return retval; }
////////////////////////////////////////////////////////////////////////// // // 위의 AdjustOption 에서 HOOK 노드를 만날경우 이 함수를 호출해서 적용한다. // ////////////////////////////////////////////////////////////////////////// BOOL CATCodeMgr::HookFromOptionNode(COptionNode* pNode) { BOOL bRetVal = FALSE; try { // 후킹할 주소 COptionNode* pAddrNode = pNode->GetChild(0); if(pAddrNode==NULL) throw -1; CHookPoint* pHookPoint = CHookPoint::CreateInstance(pAddrNode->GetValue()); if(pHookPoint==NULL) { //MessageBox(m_hContainerWnd, _T("다음의 주소를 후킹하는데 실패했습니다 : ") + pAddrNode->GetValue(), _T("Hook error"), MB_OK); //continue; throw -2; } m_listHookPoint.push_back(pHookPoint); // 이 주소에 대한 후킹 명령들 수집 int cnt2 = pNode->GetChildCount(); for(int j=1; j<cnt2; j++) { COptionNode* pNode2 = pNode->GetChild(j); CString strHookValue = pNode2->GetValue(); // 번역 명령 if(strHookValue.CompareNoCase(_T("TRANS"))==0) { int cnt3 = pNode2->GetChildCount(); if(cnt3 < 2) continue; // 인자 //COptionNode* pDistNode = pNode2->GetChild(0); //if(pDistNode==NULL) CString strArgScript = pNode2->GetChild(0)->GetValue(); CString strContextName = pNode2->GetChild(1)->GetValue(); CTransCommand* pTransCmd = pHookPoint->AddTransCmd(strArgScript, strContextName); // 번역 옵션들 수집 for(int k=2; k<cnt3; k++) { COptionNode* pNode3 = pNode2->GetChild(k); CString strTransOption = pNode3->GetValue().MakeUpper(); // 번역방식 if(strTransOption == _T("NOP")) { pTransCmd->SetTransMethod(0); } else if(strTransOption == _T("PTRCHEAT")) { pTransCmd->SetTransMethod(1); } else if(strTransOption == _T("OVERWRITE")) { pTransCmd->SetTransMethod(2); if(pNode3->GetChild(_T("IGNORE")) != NULL) { pTransCmd->SetIgnoreBufLen(TRUE); } } else if(strTransOption == _T("SOW")) { pTransCmd->SetTransMethod(3); } // 멀티바이트 / 유니코드 지정 else if(strTransOption == _T("ANSI")) { pTransCmd->SetUnicode(FALSE); } else if(strTransOption == _T("UNICODE")) { pTransCmd->SetUnicode(TRUE); } // 모든 일치하는 텍스트 번역 else if(strTransOption == _T("ALLSAMETEXT")) { pTransCmd->SetAllSameText(TRUE); } // CLIPKOR 옵션 else if(strTransOption == _T("CLIPKOR")) { pTransCmd->SetClipKor(TRUE); } // CLIPJPN 옵션 else if(strTransOption == _T("CLIPJPN")) { pTransCmd->SetClipJpn(TRUE); } } } } // end of for ( 이 주소에 대한 후킹 명령들 수집 ) bRetVal = TRUE; } catch (int nErrCode) { nErrCode = nErrCode; } return bRetVal; }
int CIniEx::CompareItems( CString str1, CString str2 ) { return str1.CompareNoCase(str2); }
void CUserAcessSetDlg::OnCbnSelchangeLevelsetcombo() { if(m_nCurRow==0) return; if(m_nCurCol==0) return; CString strValue; strValue=m_FlexGrid.get_TextMatrix(m_nCurRow,m_nCurCol); CString strSelect; int nIdext=m_userLeveSetBox.GetCurSel(); if(nIdext>=0) { m_userLeveSetBox.GetLBText(nIdext,strSelect); if(strSelect.CompareNoCase(strValue)==0) { return; } else { int nNewValue=nIdext; m_FlexGrid.put_TextMatrix(m_nCurRow,m_nCurCol,strSelect); CString strField; if(m_nCurCol==6) strField="mainscreen_level"; if(m_nCurCol==7) strField="parameter_level"; if(m_nCurCol==8) strField="outputtable_level"; if(m_nCurCol==9) strField="graphic_level"; //if(m_nCurCol==10) // strField="building_level"; if(m_nCurCol==10) strField="burnhex_level"; if(m_nCurCol==11) strField="loadconfig_level"; if(m_nCurCol==12) strField="allscreen_level"; CString strSerial=m_FlexGrid.get_TextMatrix(m_nCurRow,2); strSerial.TrimLeft(); strSerial.TrimRight(); int nSerial=_wtol(strSerial); try { CppSQLite3DB SqliteDBBuilding; SqliteDBBuilding.open((UTF8MBSTR)g_strCurBuildingDatabasefilePath); CString strSql; strSql.Format(_T("update user_level set "+strField+" = %i where serial_number = %i and username ='******' and MainBuilding_Name='%s' and Building_Name='%s'"),nNewValue,nSerial,m_strUserName,m_strMainBuilding,m_strSubNetName); SqliteDBBuilding.execDML((UTF8MBSTR)strSql); SqliteDBBuilding.closedb(); } catch(_com_error *e) { AfxMessageBox(e->ErrorMessage()); } } } if(m_nCurCol==12) { if(nIdext==0)//enable { for(int k=0;k<=12;k++) { if (m_nCurRow%2==0) { m_FlexGrid.put_Row(m_nCurRow);m_FlexGrid.put_Col(k);m_FlexGrid.put_CellBackColor(COLOR_CELL); } else { m_FlexGrid.put_Row(m_nCurRow);m_FlexGrid.put_Col(k);m_FlexGrid.put_CellBackColor(RGB(255,255,240)); } } } else//unenable { for(int k=0;k<12;k++) { m_FlexGrid.put_Row(m_nCurRow);m_FlexGrid.put_Col(k);m_FlexGrid.put_CellBackColor(RGB(215,215,215)); } } } //ReloadUserLevelDB(); }
/*----------------------------------------------------------------------------- Dynamically configure the location and server for an EC2 instance -----------------------------------------------------------------------------*/ void CurlBlastDlg::GetEC2Config() { log.Trace(_T("GetEC2Config")); CString server, location, locationKey; CString userData; if( GetUrlText(_T("http://169.254.169.254/latest/user-data"), userData) ) { int pos = 0; do { CString token = userData.Tokenize(_T(" &"), pos).Trim(); if( token.GetLength() ) { int split = token.Find(_T('='), 0); if( split > 0 ) { CString key = token.Left(split).Trim(); CString value = token.Mid(split + 1).Trim(); if( key.GetLength() ) { if( !key.CompareNoCase(_T("wpt_server")) && value.GetLength() ) server = CString(_T("http://")) + value + _T("/work/"); else if( !key.CompareNoCase(_T("wpt_location")) && value.GetLength() ) location = value; else if( !key.CompareNoCase(_T("wpt_key")) ) locationKey = value; else if( !key.CompareNoCase(_T("wpt_timeout")) && value.GetLength() ) timeout = _ttol(value); else if( !key.CompareNoCase(_T("wpt_keep_DNS")) && value.GetLength() ) keepDNS = _ttol(value); } } } } while(pos > 0); } if( location.IsEmpty() ) { // build the location name automatically from the availability zone CString zone; if( GetUrlText(_T("http://169.254.169.254/latest/meta-data/placement/availability-zone"), zone) ) { int pos = zone.Find('-'); if( pos ) { pos = zone.Find('-', pos + 1); if( pos ) { // figure out the browser version TCHAR buff[1024]; CRegKey key; CString ieVer; if( SUCCEEDED(key.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Internet Explorer"), KEY_READ)) ) { DWORD len = _countof(buff); if( SUCCEEDED(key.QueryStringValue(_T("Version"), buff, &len)) ) { ieVer = buff; ieVer.Trim(); ULONG ver = _ttol(ieVer); ieVer.Format(_T("%d"), ver); location = CString(_T("ec2-")) + zone.Left(pos).Trim() + CString(_T("-IE")) + ieVer; } } } } } } CString instance; GetUrlText(_T("http://169.254.169.254/latest/meta-data/instance-id"), instance); instance = instance.Trim(); log.Trace(_T("EC2 server: %s"), (LPCTSTR)server); log.Trace(_T("EC2 location: %s"), (LPCTSTR)location); log.Trace(_T("EC2 locationKey: %s"), (LPCTSTR)locationKey); log.Trace(_T("EC2 Instance ID: %s"), (LPCTSTR)instance); if( !server.IsEmpty() ) urlManager.SetHttp(server); if( !location.IsEmpty() ) urlManager.SetHttpLocation(location); if( !locationKey.IsEmpty() ) urlManager.SetHttpKey(locationKey); if( !instance.IsEmpty() ) urlManager.SetHttpEC2Instance(instance); // force EC2 to use the current OS user account useCurrentAccount = 1; }
BOOL CEditPropMergeLogTemplate::OnInitDialog() { CResizableStandAloneDialog::OnInitDialog(); CAppUtils::MarkWindowAsUnpinnable(m_hWnd); ExtendFrameIntoClientArea(IDC_DWM); m_aeroControls.SubclassControl(this, IDC_PROPRECURSIVE); m_aeroControls.SubclassOkCancelHelp(this); SetDlgItemText(IDC_TITLEHINT, CString(MAKEINTRESOURCE(IDS_EDITPROPS_MERGETITLEHINT))); SetDlgItemText(IDC_TITLEHINTREVERSE, CString(MAKEINTRESOURCE(IDS_EDITPROPS_MERGETITLEHINTREVERSE))); SetDlgItemText(IDC_MSGHINT, CString(MAKEINTRESOURCE(IDS_EDITPROPS_MERGEMSGHINT))); for (auto it = m_properties.begin(); it != m_properties.end(); ++it) { if (it->second.isinherited) continue; if (it->first.compare(PROJECTPROPNAME_MERGELOGTEMPLATETITLE) == 0) { CString sTitle = CUnicodeUtils::StdGetUnicode(it->second.value).c_str(); sTitle.Replace(L"\n", L"\r\n"); SetDlgItemText(IDC_TITLE, sTitle); } else if (it->first.compare(PROJECTPROPNAME_MERGELOGTEMPLATEREVERSETITLE) == 0) { CString sRevTitle = CUnicodeUtils::StdGetUnicode(it->second.value).c_str(); sRevTitle.Replace(L"\n", L"\r\n"); SetDlgItemText(IDC_TITLEREVERSE, sRevTitle); } else if (it->first.compare(PROJECTPROPNAME_MERGELOGTEMPLATEMSG) == 0) { CString sMsg = CUnicodeUtils::StdGetUnicode(it->second.value).c_str(); sMsg.Replace(L"\n", L"\r\n"); SetDlgItemText(IDC_MSG, sMsg); } else if (it->first.compare(PROJECTPROPNAME_MERGELOGTEMPLATETITLEBOTTOM) == 0) { CString val = CUnicodeUtils::StdGetUnicode(it->second.value).c_str(); CheckDlgButton(IDC_TITLEBOTTOM, ((val.CompareNoCase(L"true") == 0) || (val.CompareNoCase(L"yes") == 0))); } } CString sWindowTitle; GetWindowText(sWindowTitle); CAppUtils::SetWindowTitle(m_hWnd, m_pathList.GetCommonRoot().GetUIPathString(), sWindowTitle); GetDlgItem(IDC_PROPRECURSIVE)->EnableWindow(m_bFolder || m_bMultiple); GetDlgItem(IDC_PROPRECURSIVE)->ShowWindow(m_bRevProps ? SW_HIDE : SW_SHOW); AdjustControlSize(IDC_PROPRECURSIVE); AdjustControlSize(IDC_TITLEBOTTOM); AddAnchor(IDC_TITLEHINT, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_TITLE, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_TITLEHINTREVERSE, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_TITLEREVERSE, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_MSGHINT, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_MSG, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_DWM, BOTTOM_LEFT); AddAnchor(IDC_TITLEBOTTOM, BOTTOM_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_PROPRECURSIVE, BOTTOM_LEFT, BOTTOM_RIGHT); AddAnchor(IDOK, BOTTOM_RIGHT); AddAnchor(IDCANCEL, BOTTOM_RIGHT); AddAnchor(IDHELP, BOTTOM_RIGHT); EnableSaveRestore(L"EditPropMergeLogTemplate"); GetDlgItem(IDC_TITLE)->SetFocus(); return FALSE; }
// Process as a HTTPMessage (Discovery) bool WebServiceServer::ProcessGet(HTTPMessage* p_message) { CString absPath = p_message->GetAbsolutePath(); CrackedURL& crack = p_message->GetCrackedURL(); bool hasWsdlParam = crack.HasParameter("wsdl"); // The following situations are processed as requesting the WSDL // 1: URL/servicename.wsdl // 2: URL/servicename<postfix>?wsdl // 3: URL/servicename?wsdl CString wsdlBase = m_absPath + m_name; CString wsdlPath = wsdlBase + ".wsdl"; CString basePage = m_absPath + m_name + m_servicePostfix; CString baseWsdl = basePage + "?wsdl"; if((wsdlPath.CompareNoCase(absPath) == 0) || (wsdlBase.CompareNoCase(absPath) == 0 && hasWsdlParam) || (basePage.CompareNoCase(absPath) == 0 && hasWsdlParam) || (baseWsdl.CompareNoCase(absPath) == 0 && hasWsdlParam) ) { p_message->Reset(); CString wsdlFileInWebroot = m_wsdl->GetWSDLFilename(); p_message->GetFileBuffer()->SetFileName(wsdlFileInWebroot); p_message->SetContentType("text/xml"); m_httpServer->SendResponse(p_message); return true; } // 4: URL/servicename.aspcxx // 5: URL/Servicename<postfix> // ASPCXX = ASP for C++ if(basePage.CompareNoCase(absPath) == 0) { p_message->Reset(); CString pagina = m_wsdl->GetServicePage(); p_message->AddBody((void*)pagina.GetString(),pagina.GetLength()); p_message->SetContentType("text/html"); m_httpServer->SendResponse(p_message); return true; } // 6: URL/servicename.<operation>.html if(absPath.Right(5).CompareNoCase(".html") == 0) { // Knock of the ".html" absPath = absPath.Left(absPath.GetLength() - 5); // Knock of the basepath if(absPath.Left(m_absPath.GetLength()).CompareNoCase(m_absPath) == 0) { absPath = absPath.Mid(m_absPath.GetLength()); // Knock of the servicename if(absPath.Left(m_name.GetLength()).CompareNoCase(m_name) == 0) { absPath = absPath.Mid(m_name.GetLength()); // Knock of the period if(absPath.GetAt(0) == '.') { absPath = absPath.Mid(1); // Naming convention applies p_message->Reset(); CString pagina = m_wsdl->GetOperationPage(absPath,m_httpServer->GetHostname()); if(!pagina.IsEmpty()) { p_message->AddBody((void*)pagina.GetString(),pagina.GetLength()); p_message->SetContentType("text/html"); m_httpServer->SendResponse(p_message); return true; } } } } } // Preset an error p_message->SetStatus(HTTP_STATUS_BAD_REQUEST); // Maybe luck in the next handler return false; }
BOOL CKscMainDlg::OnNavigate(const CString& strNavigate) { BOOL retval = FALSE; int nTabIndex = -1; if (!strNavigate.CompareNoCase(KCLEARNS_ONEKEY) || !strNavigate.CompareNoCase(BKSFNS_SYSOPT_CLR_ONEKEY)) { nTabIndex = 0; } else if (!strNavigate.CompareNoCase(KCLEARNS_TRASHCLEANER) || !strNavigate.CompareNoCase(BKSFNS_SYSOPT_CLR_RUBBISH)) { nTabIndex = 1; } else if (!strNavigate.CompareNoCase(KCLEARNS_TRACKCLEANER) || !strNavigate.CompareNoCase(BKSFNS_SYSOPT_CLR_HENJI)) { nTabIndex = 2; } else if (!strNavigate.CompareNoCase(KCLEARNS_REGCLEANER) || !strNavigate.CompareNoCase(BKSFNS_SYSOPT_CLR_REG)) { nTabIndex = 3; } else if (!strNavigate.CompareNoCase(KCLEARNS_BIGCLEANER) || !strNavigate.CompareNoCase(BKSFNS_SYSOPT_BIG_FILE)) { nTabIndex = 4; } else if (!strNavigate.CompareNoCase(KCLEARNS_SYSTEMSLIM) || !strNavigate.CompareNoCase(BKSFNS_SYSOPT_CLR_SHOUSHEN)) { nTabIndex = 5; } else if (!strNavigate.CompareNoCase(L"clrrubscan")) { nTabIndex = 1; m_bExamNeedScan = TRUE; } if (-1 == nTabIndex) goto clean0; retval = SetTabCurSel(IDC_TAB_MAIN, nTabIndex); clean0: return retval; }
BOOL CHandoutDoc::OnOpenDocument(LPCTSTR lpszPathName) { /* open file */ CFile File; if( File.Open( lpszPathName, CFile::modeRead ) == FALSE ) { AfxMessageBox( "Cannot open handout file", MB_ICONERROR ); return FALSE; } /* load the file into a buffer */ //determine file size char* pszBuffer = NULL; DWORD dwLength = File.GetLength(); if( dwLength == 0 ) { AfxMessageBox( "File is empty", MB_ICONERROR ); return FALSE; } //allocate a buffer pszBuffer = new char[dwLength+1]; if( pszBuffer == NULL ) { AfxMessageBox( "Cannot allocate buffer", MB_ICONERROR ); return FALSE; } //load the whole file if( File.Read( pszBuffer, dwLength ) < dwLength ) { delete[] pszBuffer; AfxMessageBox( "Unexpected end of file", MB_ICONERROR ); return FALSE; } //add a terminator at the end of the string pszBuffer[dwLength] = '\0'; /* parse the file */ CParseBuffer Buffer(pszBuffer); delete[] pszBuffer; //read in the rest of the file Buffer.IgnoreLineFeeds(); while( Buffer.IsEmpty() == FALSE ) { CString strSectionType = Buffer.ExtractUnquotedString(); CString strSection = Buffer.ExtractSurroundedString( '{', '}' ); if( Buffer.IsUnderflow() == FALSE && Buffer.IsParseError() == FALSE ) { if( strSectionType.CompareNoCase( "Handout" ) == 0 ) ParseHandoutSection(strSection); else AfxMessageBox( CString("Warning Unknown section type: ") + strSectionType ); } else { AfxMessageBox( "Invalid file format", MB_ICONERROR ); return FALSE; } } return TRUE; }
void GetSubFileNames(CString fn, CAtlArray<CString>& paths, CString load_ext_list, CAtlArray<SubFile>& ret) { ret.RemoveAll(); fn.Replace('\\', '/'); bool fWeb = false; { //int i = fn.Find(_T("://")); int i = fn.Find(_T("http://")); if(i > 0) {fn = _T("http") + fn.Mid(i); fWeb = true;} } int l = fn.GetLength(), l2 = l; l2 = fn.ReverseFind('.'); l = fn.ReverseFind('/') + 1; if(l2 < l) l2 = l; CString orgpath = fn.Left(l); CString title = fn.Mid(l, l2-l); CString filename = title + _T(".nooneexpectsthespanishinquisition"); ExtSupport ext_support; if (!ext_support.init(load_ext_list)) { XY_LOG_INFO(_T("unexpected error")); return; } if(!fWeb) { WIN32_FIND_DATA wfd; for(size_t k = 0; k < paths.GetCount(); k++) { CString path = paths[k]; path.Replace('\\', '/'); l = path.GetLength(); if(l > 0 && path[l-1] != '/') path += '/'; if(path.Find(':') == -1 && path.Find(_T("\\\\")) != 0) path = orgpath + path; path.Replace(_T("/./"), _T("/")); path.Replace('/', '\\'); CAtlList<CString> sl; bool fEmpty = true; HANDLE hFile = FindFirstFile(path + title + _T(".*"), &wfd); if(hFile != INVALID_HANDLE_VALUE) { do { if(filename.CompareNoCase(wfd.cFileName) != 0) { fEmpty = false; sl.AddTail(wfd.cFileName); } } while(FindNextFile(hFile, &wfd)); FindClose(hFile); } if(fEmpty) continue; POSITION pos = sl.GetHeadPosition(); while(pos) { const CString& fn = sl.GetNext(pos); int l = fn.ReverseFind('.'); CString ext = fn.Mid(l+1); int ext_order = ext_support.ext_support_order(ext); if (ext_order>-1) { SubFile f; f.full_file_name = path + fn; int l2 = fn.Find('.'); if (l2==l) { f.extra_name = ""; } else { f.extra_name = fn.Mid(l2+1, l-l2-1); } f.ext_order = ext_order; f.path_order = k; ret.Add(f); } } } } else if(l > 7) { CWebTextFile wtf; // :) if(wtf.Open(orgpath + title + WEBSUBEXT)) { CString fn; while(wtf.ReadString(fn) && fn.Find(_T("://")) >= 0) { SubFile f; f.full_file_name = fn; f.extra_name = fn.Mid(fn.ReverseFind('/')+1); f.ext_order = MAXINT32; f.path_order = MAXINT32; ret.Add(f); } } } // sort files, this way the user can define the order (movie.00.English.srt, movie.01.Hungarian.srt, etc) qsort(ret.GetData(), ret.GetCount(), sizeof(SubFile), SubFileCompare); }
void CSharedDirsTreeCtrl::FilterTreeReloadTree(){ m_bCreatingTree = true; // store current selection CDirectoryItem* pOldSelectedItem = NULL; if (GetSelectedFilter() != NULL){ pOldSelectedItem = GetSelectedFilter()->CloneContent(); } // create the tree substructure of directories we want to show POSITION pos = m_pRootDirectoryItem->liSubDirectories.GetHeadPosition(); while (pos != NULL){ CDirectoryItem* pCurrent = m_pRootDirectoryItem->liSubDirectories.GetNext(pos); // clear old items DeleteChildItems(pCurrent); switch( pCurrent->m_eItemType ){ case SDI_ALL: break; case SDI_INCOMING:{ CString strMainIncDir = thePrefs.GetIncomingDir(); if (strMainIncDir.Right(1) == "\\"){ strMainIncDir = strMainIncDir.Left(strMainIncDir.GetLength()-1); } if (thePrefs.GetCatCount() > 1){ m_strliCatIncomingDirs.RemoveAll(); for (int i = 0; i < thePrefs.GetCatCount(); i++){ Category_Struct* pCatStruct = thePrefs.GetCategory(i); if (pCatStruct != NULL){ CString strCatIncomingPath = pCatStruct->incomingpath; if (strCatIncomingPath.Right(1) == "\\"){ strCatIncomingPath = strCatIncomingPath.Left(strCatIncomingPath.GetLength()-1); } if (!strCatIncomingPath.IsEmpty() && strCatIncomingPath.CompareNoCase(strMainIncDir) != 0 && m_strliCatIncomingDirs.Find(strCatIncomingPath) == NULL) { m_strliCatIncomingDirs.AddTail(strCatIncomingPath); CString strName = strCatIncomingPath; if (strName.Right(1) == "\\"){ strName = strName.Left(strName.GetLength()-1); } strName = strName.Right(strName.GetLength() - (strName.ReverseFind('\\')+1)); CDirectoryItem* pCatInc = new CDirectoryItem(strCatIncomingPath, 0, SDI_CATINCOMING); pCatInc->m_htItem = InsertItem(TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE, strName, 5, 5, 0, 0, (LPARAM)pCatInc, pCurrent->m_htItem, TVI_LAST); pCurrent->liSubDirectories.AddTail(pCatInc); } } } } break; } case SDI_TEMP: if (thePrefs.GetCatCount() > 1){ for (int i = 0; i < thePrefs.GetCatCount(); i++){ Category_Struct* pCatStruct = thePrefs.GetCategory(i); if (pCatStruct != NULL){ //temp dir CDirectoryItem* pCatTemp = new CDirectoryItem(CString(""), 0, SDI_TEMP, i); pCatTemp->m_htItem = InsertItem(TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE, CString(pCatStruct->title), 3, 3, 0, 0, (LPARAM)pCatTemp, pCurrent->m_htItem, TVI_LAST); pCurrent->liSubDirectories.AddTail(pCatTemp); } } } break; case SDI_DIRECTORY: // add subdirectories FilterTreeAddSubDirectories(pCurrent, m_strliSharedDirs); break; default: ASSERT( false ); } } // restore selection HTREEITEM htOldSection; if (pOldSelectedItem != NULL && (htOldSection = m_pRootDirectoryItem->FindItem(pOldSelectedItem)) != NULL){ Select(htOldSection, TVGN_CARET); EnsureVisible(htOldSection); } else if( GetSelectedItem() == NULL && !m_pRootDirectoryItem->liSubDirectories.IsEmpty()){ Select(m_pRootDirectoryItem->liSubDirectories.GetHead()->m_htItem, TVGN_CARET); } delete pOldSelectedItem; m_bCreatingTree = false; }
void CSharedDirsTreeCtrl::Reload(bool bForce){ bool bChanged = false; if (!bForce){ // check for changes in shared dirs if (thePrefs.shareddir_list.GetCount() == m_strliSharedDirs.GetCount()){ POSITION pos = m_strliSharedDirs.GetHeadPosition(); POSITION pos2 = thePrefs.shareddir_list.GetHeadPosition(); while (pos != NULL && pos2 != NULL){ CString str1 = m_strliSharedDirs.GetNext(pos); CString str2 = thePrefs.shareddir_list.GetNext(pos2); if (str1.Right(1) == "\\"){ str1 = str1.Left(str1.GetLength()-1); } if (str2.Right(1) == "\\"){ str2 = str2.Left(str2.GetLength()-1); } if (str1.CompareNoCase(str2) != 0){ bChanged = true; break; } } } else bChanged = true; // check for changes in categories incoming dirs CString strMainIncDir = thePrefs.GetIncomingDir(); if (strMainIncDir.Right(1) == _T("\\")) strMainIncDir = strMainIncDir.Left(strMainIncDir.GetLength()-1); CStringList strliFound; for (int i = 0; i < thePrefs.GetCatCount(); i++){ Category_Struct* pCatStruct = thePrefs.GetCategory(i); if (pCatStruct != NULL){ CString strCatIncomingPath = pCatStruct->incomingpath; if (strCatIncomingPath.Right(1) == _T("\\")) strCatIncomingPath = strCatIncomingPath.Left(strCatIncomingPath.GetLength()-1); if (!strCatIncomingPath.IsEmpty() && strCatIncomingPath.CompareNoCase(strMainIncDir) != 0 && strliFound.Find(strCatIncomingPath) == NULL) { POSITION pos = m_strliCatIncomingDirs.Find(strCatIncomingPath); if (pos != NULL){ strliFound.AddTail(strCatIncomingPath); } else{ bChanged = true; break; } } } } if (strliFound.GetCount() != m_strliCatIncomingDirs.GetCount()) bChanged = true; } if (bChanged || bForce){ FetchSharedDirsList(); FilterTreeReloadTree(); Expand(m_pRootUnsharedDirectries->m_htItem, TVE_COLLAPSE); // collapsing is enough to sync for the filtetree, as all items are recreated on every expanding } }
void parseOrbitDownloadsList(const CString& sDldList, OrbitDownloadsArray& arrDownloads) { CString sMsg; if (sDldList.IsEmpty()) return; CCsvParser cpParser; cpParser.Init(sDldList, "\"", ","); CString sContent; while (cpParser.ParseNextRecord()) { int nFieldNumber = -1; CString sValue; TOrbitDownload tOrbitDownload; while (cpParser.GetNextField(sValue)) { ++nFieldNumber; if (nFieldNumber == 0) { tOrbitDownload.sPath = sValue; } if (nFieldNumber == 1) { tOrbitDownload.sFile = sValue; } if (nFieldNumber == 2) { sValue.Trim(); UINT64 uFileSize; if (sscanf_s((const char*)sValue, "%I64u", &uFileSize) != 1) { sMsg = LS (L_CANT_PARSE_ORBIT_DOWNLOAD_LIST); throw std::runtime_error((LPCTSTR)sMsg); } char szCompletedSize[16] = {0,}; sprintf_s(szCompletedSize, 16, "%I64u", uFileSize); if (sValue.CompareNoCase(szCompletedSize) != 0) { sMsg = LS (L_CANT_PARSE_ORBIT_DOWNLOAD_LIST); throw std::runtime_error((LPCTSTR)sMsg); } tOrbitDownload.uFileSize = uFileSize; } if (nFieldNumber == 4) { tOrbitDownload.sUrl = sValue; } if (nFieldNumber == 10) { sValue.Trim(); if (!sValue.IsEmpty()) tOrbitDownload.bIsComplete = true; } } if (nFieldNumber < 10) { sMsg = LS (L_CANT_PARSE_ORBIT_DOWNLOAD_LIST); throw std::runtime_error((LPCTSTR)sMsg); } if (tOrbitDownload.bIsComplete) arrDownloads.Add(tOrbitDownload); } int nFieldNumber = -1; CString sValue; TOrbitDownload tOrbitDownload; while (cpParser.GetNextField(sValue)) { ++nFieldNumber; if (nFieldNumber == 0) { tOrbitDownload.sPath = sValue; } if (nFieldNumber == 1) { tOrbitDownload.sFile = sValue; } if (nFieldNumber == 2) { sValue.Trim(); UINT64 uFileSize; if (sscanf_s((const char*)sValue, "%I64u", &uFileSize) != 1) { sMsg = LS (L_CANT_PARSE_ORBIT_DOWNLOAD_LIST); throw std::runtime_error((LPCTSTR)sMsg); } char szCompletedSize[16] = {0,}; sprintf_s(szCompletedSize, 16, "%I64u", uFileSize); if (sValue.CompareNoCase(szCompletedSize) != 0) { sMsg = LS (L_CANT_PARSE_ORBIT_DOWNLOAD_LIST); throw std::runtime_error((LPCTSTR)sMsg); } tOrbitDownload.uFileSize = uFileSize; } if (nFieldNumber == 4) { tOrbitDownload.sUrl = sValue; } if (nFieldNumber == 10) { sValue.Trim(); if (!sValue.IsEmpty()) tOrbitDownload.bIsComplete = true; } } if (nFieldNumber < 10) { sMsg = LS (L_CANT_PARSE_ORBIT_DOWNLOAD_LIST); throw std::runtime_error((LPCTSTR)sMsg); } if (tOrbitDownload.bIsComplete) arrDownloads.Add(tOrbitDownload); }
BOOL CheckEqualOrSubDir(LPCTSTR szFirstDir,LPCTSTR szSecondDir,BOOL &bEqualDir, BOOL &bSubDir) { bEqualDir = FALSE; bSubDir = FALSE; WCHAR szFirstShortDir[MAX_PATH]; WCHAR szSecondShortDir[MAX_PATH]; memset(szFirstShortDir,0,sizeof(szFirstShortDir)); memset(szSecondShortDir,0,sizeof(szSecondShortDir)); if( FALSE == GetShortPathName(szFirstDir,szFirstShortDir,sizeof(szFirstShortDir)) ) { TRACE(L"\nGetShortPathName %s error in CheckEqualOrSubDir",szFirstDir); } if( FALSE == GetShortPathName(szSecondDir,szSecondShortDir,sizeof(szSecondShortDir)) ) { TRACE(L"\nGetShortPathName %s error in CheckEqualOrSubDir",szSecondDir); } CString strFirstDir; strFirstDir = szFirstShortDir; CString strSecondDir; strSecondDir = szSecondShortDir; strFirstDir.TrimRight(L'\\'); strFirstDir = strFirstDir + "\\"; strSecondDir.TrimRight(L'\\'); strSecondDir = strSecondDir + "\\"; if(strFirstDir.GetLength() < strSecondDir.GetLength() ) { bEqualDir = FALSE; bSubDir = FALSE; return TRUE; } else if(strFirstDir.GetLength() == strSecondDir.GetLength() ) { if( 0 == strFirstDir.CompareNoCase(strSecondDir) ) { bEqualDir = TRUE; bSubDir = FALSE; return TRUE; } else { bEqualDir = FALSE; bSubDir = FALSE; return TRUE; } } else if(strFirstDir.GetLength() > strSecondDir.GetLength()) { if( 0 == strFirstDir.Left(strSecondDir.GetLength()).CompareNoCase(strSecondDir) ) { bEqualDir = FALSE; bSubDir = TRUE; return TRUE; } else { bEqualDir = FALSE; bSubDir = FALSE; return TRUE; } } return TRUE; }
void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternateText, int iWrapWidthPixels ) { ASSERT( m_pFont ); CString sNewText = StringWillUseAlternate(_sText,_sAlternateText) ? _sAlternateText : _sText; if( iWrapWidthPixels == -1 ) // wrap not specified iWrapWidthPixels = m_iWrapWidthPixels; if( m_sText == sNewText && iWrapWidthPixels==m_iWrapWidthPixels ) return; m_sText = sNewText; m_iWrapWidthPixels = iWrapWidthPixels; //Set up the first color. m_vColors.clear(); ColorChange change; change.c = RageColor ( 1, 1, 1, 1 ); change.l = 0; m_vColors.push_back( change ); m_wTextLines.clear(); CString sCurrentLine = ""; int iLineWidth = 0; CString sCurrentWord = ""; int iWordWidth = 0; int iGlyphsSoFar = 0; for ( unsigned i = 0; i < m_sText.length(); i++ ) { int iCharsLeft = m_sText.length() - i - 1; //First: Check for the special (color) case. CString FirstThree = m_sText.substr( i, 3 ); if ( ( FirstThree.CompareNoCase( "|c0" ) == 0 ) && ( iCharsLeft > 8 ) ) { ColorChange change; int k; sscanf( m_sText.substr( i+3, 2 ).c_str(), "%x", &k ); change.c.r = float( k ) / 255.0f; sscanf( m_sText.substr( i+5, 2 ).c_str(), "%x", &k ); change.c.g = float( k ) / 255.0f; sscanf( m_sText.substr( i+7, 2 ).c_str(), "%x", &k ); change.c.b = float( k ) / 255.0f; change.c.a = 1; change.l = iGlyphsSoFar; if ( iGlyphsSoFar == 0 ) m_vColors[0] = change; else m_vColors.push_back( change ); i+=8; continue; } CString curCStr = m_sText.substr( i, 1 ); char curChar = curCStr.c_str()[0]; int iCharLen = m_pFont->GetLineWidthInSourcePixels( CStringToWstring( curCStr ) ); switch ( curChar ) { case ' ': if ( /*( iLineWidth == 0 ) &&*/ ( iWordWidth == 0 ) ) break; sCurrentLine += sCurrentWord + " "; iLineWidth += iWordWidth + iCharLen; sCurrentWord = ""; iWordWidth = 0; iGlyphsSoFar++; break; case '\n': if ( iLineWidth + iWordWidth > iWrapWidthPixels ) { SimpleAddLine( sCurrentLine, iLineWidth ); if ( iWordWidth > 0 ) iLineWidth = iWordWidth + //Add the width of a space m_pFont->GetLineWidthInSourcePixels( CStringToWstring( " " ) ); sCurrentLine = sCurrentWord + " "; iWordWidth = 0; sCurrentWord = ""; iGlyphsSoFar++; } else { SimpleAddLine( sCurrentLine + sCurrentWord, iLineWidth + iWordWidth ); sCurrentLine = ""; iLineWidth = 0; sCurrentWord = ""; iWordWidth = 0; } break; default: if ( ( iWordWidth + iCharLen > iWrapWidthPixels ) && ( iLineWidth == 0 ) ) { SimpleAddLine( sCurrentWord, iWordWidth ); sCurrentWord = curChar; iWordWidth = iCharLen; } else if ( iWordWidth + iLineWidth + iCharLen > iWrapWidthPixels ) { SimpleAddLine( sCurrentLine, iLineWidth ); sCurrentLine = ""; iLineWidth = 0; sCurrentWord += curChar; iWordWidth += iCharLen; } else { sCurrentWord += curChar; iWordWidth += iCharLen; } iGlyphsSoFar++; break; } } if ( iWordWidth > 0 ) { sCurrentLine += sCurrentWord; iLineWidth += iWordWidth; } if ( iLineWidth > 0 ) SimpleAddLine( sCurrentLine, iLineWidth ); BuildChars(); UpdateBaseZoom(); }
void CXTPPropertyGridItemBool::SetValue(CString strValue) { SetBool(strValue.CompareNoCase(m_strTrueText) == 0); }
long CCompileEditView::Compile(CDlgFormulaEdit* pDlg, LPARAM lParam /*= 0*/) { if(m_pListCtrl != NULL) { m_pListCtrl->DeleteAllItems(); } if( m_pParentDlg == NULL && pDlg != NULL ) { m_pParentDlg = pDlg; } if( pDlg == NULL ) return 0; this->SetFocus(); CString strValue; GetRichEditCtrl().GetWindowText(strValue); if(strValue.IsEmpty()) return -1; CString strName; CWnd* pNameEdit = pDlg->GetDlgItem(IDC_NAMEEDIT); // 名称 if( pNameEdit != NULL ) { pNameEdit->GetWindowText(strName); } if(strName.IsEmpty()) { MessageBox(_T("请输入名称!"),_T("提示"),MB_ICONINFORMATION); if(pNameEdit != NULL) { pNameEdit->SetFocus(); } return FALSE; } strName.TrimLeft(); strName.TrimRight(); strName.MakeUpper(); CValue* pValoare = NULL; if( pDlg->IsType(CDlgFormulaEdit::Update) ) { if( strName.CompareNoCase(pDlg->m_strOldName) && m_pExternExpression->Lookup(strName,pDlg->m_nExpressType,pValoare) ) { CString strPrompt; strPrompt.Format(_T("公式 \"%s\" 已经存在,请改名保存"),strName); MessageBox(strPrompt,_T("提示"),MB_ICONINFORMATION); pNameEdit->SetFocus(); ((CEdit*)pNameEdit)->SetSel(0,-1); return 0; } if( m_pExternExpression->Lookup(pDlg->m_strOldName,pDlg->m_nExpressType,pValoare) ) { } } else if ( m_pExternExpression->Lookup(strName,pDlg->m_nExpressType,pValoare) ) { if( pDlg->IsType(CDlgFormulaEdit::NewExp) ) { CString strPrompt; strPrompt.Format(_T("公式 \"%s\" 已经存在,请改名保存"),strName); MessageBox(strPrompt,_T("提示"),MB_ICONINFORMATION); pNameEdit->SetFocus(); ((CEdit*)pNameEdit)->SetSel(0,-1); return 0; } } CExpression* pExpresie = new CExpression(m_pExternExpression, m_pExternVariabile,m_pExternFunction); if( pDlg) { pDlg->AddToParamerList(pExpresie); } //CWnd* pPromptWnd = m_pParentDlg->GetDlgItem(IDC_PROMTEDIT); //CWnd* pBtError = m_pParentDlg->GetDlgItem(IDC_ERROR); CWnd* pPromptWnd = m_pParentDlg->m_pErrorDlg; CString strErroText; nodErrorInfo info(0,0,0,strName); int nErrorCount = pExpresie->ChangeExpression(strValue); if( nErrorCount == 0 ) { strErroText = _T("公式编译(测试)通过!"); CTreeCtrlFormula* pHxTreeCtrl = NULL; BOOL bAdd = FALSE; CExpValue* pValue = NULL; if(pValoare != NULL) { pValue = (CExpValue*)pValoare; CExpression* pOldExpress = pValue->GetExp(); if(pOldExpress != NULL) { pExpresie->SetExpressType(pDlg->m_nExpressType); //qinhn 20090729 Add 保证在修改编译公式时,其"常用指标"的属性不变 if (pOldExpress->IsStyle(HS_EXP_DEFAULT_TECH)) { pExpresie->AddStyle(HS_EXP_DEFAULT_TECH); } //qinhn 20090729 Add End } pValue->Clean(); if( pDlg->IsType(CDlgFormulaEdit::Update) && strName.CompareNoCase(pDlg->m_strOldName) ) { m_pExternExpression->RemoveKey(pDlg->m_strOldName,pDlg->m_nExpressType); bAdd = TRUE; } } else { pExpresie->SetExpressType(pDlg->m_nExpressType); } if(pValue == NULL) { pValue = new CExpValue; bAdd = TRUE; } pValue->SetValue(pExpresie); pExpresie->SetName(strName); //qinhn 20090727 modify 设置类型,只编译保存则类型不变 if (CDlgFormulaEdit::bNeedChangeStyle ) pExpresie->AddStyle( ((!pDlg->m_nMainChart)?HS_EXP_MAINCHART:HS_EXP_SUBCHART) ); else pExpresie->AddStyle(((!pDlg->m_CharType)?HS_EXP_MAINCHART:HS_EXP_SUBCHART)); pExpresie->AddStyle( HS_EXP_OUTTYPE(pDlg->m_dStyle) ); CDlgFormulaEdit::bNeedChangeStyle = false; //qinhn 20090717 modify End if( bAdd ) { m_pExternExpression->AddExpress(strName,pValue); } CString strText; CWnd* pWnd = pDlg->GetDlgItem(IDC_DESCRIBEEDIT); // 公式描述 if(pWnd != NULL) { pWnd->GetWindowText(strText); pExpresie->SetDescribe(strText); } pWnd = pDlg->GetDlgItem(IDC_PWDEDIT); // 密码 if(pWnd != NULL && !(pWnd->GetStyle() & WS_DISABLED) ) { pWnd->GetWindowText(strText); pExpresie->SetPWD(strText); } if(pDlg->m_pDlgNotes != NULL) // 注释 { strText = pDlg->m_pDlgNotes->GetText(); pExpresie->SetNotes(strText); } if( pDlg->m_pDlgEidolon ) // 参数精灵 { strText = pDlg->m_pDlgEidolon->GetText(); pExpresie->SetEidolon(strText); } if( m_pEstopPeriodDlg != NULL ) { *pExpresie->GetEstopPeriod() = m_pEstopPeriodDlg->GetEstopPeriod(); // 禁用周期 *pExpresie->GetDefaultPeriod() = m_pEstopPeriodDlg->GetDefaultPeriod(); // 缺省周期 } // 更新树 if( pDlg->m_pFormulaMan != NULL ) { pHxTreeCtrl = pDlg->m_pFormulaMan->GetCurTree((WORD)pDlg->m_nExpressType); if(pHxTreeCtrl != NULL) { //pExpresie->SetExpressType(pHxTreeCtrl->GetType()); if(pValoare != NULL) { //pHxTreeCtrl->UpdateTreeItemData(pValoare,pValue); } else { if(pDlg != NULL) { pDlg->SetTitle(pExpresie->GetExpressType(),strName); } pHxTreeCtrl->AddItem(strName,pValue,m_pExternExpression); if( pDlg->IsType(CDlgFormulaEdit::NewExp) ) { pDlg->m_strOldName = strName; pExpresie->AddStyle(HS_EXP_USEREDIT); pDlg->SetType(CDlgFormulaEdit::Update | pDlg->IsType(CDlgFormulaEdit::SpeedNew)); } } } } // 更新绘图窗口 ExpPropery NameProp; NameProp.m_dExpType = pExpresie->GetExpressType(); NameProp.m_strName.Format("%s", pExpresie->GetName()); NameProp.m_strDescribe.Format("%s", pExpresie->GetDescribe()); NameProp.m_bStyle = pExpresie->GetStyle(); if ( g_pFormulaMan ) g_pFormulaMan->SendLinkMsg(DiagramMsg_FormulaParamChanged,(LPARAM)&NameProp); if(pPromptWnd != NULL) { pPromptWnd->SendMessage(HX_USER_COMPILE_INFO,0,0); //pPromptWnd->SetWindowText(strErroText); } m_pParentDlg->ShowResult(CDlgFormulaEdit::CompileResult); ::SendMessage(g_hParentWnd,g_SendReLoadTabItemMsg,0,0); //qinhn 20090721 Add 重新载入T指标ab页,防止点修改公式对话框里面的"保存"后出错 return (long)pExpresie; } else { /*strErroText = "公式有几个错误!"; if(pBtError != NULL) { pBtError->EnableWindow(TRUE); } if(pPromptWnd != NULL) { pPromptWnd->SetWindowText(strErroText); }*/ //AddCompileInfotoList(11,(LPARAM)&info); m_pParentDlg->ShowResult(CDlgFormulaEdit::CompileResult); delete pExpresie; } return 0; }
CED2KLink* CED2KLink::CreateLinkFromUrl(const TCHAR* uri) { CString strURI(uri); strURI.Trim(); // This function is used for various sources, trim the string again. int iPos = 0; CString strTok = GetNextString(strURI, _T("|"), iPos); if (strTok.CompareNoCase(_T("ed2k://")) == 0) { strTok = GetNextString(strURI, _T("|"), iPos); if (strTok == _T("file")) { CString strName = GetNextString(strURI, _T("|"), iPos); if (!strName.IsEmpty()) { CString strSize = GetNextString(strURI, _T("|"), iPos); if (!strSize.IsEmpty()) { CString strHash = GetNextString(strURI, _T("|"), iPos); if (!strHash.IsEmpty()) { CStringArray astrEd2kParams; bool bEmuleExt = false; CString strEmuleExt; CString strLastTok; strTok = GetNextString(strURI, _T("|"), iPos); while (!strTok.IsEmpty()) { strLastTok = strTok; if (strTok == _T("/")) { if (bEmuleExt) break; bEmuleExt = true; } else { if (bEmuleExt) { if (!strEmuleExt.IsEmpty()) strEmuleExt += _T('|'); strEmuleExt += strTok; } else astrEd2kParams.Add(strTok); } strTok = GetNextString(strURI, _T("|"), iPos); } if (strLastTok == _T("/")) return new CED2KFileLink(strName, strSize, strHash, astrEd2kParams, strEmuleExt.IsEmpty() ? (LPCTSTR)NULL : (LPCTSTR)strEmuleExt); } } } } else if (strTok == _T("serverlist")) { CString strURL = GetNextString(strURI, _T("|"), iPos); if (!strURL.IsEmpty() && GetNextString(strURI, _T("|"), iPos) == _T("/")) return new CED2KServerListLink(strURL); } else if (strTok == _T("server")) { CString strServer = GetNextString(strURI, _T("|"), iPos); if (!strServer.IsEmpty()) { CString strPort = GetNextString(strURI, _T("|"), iPos); if (!strPort.IsEmpty() && GetNextString(strURI, _T("|"), iPos) == _T("/")) return new CED2KServerLink(strServer, strPort); } } else if (strTok == _T("nodeslist")) { CString strURL = GetNextString(strURI, _T("|"), iPos); if (!strURL.IsEmpty() && GetNextString(strURI, _T("|"), iPos) == _T("/")) return new CED2KNodesListLink(strURL); } else if (strTok == _T("search")) { CString strSearchTerm = GetNextString(strURI, _T("|"), iPos); // might be extended with more parameters in future versions if (!strSearchTerm.IsEmpty()) return new CED2KSearchLink(strSearchTerm); } // MORPH START - Added by Commander, Friendlinks [emulEspaa] - added by zz_fly else if ( strTok == _T("friend") ) { CString sNick = GetNextString(strURI, _T("|"), iPos); if ( !sNick.IsEmpty() ) { CString sHash = GetNextString(strURI, _T("|"), iPos); if ( !sHash.IsEmpty() && GetNextString(strURI, _T("|"), iPos) == _T("/")) return new CED2KFriendLink(sNick, sHash); } } else if ( strTok == _T("friendlist") ) { CString sURL = GetNextString(strURI, _T("|"), iPos); if ( !sURL.IsEmpty() && GetNextString(strURI, _T("|"), iPos) == _T("/") ) return new CED2KFriendListLink(sURL); } // MORPH END - Added by Commander, Friendlinks [emulEspaa] } throw GetResString(IDS_ERR_NOSLLINK); }
/* void CIPFilter::UpdateIPFilterURL() */ void CIPFilter::UpdateIPFilterURL(uint32 uNewVersion) // <== Advanced Updates [MorphXT/Stulle] - Stulle { bool bHaveNewFilterFile = false; CString url = thePrefs.GetAutoUpdateIPFilter_URL(); SYSTEMTIME SysTime; if (!url.IsEmpty()) { CString strTempFilePath; _tmakepathlimit(strTempFilePath.GetBuffer(MAX_PATH), NULL, thePrefs.GetMuleDirectory(EMULE_CONFIGDIR), DFLT_IPFILTER_FILENAME, _T("tmp")); strTempFilePath.ReleaseBuffer(); CHttpDownloadDlg dlgDownload; dlgDownload.m_strTitle = GetResString(IDS_DWL_IPFILTERFILE); dlgDownload.m_sURLToDownload = url; dlgDownload.m_sFileToDownloadInto = strTempFilePath; if (PathFileExists(GetDefaultFilePath())) memcpy(&SysTime, &thePrefs.m_IPfilterVersion, sizeof(SYSTEMTIME)); else memset(&SysTime, 0, sizeof(SYSTEMTIME)); // ==> Advanced Updates [MorphXT/Stulle] - Stulle if(thePrefs.IsIPFilterViaDynDNS()) dlgDownload.m_pLastModifiedTime = NULL; else // <== Advanced Updates [MorphXT/Stulle] - Stulle dlgDownload.m_pLastModifiedTime = &SysTime; //Xman remark: m_pLastModifiedTime is a pointer which points to the SysTime-struct if (dlgDownload.DoModal() != IDOK) { (void)_tremove(strTempFilePath); CString strError = GetResString(IDS_DWLIPFILTERFAILED); if (!dlgDownload.GetError().IsEmpty()) strError += _T("\r\n\r\n") + dlgDownload.GetError(); AfxMessageBox(strError, MB_ICONERROR); return; } // ==> Advanced Updates [MorphXT/Stulle] - Stulle /* if (dlgDownload.m_pLastModifiedTime == NULL) */ if (thePrefs.IsIPFilterViaDynDNS() == false && dlgDownload.m_pLastModifiedTime == NULL) // <== Advanced Updates [MorphXT/Stulle] - Stulle return; CString strMimeType; GetMimeType(strTempFilePath, strMimeType); bool bIsArchiveFile = false; bool bUncompressed = false; CZIPFile zip; if (zip.Open(strTempFilePath)) { bIsArchiveFile = true; CZIPFile::File* zfile = zip.GetFile(_T("guarding.p2p")); if (zfile == NULL) zfile = zip.GetFile(_T("ipfilter.dat")); if (zfile) { CString strTempUnzipFilePath; _tmakepathlimit(strTempUnzipFilePath.GetBuffer(_MAX_PATH), NULL, thePrefs.GetMuleDirectory(EMULE_CONFIGDIR), DFLT_IPFILTER_FILENAME, _T(".unzip.tmp")); strTempUnzipFilePath.ReleaseBuffer(); if (zfile->Extract(strTempUnzipFilePath)) { zip.Close(); zfile = NULL; if (_tremove(theApp.ipfilter->GetDefaultFilePath()) != 0) TRACE(_T("*** Error: Failed to remove default IP filter file \"%s\" - %hs\n"), theApp.ipfilter->GetDefaultFilePath(), strerror(errno)); if (_trename(strTempUnzipFilePath, theApp.ipfilter->GetDefaultFilePath()) != 0) TRACE(_T("*** Error: Failed to rename uncompressed IP filter file \"%s\" to default IP filter file \"%s\" - %hs\n"), strTempUnzipFilePath, theApp.ipfilter->GetDefaultFilePath(), strerror(errno)); if (_tremove(strTempFilePath) != 0) TRACE(_T("*** Error: Failed to remove temporary IP filter file \"%s\" - %hs\n"), strTempFilePath, strerror(errno)); bUncompressed = true; bHaveNewFilterFile = true; } else { CString strError; strError.Format(GetResString(IDS_ERR_IPFILTERZIPEXTR), strTempFilePath); AfxMessageBox(strError, MB_ICONERROR); } } else { CString strError; strError.Format(GetResString(IDS_ERR_IPFILTERCONTENTERR), strTempFilePath); AfxMessageBox(strError, MB_ICONERROR); } zip.Close(); } else if (strMimeType.CompareNoCase(_T("application/x-rar-compressed")) == 0) { bIsArchiveFile = true; CRARFile rar; if (rar.Open(strTempFilePath)) { CString strFile; if (rar.GetNextFile(strFile) && (strFile.CompareNoCase(_T("ipfilter.dat")) == 0 || strFile.CompareNoCase(_T("guarding.p2p")) == 0)) { CString strTempUnzipFilePath; _tmakepathlimit(strTempUnzipFilePath.GetBuffer(MAX_PATH), NULL, thePrefs.GetMuleDirectory(EMULE_CONFIGDIR), DFLT_IPFILTER_FILENAME, _T(".unzip.tmp")); strTempUnzipFilePath.ReleaseBuffer(); if (rar.Extract(strTempUnzipFilePath)) { rar.Close(); if (_tremove(theApp.ipfilter->GetDefaultFilePath()) != 0) TRACE(_T("*** Error: Failed to remove default IP filter file \"%s\" - %hs\n"), theApp.ipfilter->GetDefaultFilePath(), strerror(errno)); if (_trename(strTempUnzipFilePath, theApp.ipfilter->GetDefaultFilePath()) != 0) TRACE(_T("*** Error: Failed to rename uncompressed IP filter file \"%s\" to default IP filter file \"%s\" - %hs\n"), strTempUnzipFilePath, theApp.ipfilter->GetDefaultFilePath(), strerror(errno)); if (_tremove(strTempFilePath) != 0) TRACE(_T("*** Error: Failed to remove temporary IP filter file \"%s\" - %hs\n"), strTempFilePath, strerror(errno)); bUncompressed = true; bHaveNewFilterFile = true; } else { CString strError; strError.Format(_T("Failed to extract IP filter file from RAR file \"%s\"."), strTempFilePath); AfxMessageBox(strError, MB_ICONERROR); } } else { CString strError; strError.Format(_T("Failed to find IP filter file \"guarding.p2p\" or \"ipfilter.dat\" in RAR file \"%s\"."), strTempFilePath); AfxMessageBox(strError, MB_ICONERROR); } rar.Close(); } else { CString strError; strError.Format(_T("Failed to open file \"%s\".\r\n\r\nInvalid file format?\r\n\r\nDownload latest version of UNRAR.DLL from http://www.rarlab.com and copy UNRAR.DLL into eMule installation folder."), url); AfxMessageBox(strError, MB_ICONERROR); } } else { CGZIPFile gz; if (gz.Open(strTempFilePath)) { bIsArchiveFile = true; CString strTempUnzipFilePath; _tmakepathlimit(strTempUnzipFilePath.GetBuffer(_MAX_PATH), NULL, thePrefs.GetMuleDirectory(EMULE_CONFIGDIR), DFLT_IPFILTER_FILENAME, _T(".unzip.tmp")); strTempUnzipFilePath.ReleaseBuffer(); // add filename and extension of uncompressed file to temporary file CString strUncompressedFileName = gz.GetUncompressedFileName(); if (!strUncompressedFileName.IsEmpty()) { strTempUnzipFilePath += _T('.'); strTempUnzipFilePath += strUncompressedFileName; } if (gz.Extract(strTempUnzipFilePath)) { gz.Close(); if (_tremove(theApp.ipfilter->GetDefaultFilePath()) != 0) TRACE(_T("*** Error: Failed to remove default IP filter file \"%s\" - %hs\n"), theApp.ipfilter->GetDefaultFilePath(), strerror(errno)); if (_trename(strTempUnzipFilePath, theApp.ipfilter->GetDefaultFilePath()) != 0) TRACE(_T("*** Error: Failed to rename uncompressed IP filter file \"%s\" to default IP filter file \"%s\" - %hs\n"), strTempUnzipFilePath, theApp.ipfilter->GetDefaultFilePath(), strerror(errno)); if (_tremove(strTempFilePath) != 0) TRACE(_T("*** Error: Failed to remove temporary IP filter file \"%s\" - %hs\n"), strTempFilePath, strerror(errno)); bUncompressed = true; bHaveNewFilterFile = true; } else { CString strError; strError.Format(GetResString(IDS_ERR_IPFILTERZIPEXTR), strTempFilePath); AfxMessageBox(strError, MB_ICONERROR); } } gz.Close(); } if (!bIsArchiveFile && !bUncompressed) { // Check first lines of downloaded file for potential HTML content (e.g. 404 error pages) bool bValidIPFilterFile = true; FILE* fp = _tfsopen(strTempFilePath, _T("rb"), _SH_DENYWR); if (fp) { char szBuff[16384]; int iRead = fread(szBuff, 1, _countof(szBuff)-1, fp); if (iRead <= 0) bValidIPFilterFile = false; else { szBuff[iRead-1] = '\0'; const char* pc = szBuff; while (*pc == ' ' || *pc == '\t' || *pc == '\r' || *pc == '\n') pc++; if (strnicmp(pc, "<html", 5) == 0 || strnicmp(pc, "<xml", 4) == 0 || strnicmp(pc, "<!doc", 5) == 0) { bValidIPFilterFile = false; } } fclose(fp); } if (bValidIPFilterFile) { (void)_tremove(theApp.ipfilter->GetDefaultFilePath()); VERIFY( _trename(strTempFilePath, theApp.ipfilter->GetDefaultFilePath()) == 0 ); bHaveNewFilterFile = true; } else { AfxMessageBox(GetResString(IDS_DWLIPFILTERFAILED), MB_ICONERROR); } } } else { AfxMessageBox(_T("Failed to auto-update IPFilter. No URL given"), MB_ICONERROR); return; } // ==> Advanced Updates [MorphXT/Stulle] - Stulle /* struct tm tmTemp; thePrefs.m_last_ipfilter_check = safe_mktime(CTime::GetCurrentTime().GetLocalTm(&tmTemp)); */ // <== Advanced Updates [MorphXT/Stulle] - Stulle if (bHaveNewFilterFile) { LoadFromDefaultFile(); if (thePrefs.GetFilterServerByIP()) theApp.emuledlg->serverwnd->serverlistctrl.RemoveAllFilteredServers(); } // In case we received an invalid IP-filter file (e.g. an 404 HTML page with HTTP status "OK"), // warn the user that there are no IP-filters available any longer. if (bHaveNewFilterFile && theApp.ipfilter->GetIPFilter().GetCount() == 0) { CString strLoaded; strLoaded.Format(GetResString(IDS_IPFILTERLOADED), theApp.ipfilter->GetIPFilter().GetCount()); CString strError; strError.Format(_T("%s\r\n\r\n%s"), GetResString(IDS_DWLIPFILTERFAILED), strLoaded); AfxMessageBox(strError, MB_ICONERROR); return; } //everything fine. update the stored version if (bHaveNewFilterFile) // ==> Advanced Updates [MorphXT/Stulle] - Stulle /* memcpy(&thePrefs.m_IPfilterVersion, &SysTime, sizeof SysTime); */ { thePrefs.m_uIPFilterVersionNum = uNewVersion; if(thePrefs.IsIPFilterViaDynDNS()) { memset(&SysTime, 0, sizeof(SYSTEMTIME)); if(theApp.emuledlg->preferenceswnd && theApp.emuledlg->preferenceswnd->m_wndScar && theApp.emuledlg->preferenceswnd->m_wndScar.m_IpFilterTime) { CString strBuffer = NULL; strBuffer.Format(_T("v%u"), thePrefs.GetIPFilterVersionNum()); theApp.emuledlg->preferenceswnd->m_wndScar.m_IpFilterTime.SetWindowText(strBuffer); } } else memcpy(&thePrefs.m_IPfilterVersion, &SysTime, sizeof SysTime); } else { thePrefs.m_uIPFilterVersionNum = 0; memset(&SysTime, 0, sizeof(SYSTEMTIME)); if(thePrefs.IsIPFilterViaDynDNS()) { if(theApp.emuledlg->preferenceswnd && theApp.emuledlg->preferenceswnd->m_wndScar && theApp.emuledlg->preferenceswnd->m_wndScar.m_IpFilterTime) theApp.emuledlg->preferenceswnd->m_wndScar.m_IpFilterTime.SetWindowText(GetResString(IDS_DL_NONE)); } } if(thePrefs.IsIPFilterViaDynDNS() == false && theApp.emuledlg->preferenceswnd && theApp.emuledlg->preferenceswnd->m_wndScar && theApp.emuledlg->preferenceswnd->m_wndScar.m_IpFilterTime) { TCHAR sTime[30]; sTime[0] = _T('\0'); SysTimeToStr(thePrefs.GetIPfilterVersion(), sTime); theApp.emuledlg->preferenceswnd->m_wndScar.m_IpFilterTime.SetWindowText(sTime); } // <== Advanced Updates [MorphXT/Stulle] - Stulle }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int /*nCmdShow*/ = SW_SHOWDEFAULT) { LPCWSTR szCommandLine = GetCommandLineW(); int argc = 0; LPWSTR* argv = CommandLineToArgvW(szCommandLine, &argc); // Read the crash info passed by CrashRpt.dll to CrashSender.exe if(argc!=2) return 1; // No arguments passed // Read crash info CString sFileName = CString(argv[1]); int nInit = g_CrashInfo.Init(sFileName); if(nInit!=0) { MessageBox(NULL, _T("Couldn't initialize!"), _T("CrashSender.exe"), MB_ICONERROR); return 1; } if(!g_CrashInfo.m_bSendRecentReports) { // Do the crash info collection work assynchronously g_ErrorReportSender.DoWork(COLLECT_CRASH_INFO); } // Check window mirroring settings CString sRTL = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("Settings"), _T("RTLReading")); if(sRTL.CompareNoCase(_T("1"))==0) { SetProcessDefaultLayout(LAYOUT_RTL); } CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); if(!g_CrashInfo.m_bSendRecentReports) { if(dlgErrorReport.Create(NULL) == NULL) { ATLTRACE(_T("Main dialog creation failed!\n")); return 0; } } else { // check if another instance of CrashSender.exe is running ::CreateMutex( NULL, FALSE,_T("Local\\43773530-129a-4298-88f2-20eea3e4a59b")); if (::GetLastError() == ERROR_ALREADY_EXISTS) { // Another CrashSender.exe already tries to resend recent reports; exit. return 0; } if(g_CrashInfo.GetReportCount()==0) return 0; // There are no reports for us to send // Check if it is ok to remind user now if(!g_CrashInfo.IsRemindNowOK()) return 0; if(dlgResend.Create(NULL) == NULL) { ATLTRACE(_T("Resend dialog creation failed!\n")); return 0; } } int nRet = theLoop.Run(); // Wait until the worker thread is exited g_ErrorReportSender.WaitForCompletion(); nRet = g_ErrorReportSender.GetGlobalStatus(); _Module.RemoveMessageLoop(); return nRet; }
LRESULT CErrorReportDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // Mirror this window if RTL language is in use CString sRTL = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("Settings"), _T("RTLReading")); if(sRTL.CompareNoCase(_T("1"))==0) { Utility::SetLayoutRTL(m_hWnd); } SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("DlgCaption"))); // Center the dialog on the screen CenterWindow(); HICON hIcon = NULL; // Get custom icon hIcon = g_CrashInfo.GetCustomIcon(); if(hIcon==NULL) { // Use default icon hIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)); } // Set window icon SetIcon(hIcon, 0); // Get the first icon in the EXE image m_HeadingIcon = ExtractIcon(NULL, g_CrashInfo.GetReport(0).m_sImageName, 0); // If there is no icon in crashed EXE module, use IDI_APPLICATION system icon if(m_HeadingIcon == NULL) { m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)); } m_statSubHeader = GetDlgItem(IDC_SUBHEADER); m_link.SubclassWindow(GetDlgItem(IDC_LINK)); m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_link.SetLabel(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("WhatDoesReportContain"))); m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO)); m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_linkMoreInfo.SetLabel(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("ProvideAdditionalInfo"))); m_statEmail = GetDlgItem(IDC_STATMAIL); m_statEmail.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("YourEmail"))); m_editEmail = GetDlgItem(IDC_EMAIL); m_statDesc = GetDlgItem(IDC_DESCRIBE); m_statDesc.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("DescribeProblem"))); m_editDesc = GetDlgItem(IDC_DESCRIPTION); m_statIndent = GetDlgItem(IDC_INDENT); m_chkRestart = GetDlgItem(IDC_RESTART); CString sCaption; sCaption.Format(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("RestartApp")), g_CrashInfo.m_sAppName); m_chkRestart.SetWindowText(sCaption); m_chkRestart.SetCheck(BST_CHECKED); m_chkRestart.ShowWindow(g_CrashInfo.m_bAppRestart?SW_SHOW:SW_HIDE); m_statConsent = GetDlgItem(IDC_CONSENT); // Init font for consent string LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 11; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); CFontHandle hConsentFont; hConsentFont.CreateFontIndirect(&lf); m_statConsent.SetFont(hConsentFont); if(g_CrashInfo.m_sPrivacyPolicyURL.IsEmpty()) m_statConsent.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("MyConsent2"))); else m_statConsent.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("MyConsent"))); m_linkPrivacyPolicy.SubclassWindow(GetDlgItem(IDC_PRIVACYPOLICY)); m_linkPrivacyPolicy.SetHyperLink(g_CrashInfo.m_sPrivacyPolicyURL); m_linkPrivacyPolicy.SetLabel(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("PrivacyPolicy"))); BOOL bShowPrivacyPolicy = !g_CrashInfo.m_sPrivacyPolicyURL.IsEmpty(); m_linkPrivacyPolicy.ShowWindow(bShowPrivacyPolicy?SW_SHOW:SW_HIDE); m_statCrashRpt = GetDlgItem(IDC_CRASHRPT); m_statHorzLine = GetDlgItem(IDC_HORZLINE); m_btnOk = GetDlgItem(IDOK); m_btnOk.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("SendReport"))); m_btnCancel = GetDlgItem(IDC_CANCEL); if(g_CrashInfo.m_bQueueEnabled) m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("OtherActions"))); else m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("CloseTheProgram"))); // Init font for heading text memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 25; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); m_HeadingFont.CreateFontIndirect(&lf); m_Layout.SetContainerWnd(m_hWnd); m_Layout.Insert(m_linkMoreInfo); m_Layout.Insert(m_statIndent); m_Layout.Insert(m_statEmail, TRUE); m_Layout.Insert(m_editEmail, TRUE); m_Layout.Insert(m_statDesc, TRUE); m_Layout.Insert(m_editDesc, TRUE); m_Layout.Insert(m_chkRestart); m_Layout.Insert(m_statConsent); m_Layout.Insert(m_linkPrivacyPolicy); m_Layout.Insert(m_statCrashRpt); m_Layout.Insert(m_statHorzLine, TRUE); m_Layout.Insert(m_btnOk); m_Layout.Insert(m_btnCancel, TRUE); ShowMoreInfo(FALSE); m_dlgProgress.Create(m_hWnd); m_dlgProgress.Start(TRUE); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); if(pLoop) { pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); } UIAddChildWindowContainer(m_hWnd); return TRUE; }
void CMuleToolbarCtrl::OnNMRclick(NMHDR* /*pNMHDR*/, LRESULT* pResult) { if (GetKeyState(VK_CONTROL) & 0x8000) { if (!thePrefs.GetToolbarBitmapSettings().IsEmpty()) ChangeToolbarBitmap(thePrefs.GetToolbarBitmapSettings(), true); if (!thePrefs.GetSkinProfile().IsEmpty()) theApp.ApplySkin(thePrefs.GetSkinProfile()); *pResult = TRUE; return; } /////////////////////////////////////////////////////////////////////////// // "Toolbar Bitmap" sub menu // CMenu menuBitmaps; menuBitmaps.CreateMenu(); menuBitmaps.AppendMenu(MF_STRING, MP_SELECTTOOLBARBITMAP, GetResString(IDS_SELECTTOOLBARBITMAP)); menuBitmaps.AppendMenu(MF_STRING, MP_SELECTTOOLBARBITMAPDIR, GetResString(IDS_SELECTTOOLBARBITMAPDIR)); menuBitmaps.AppendMenu(MF_SEPARATOR); menuBitmaps.AppendMenu(MF_STRING, MP_TOOLBARBITMAP, GetResString(IDS_DEFAULT)); m_astrToolbarPaths.RemoveAll(); CString currentBitmapSettings = thePrefs.GetToolbarBitmapSettings(); bool checked = false; if (currentBitmapSettings.IsEmpty()) { menuBitmaps.CheckMenuItem(MP_TOOLBARBITMAP, MF_CHECKED); menuBitmaps.EnableMenuItem(MP_TOOLBARBITMAP, MF_DISABLED); checked = true; } m_astrToolbarPaths.Add(_T("")); // dummy entry for 'Default' menu item int i = 1; if (!thePrefs.GetMuleDirectory(EMULE_TOOLBARDIR).IsEmpty()) { CStringArray astrToolbarFiles; for (int f = 0; f < _countof(_apszTBFiles); f++) { WIN32_FIND_DATA FileData; HANDLE hSearch = FindFirstFile(thePrefs.GetMuleDirectory(EMULE_TOOLBARDIR) + CString(_T("\\")) + _apszTBFiles[f], &FileData); if (hSearch != INVALID_HANDLE_VALUE) { do { astrToolbarFiles.Add(FileData.cFileName); } while (astrToolbarFiles.GetCount() < MAX_TOOLBAR_FILES && FindNextFile(hSearch, &FileData)); FindClose(hSearch); } } if (astrToolbarFiles.GetCount() > 0) { Sort(astrToolbarFiles); for (int f = 0; f < astrToolbarFiles.GetCount(); f++) { const CString& bitmapFileName = astrToolbarFiles.GetAt(f); CString bitmapBaseName; LPCTSTR pszTbBaseExt = stristr(bitmapFileName, EMULTB_BASEEXT); if (pszTbBaseExt) bitmapBaseName = bitmapFileName.Left(pszTbBaseExt - (LPCTSTR)bitmapFileName - 1); else bitmapBaseName = bitmapFileName; menuBitmaps.AppendMenu(MF_STRING, MP_TOOLBARBITMAP + i, bitmapBaseName); m_astrToolbarPaths.Add(thePrefs.GetMuleDirectory(EMULE_TOOLBARDIR) + CString(_T("\\")) + bitmapFileName); if (!checked && currentBitmapSettings.CompareNoCase(m_astrToolbarPaths[i]) == 0) { menuBitmaps.CheckMenuItem(MP_TOOLBARBITMAP + i, MF_CHECKED); menuBitmaps.EnableMenuItem(MP_TOOLBARBITMAP + i, MF_DISABLED); checked = true; } i++; } } ASSERT( i-1 == astrToolbarFiles.GetCount() ); } if (!checked) { menuBitmaps.AppendMenu(MF_STRING, MP_TOOLBARBITMAP + i, currentBitmapSettings); menuBitmaps.CheckMenuItem(MP_TOOLBARBITMAP + i, MF_CHECKED); menuBitmaps.EnableMenuItem(MP_TOOLBARBITMAP + i, MF_DISABLED); m_astrToolbarPaths.Add(currentBitmapSettings); } /////////////////////////////////////////////////////////////////////////// // "Skin Profile" sub menu // CMenu menuSkins; menuSkins.CreateMenu(); menuSkins.AppendMenu(MF_STRING, MP_SELECT_SKIN_FILE, GetResString(IDS_SEL_SKIN)); menuSkins.AppendMenu(MF_STRING, MP_SELECT_SKIN_DIR, GetResString(IDS_SEL_SKINDIR)); menuSkins.AppendMenu(MF_SEPARATOR); menuSkins.AppendMenu(MF_STRING, MP_SKIN_PROFILE,GetResString(IDS_DEFAULT)); m_astrSkinPaths.RemoveAll(); CString currentSkin = thePrefs.GetSkinProfile(); checked = false; if (currentSkin.IsEmpty()) { menuSkins.CheckMenuItem(MP_SKIN_PROFILE, MF_CHECKED); menuSkins.EnableMenuItem(MP_SKIN_PROFILE, MF_DISABLED); checked = true; } m_astrSkinPaths.Add(_T("")); // dummy entry for 'Default' menu item i = 1; if (!thePrefs.GetMuleDirectory(EMULE_SKINDIR, false).IsEmpty()) { CStringArray astrSkinFiles; for (int f = 0; f < _countof(_apszSkinFiles); f++) { WIN32_FIND_DATA FileData; HANDLE hSearch = FindFirstFile(thePrefs.GetMuleDirectory(EMULE_SKINDIR, false) + CString(_T("\\")) + _apszSkinFiles[f], &FileData); if (hSearch != INVALID_HANDLE_VALUE) { do { astrSkinFiles.Add(FileData.cFileName); } while (astrSkinFiles.GetCount() < MAX_SKIN_FILES && FindNextFile(hSearch, &FileData)); FindClose(hSearch); } } if (astrSkinFiles.GetCount() > 0) { Sort(astrSkinFiles); for (int f = 0; f < astrSkinFiles.GetCount(); f++) { const CString& skinFileName = astrSkinFiles.GetAt(f); CString skinBaseName; LPCTSTR pszSkinBaseExt = stristr(skinFileName, _T(".") EMULSKIN_BASEEXT _T(".ini")); if (pszSkinBaseExt) skinBaseName = skinFileName.Left(pszSkinBaseExt - (LPCTSTR)skinFileName); else skinBaseName = skinFileName; menuSkins.AppendMenu(MF_STRING, MP_SKIN_PROFILE + i, skinBaseName); m_astrSkinPaths.Add(thePrefs.GetMuleDirectory(EMULE_SKINDIR, false) + CString(_T("\\")) + skinFileName); if (!checked && currentSkin.CompareNoCase(m_astrSkinPaths[i]) == 0) { menuSkins.CheckMenuItem(MP_SKIN_PROFILE + i, MF_CHECKED); menuSkins.EnableMenuItem(MP_SKIN_PROFILE + i, MF_DISABLED); checked = true; } i++; } } ASSERT( i-1 == astrSkinFiles.GetCount() ); } if (!checked) { menuSkins.AppendMenu(MF_STRING, MP_SKIN_PROFILE + i, currentSkin); menuSkins.CheckMenuItem(MP_SKIN_PROFILE + i, MF_CHECKED); menuSkins.EnableMenuItem(MP_SKIN_PROFILE + i, MF_DISABLED); m_astrSkinPaths.Add(currentSkin); } /////////////////////////////////////////////////////////////////////////// // "Text Label" sub menu // CMenu menuTextLabels; menuTextLabels.CreateMenu(); ASSERT( MP_NOTEXTLABELS == MP_TEXTLABELS-1 && MP_NOTEXTLABELS == MP_TEXTLABELSONRIGHT-2 ); ASSERT( MP_NOTEXTLABELS + (int)NoLabels == MP_NOTEXTLABELS ); ASSERT( MP_NOTEXTLABELS + (int)LabelsBelow == MP_TEXTLABELS ); ASSERT( MP_NOTEXTLABELS + (int)LabelsRight == MP_TEXTLABELSONRIGHT ); menuTextLabels.AppendMenu(MF_STRING | MF_ENABLED, MP_NOTEXTLABELS, GetResString(IDS_NOTEXTLABELS)); menuTextLabels.AppendMenu(MF_STRING | MF_ENABLED, MP_TEXTLABELS, GetResString(IDS_ENABLETEXTLABELS)); menuTextLabels.AppendMenu(MF_STRING | MF_ENABLED, MP_TEXTLABELSONRIGHT, GetResString(IDS_TEXTLABELSONRIGHT)); menuTextLabels.CheckMenuRadioItem(MP_NOTEXTLABELS, MP_TEXTLABELSONRIGHT, MP_NOTEXTLABELS + (int)thePrefs.GetToolbarLabelSettings(), MF_BYCOMMAND); menuTextLabels.EnableMenuItem(MP_NOTEXTLABELS + (int)thePrefs.GetToolbarLabelSettings(), MF_BYCOMMAND | MF_DISABLED); menuTextLabels.AppendMenu(MF_SEPARATOR); menuTextLabels.AppendMenu(MF_STRING, MP_LARGEICONS, GetResString(IDS_LARGEICONS)); menuTextLabels.AppendMenu(MF_STRING, MP_SMALLICONS, GetResString(IDS_SMALLICONS)); ASSERT( MP_LARGEICONS == MP_SMALLICONS-1 ); menuTextLabels.CheckMenuRadioItem(MP_LARGEICONS, MP_SMALLICONS, m_sizBtnBmp.cx == 16 ? MP_SMALLICONS : MP_LARGEICONS, MF_BYCOMMAND); menuTextLabels.EnableMenuItem(m_sizBtnBmp.cx == 16 ? MP_SMALLICONS : MP_LARGEICONS, MF_BYCOMMAND | MF_DISABLED); /////////////////////////////////////////////////////////////////////////// // Toolbar context menu // CMenu menuToolbar; menuToolbar.CreatePopupMenu(); menuToolbar.AppendMenu(MF_STRING | MF_POPUP, (UINT_PTR)menuBitmaps.m_hMenu, GetResString(IDS_TOOLBARSKINS)); menuToolbar.AppendMenu(MF_STRING | MF_POPUP, (UINT_PTR)menuSkins.m_hMenu, GetResString(IDS_SKIN_PROF)); menuToolbar.AppendMenu(MF_STRING | MF_POPUP, (UINT_PTR)menuTextLabels.m_hMenu, GetResString(IDS_TEXTLABELS)); menuToolbar.AppendMenu(MF_STRING, MP_CUSTOMIZETOOLBAR, GetResString(IDS_CUSTOMIZETOOLBAR)); CPoint point; GetCursorPos(&point); menuToolbar.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); *pResult = TRUE; }
BOOL ProjectProperties::ReadProps(CTGitPath path) { CString sPropVal; GetStringProps(this->sLabel,BUGTRAQPROPNAME_LABEL); GetStringProps(this->sMessage,BUGTRAQPROPNAME_MESSAGE); GetStringProps(this->sUrl,BUGTRAQPROPNAME_URL); GetBOOLProps(this->bWarnIfNoIssue,BUGTRAQPROPNAME_WARNIFNOISSUE); GetBOOLProps(this->bNumber,BUGTRAQPROPNAME_NUMBER); GetBOOLProps(this->bAppend,BUGTRAQPROPNAME_APPEND); GetStringProps(sPropVal,BUGTRAQPROPNAME_LOGREGEX,false); sCheckRe = sPropVal; if (sCheckRe.Find('\n')>=0) { sBugIDRe = sCheckRe.Mid(sCheckRe.Find('\n')).Trim(); sCheckRe = sCheckRe.Left(sCheckRe.Find('\n')).Trim(); } if (!sCheckRe.IsEmpty()) { sCheckRe = sCheckRe.Trim(); } return TRUE; #if 0 BOOL bFoundBugtraqLabel = FALSE; BOOL bFoundBugtraqMessage = FALSE; BOOL bFoundBugtraqNumber = FALSE; BOOL bFoundBugtraqLogRe = FALSE; BOOL bFoundBugtraqURL = FALSE; BOOL bFoundBugtraqWarnIssue = FALSE; BOOL bFoundBugtraqAppend = FALSE; BOOL bFoundLogWidth = FALSE; BOOL bFoundLogTemplate = FALSE; BOOL bFoundMinLogSize = FALSE; BOOL bFoundMinLockMsgSize = FALSE; BOOL bFoundFileListEnglish = FALSE; BOOL bFoundProjectLanguage = FALSE; BOOL bFoundUserFileProps = FALSE; BOOL bFoundUserDirProps = FALSE; BOOL bFoundWebViewRev = FALSE; BOOL bFoundWebViewPathRev = FALSE; BOOL bFoundAutoProps = FALSE; BOOL bFoundLogSummary = FALSE; if (!path.IsDirectory()) path = path.GetContainingDirectory(); for (;;) { GitProperties props(path, GitRev::REV_WC, false); for (int i=0; i<props.GetCount(); ++i) { CString sPropName = props.GetItemName(i).c_str(); CString sPropVal = CUnicodeUtils::GetUnicode(((char *)props.GetItemValue(i).c_str())); if ((!bFoundBugtraqLabel)&&(sPropName.Compare(BUGTRAQPROPNAME_LABEL)==0)) { sLabel = sPropVal; bFoundBugtraqLabel = TRUE; } if ((!bFoundBugtraqMessage)&&(sPropName.Compare(BUGTRAQPROPNAME_MESSAGE)==0)) { sMessage = sPropVal; bFoundBugtraqMessage = TRUE; } if ((!bFoundBugtraqNumber)&&(sPropName.Compare(BUGTRAQPROPNAME_NUMBER)==0)) { CString val; val = sPropVal; val = val.Trim(_T(" \n\r\t")); if ((val.CompareNoCase(_T("false"))==0)||(val.CompareNoCase(_T("no"))==0)) bNumber = FALSE; else bNumber = TRUE; bFoundBugtraqNumber = TRUE; } if ((!bFoundBugtraqLogRe)&&(sPropName.Compare(BUGTRAQPROPNAME_LOGREGEX)==0)) { sCheckRe = sPropVal; if (sCheckRe.Find('\n')>=0) { sBugIDRe = sCheckRe.Mid(sCheckRe.Find('\n')).Trim(); sCheckRe = sCheckRe.Left(sCheckRe.Find('\n')).Trim(); } if (!sCheckRe.IsEmpty()) { sCheckRe = sCheckRe.Trim(); } bFoundBugtraqLogRe = TRUE; } if ((!bFoundBugtraqURL)&&(sPropName.Compare(BUGTRAQPROPNAME_URL)==0)) { sUrl = sPropVal; bFoundBugtraqURL = TRUE; } if ((!bFoundBugtraqWarnIssue)&&(sPropName.Compare(BUGTRAQPROPNAME_WARNIFNOISSUE)==0)) { CString val; val = sPropVal; val = val.Trim(_T(" \n\r\t")); if ((val.CompareNoCase(_T("true"))==0)||(val.CompareNoCase(_T("yes"))==0)) bWarnIfNoIssue = TRUE; else bWarnIfNoIssue = FALSE; bFoundBugtraqWarnIssue = TRUE; } if ((!bFoundBugtraqAppend)&&(sPropName.Compare(BUGTRAQPROPNAME_APPEND)==0)) { CString val; val = sPropVal; val = val.Trim(_T(" \n\r\t")); if ((val.CompareNoCase(_T("true"))==0)||(val.CompareNoCase(_T("yes"))==0)) bAppend = TRUE; else bAppend = FALSE; bFoundBugtraqAppend = TRUE; } if ((!bFoundLogWidth)&&(sPropName.Compare(PROJECTPROPNAME_LOGWIDTHLINE)==0)) { CString val; val = sPropVal; if (!val.IsEmpty()) { nLogWidthMarker = _ttoi(val); } bFoundLogWidth = TRUE; } if ((!bFoundLogTemplate)&&(sPropName.Compare(PROJECTPROPNAME_LOGTEMPLATE)==0)) { sLogTemplate = sPropVal; sLogTemplate.Remove('\r'); sLogTemplate.Replace(_T("\n"), _T("\r\n")); bFoundLogTemplate = TRUE; } if ((!bFoundMinLogSize)&&(sPropName.Compare(PROJECTPROPNAME_LOGMINSIZE)==0)) { CString val; val = sPropVal; if (!val.IsEmpty()) { nMinLogSize = _ttoi(val); } bFoundMinLogSize = TRUE; } if ((!bFoundMinLockMsgSize)&&(sPropName.Compare(PROJECTPROPNAME_LOCKMSGMINSIZE)==0)) { CString val; val = sPropVal; if (!val.IsEmpty()) { nMinLockMsgSize = _ttoi(val); } bFoundMinLockMsgSize = TRUE; } if ((!bFoundFileListEnglish)&&(sPropName.Compare(PROJECTPROPNAME_LOGFILELISTLANG)==0)) { CString val; val = sPropVal; val = val.Trim(_T(" \n\r\t")); if ((val.CompareNoCase(_T("false"))==0)||(val.CompareNoCase(_T("no"))==0)) bFileListInEnglish = TRUE; else bFileListInEnglish = FALSE; bFoundFileListEnglish = TRUE; } if ((!bFoundProjectLanguage)&&(sPropName.Compare(PROJECTPROPNAME_PROJECTLANGUAGE)==0)) { CString val; val = sPropVal; if (!val.IsEmpty()) { LPTSTR strEnd; lProjectLanguage = _tcstol(val, &strEnd, 0); } bFoundProjectLanguage = TRUE; } if ((!bFoundUserFileProps)&&(sPropName.Compare(PROJECTPROPNAME_USERFILEPROPERTY)==0)) { sFPPath = sPropVal; sFPPath.Replace(_T("\r\n"), _T("\n")); bFoundUserFileProps = TRUE; } if ((!bFoundUserDirProps)&&(sPropName.Compare(PROJECTPROPNAME_USERDIRPROPERTY)==0)) { sDPPath = sPropVal; sDPPath.Replace(_T("\r\n"), _T("\n")); bFoundUserDirProps = TRUE; } if ((!bFoundAutoProps)&&(sPropName.Compare(PROJECTPROPNAME_AUTOPROPS)==0)) { sAutoProps = sPropVal; sAutoProps.Replace(_T("\r\n"), _T("\n")); bFoundAutoProps = TRUE; } if ((!bFoundWebViewRev)&&(sPropName.Compare(PROJECTPROPNAME_WEBVIEWER_REV)==0)) { sWebViewerRev = sPropVal; bFoundWebViewRev = TRUE; } if ((!bFoundWebViewPathRev)&&(sPropName.Compare(PROJECTPROPNAME_WEBVIEWER_PATHREV)==0)) { sWebViewerPathRev = sPropVal; bFoundWebViewPathRev = TRUE; } if ((!bFoundLogSummary)&&(sPropName.Compare(PROJECTPROPNAME_LOGSUMMARY)==0)) { sLogSummaryRe = sPropVal; bFoundLogSummary = TRUE; } } if (PathIsRoot(path.GetWinPath())) return FALSE; propsPath = path; path = path.GetContainingDirectory(); if ((!path.HasAdminDir())||(path.IsEmpty())) { if (bFoundBugtraqLabel | bFoundBugtraqMessage | bFoundBugtraqNumber | bFoundBugtraqURL | bFoundBugtraqWarnIssue | bFoundLogWidth | bFoundLogTemplate | bFoundBugtraqLogRe | bFoundMinLockMsgSize | bFoundUserFileProps | bFoundUserDirProps | bFoundAutoProps | bFoundWebViewRev | bFoundWebViewPathRev | bFoundLogSummary) { return TRUE; } propsPath.Reset(); return FALSE; } } #endif return FALSE; //never reached }
LRESULT CProgressDlg::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // This method is called when a timer ticks. WORD wTimerId = (WORD)wParam; CErrorReportSender* pSender = CErrorReportSender::GetInstance(); if(wTimerId==0) // Dialog update timer { // Get current progress int nProgressPct = 0; std::vector<CString> messages; pSender->GetCurOpStatus(nProgressPct, messages); // Update progress bar m_prgProgress.SetPos(nProgressPct); int attempt = 0; // Sending attempt // Walk through incoming messages and look for special ones (enclosed in [ ]) unsigned i; for(i=0; i<messages.size(); i++) { if(messages[i].CompareNoCase(_T("[creating_dump]"))==0) { // Creating minidump m_ActionOnCancel = DONT_CLOSE; m_ActionOnClose = CLOSE_MYSELF_AND_PARENT; m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("CollectingCrashInfo"))); } else if(messages[i].CompareNoCase(_T("[copying_files]"))==0) { // Copying files m_ActionOnCancel = DONT_CLOSE; m_ActionOnClose = CLOSE_MYSELF_AND_PARENT; // Remove marquee style from progress bar m_prgProgress.ModifyStyle(PBS_MARQUEE, 0); } else if(messages[i].CompareNoCase(_T("[confirm_send_report]"))==0) { // User should consent to send error report, so we hide this dialog // and send a message to our parent dialog that will receive user input. m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT; ShowWindow(SW_HIDE); HWND hWndParent = ::GetParent(m_hWnd); ::PostMessage(hWndParent, WM_COMPLETECOLLECT, 0, 0); } else if(messages[i].CompareNoCase(_T("[exporting_report]"))==0) { // Exporting error report as a ZIP archive m_ActionOnCancel = DONT_CLOSE; m_ActionOnClose = DONT_CLOSE; CString sCaption; sCaption.Format(pSender->GetLangStr(_T("ProgressDlg"), _T("DlgCaptionExport")), pSender->GetCrashInfo()->m_sAppName); SetWindowText(sCaption); m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("CompressingFiles"))); m_btnCancel.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("Cancel"))); ShowWindow(SW_SHOW); } else if(messages[i].CompareNoCase(_T("[end_exporting_report_ok]"))==0) { // End exporting error report m_ActionOnCancel = CLOSE_MYSELF; ShowWindow(SW_HIDE); } else if(messages[i].CompareNoCase(_T("[end_exporting_report_failed]"))==0) { // Failed to export error report m_ActionOnCancel = CLOSE_MYSELF; m_ActionOnClose = CLOSE_MYSELF; m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("ExportedWithErrors"))); m_btnCancel.EnableWindow(1); m_btnCancel.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("Close"))); } else if(messages[i].CompareNoCase(_T("[compressing_files]"))==0) { // Compressing error report files m_ActionOnCancel = DONT_CLOSE; m_ActionOnClose = CLOSE_MYSELF; m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("CompressingFiles"))); m_btnCancel.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("Cancel"))); } else if(messages[i].CompareNoCase(_T("[end_compressing_files]"))==0) { // File compression finished if(!pSender->GetCrashInfo()->m_bSendErrorReport && pSender->GetCrashInfo()->m_bStoreZIPArchives) { m_ActionOnCancel = CLOSE_MYSELF; m_ActionOnClose = CLOSE_MYSELF; HWND hWndParent = ::GetParent(m_hWnd); ::PostMessage(hWndParent, WM_CLOSE, 0, 0); } } else if(messages[i].CompareNoCase(_T("[status_success]"))==0) { // Error report has been delivered ok m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT; m_ActionOnClose = CLOSE_MYSELF_AND_PARENT; // Close the parent dialog. HWND hWndParent = ::GetParent(m_hWnd); ::PostMessage(hWndParent, WM_CLOSE, 0, 0); } else if(messages[i].CompareNoCase(_T("[status_failed]"))==0) { // Error report delivery has failed m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT; m_ActionOnClose = CLOSE_MYSELF_AND_PARENT; // Stop timer KillTimer(1); // Update status text. m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("CompletedWithErrors"))); // Enable "Close" button m_btnCancel.EnableWindow(1); m_btnCancel.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("Close"))); // Show the dialog ShowWindow(SW_SHOW); } else if(messages[i].CompareNoCase(_T("[exit_silently]"))==0) { // Silent exit m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT; m_ActionOnClose = CLOSE_MYSELF_AND_PARENT; // Stop timer KillTimer(1); // Close the parent dialog. HWND hWndParent = ::GetParent(m_hWnd); ::PostMessage(hWndParent, WM_CLOSE, 0, 0); } else if(messages[i].CompareNoCase(_T("[cancelled_by_user]"))==0) { // The operation was cancelled by user m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("Cancelling"))); } else if(messages[i].CompareNoCase(_T("[sending_attempt]"))==0) { // Trying to send error report using another method attempt ++; CString str; str.Format(pSender->GetLangStr(_T("ProgressDlg"), _T("StatusText")), attempt); m_statText.SetWindowText(str); } else if(messages[i].CompareNoCase(_T("[confirm_launch_email_client]"))==0) { // User should confirm he allows to launch email client KillTimer(1); // Show the dialog ShowWindow(SW_SHOW); // Determine window mirroring settings. DWORD dwFlags = 0; CString sRTL = pSender->GetLangStr(_T("Settings"), _T("RTLReading")); if(sRTL.CompareNoCase(_T("1"))==0) dwFlags = MB_RTLREADING; // Display the message box, so user to be able to confirm. CString sMailClientName; CMailMsg::DetectMailClient(sMailClientName); CString msg; msg.Format(pSender->GetLangStr(_T("ProgressDlg"), _T("ConfirmLaunchEmailClient")), sMailClientName); CString sCaption = pSender->GetLangStr(_T("ProgressDlg"), _T("DlgCaption")); CString sTitle; sTitle.Format(sCaption, pSender->GetCrashInfo()->m_sAppName); INT_PTR result = MessageBox(msg, sTitle, MB_OKCANCEL|MB_ICONQUESTION|dwFlags); // Unblock worker thread. pSender->FeedbackReady(result==IDOK?0:1); // Hide the dialog ShowWindow(SW_HIDE); } // Ensure the last item of the log is visible int count = m_listView.GetItemCount(); int indx = m_listView.InsertItem(count, messages[i]); m_listView.EnsureVisible(indx, TRUE); } } else if(wTimerId==1) // The timer that hides this window { // Hide the window smoothly AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); // Stop the timer KillTimer(1); } return 0; }
void CSigWatchDlg::vAddMsgSigIntoList( const CString& omStrMsgName, const CStringArray& omSASignals, const CStringArray& omSARaw, const CStringArray& omSAPhysical, BOOL bIntptrDone) { m_omCSDispEntry.Lock(); ASSERT( omSASignals.GetSize() == omSARaw.GetSize() && omSARaw.GetSize() == omSAPhysical.GetSize() ); if( bIntptrDone == FALSE) { int nSize = (int)omSASignals.GetSize(); //check the valid entries in the signal watch window. POSITION ListPos = m_odSigEntryList.GetHeadPosition(); while(ListPos) { POSITION TempPos = ListPos; sSIGENTRY& sTempList = m_odSigEntryList.GetNext(ListPos); CString strMsgName = sTempList.m_omMsgName; CString strSigName = sTempList.m_omSigName; //check for valid message name if(strMsgName.CompareNoCase(omStrMsgName) == 0 ) { bool bDeleteMsgSignal = true; int iCount = 0; for(; iCount < nSize; iCount++) { CString strSignal = omSASignals.GetAt(iCount); if(strSignal.CompareNoCase(strSigName) == 0 ) { //signal is valid, just check for next bDeleteMsgSignal = false; break; } } if(bDeleteMsgSignal) //some invalid signal found { m_odSigEntryList.RemoveAt(TempPos); //remove the signal from list POSITION ResetPos = m_odSigEntryList.GetHeadPosition(); iCount = 0; while(ResetPos) //reset the m_nEntryIndex in the list { sSIGENTRY& sResetList = m_odSigEntryList.GetNext(ResetPos); sResetList.m_nEntryIndex = iCount; iCount++; } //check for signal in the signal watch window iCount = m_omSignalList.GetItemCount(); if(iCount > 0) { //delete the last entry form the signal watch window m_omSignalList.DeleteItem(iCount -1); } } } } for( register int index = 0; index < nSize; index++) { CString omStrSignalInfo; CString omListStr = omSASignals.GetAt(index); POSITION pos = nullptr; sSIGENTRY sEntry; sEntry.m_omMsgName = omStrMsgName; sEntry.m_omSigName = omListStr; sEntry.m_omPhyValue = omSAPhysical.GetAt(index); sEntry.m_omRawValue = omSARaw.GetAt(index); if (nullptr != (pos = m_odSigEntryList.Find(sEntry))) { sSIGENTRY& sTemp = m_odSigEntryList.GetAt(pos); sTemp.m_omPhyValue = sEntry.m_omPhyValue; sTemp.m_omRawValue = sEntry.m_omRawValue; } else { m_odSigEntryList.AddTail(sEntry); } } } m_omCSDispEntry.Unlock(); }
virtual void Load( OptionRowDefinition &defOut, CString sParam ) { ASSERT( sParam.size() ); if( sParam.CompareNoCase("NoteSkins")==0 ) { FillNoteSkins( defOut, sParam ); return; } else if( sParam.CompareNoCase("Steps")==0 ) { FillSteps( defOut, sParam, false ); return; } else if( sParam.CompareNoCase("StepsLocked")==0 ) { FillSteps( defOut, sParam, true ); return; } else if( sParam.CompareNoCase("Characters")==0 ) { FillCharacters( defOut, sParam ); return; } else if( sParam.CompareNoCase("Styles")==0 ) { FillStyles( defOut, sParam ); return; } else if( sParam.CompareNoCase("Groups")==0 ) { FillGroups( defOut, sParam ); return; } else if( sParam.CompareNoCase("Difficulties")==0 ) { FillDifficulties( defOut, sParam ); return; } else if( sParam.CompareNoCase("SongsInCurrentSongGroup")==0 ) { FillSongsInCurrentSongGroup( defOut, sParam ); return; } Init(); defOut.Init(); m_bUseModNameForIcon = true; defOut.name = sParam; Default.Load( -1, ParseCommands(ENTRY_DEFAULT(sParam)) ); /* Parse the basic configuration metric. */ Commands cmds = ParseCommands( ENTRY(sParam) ); if( cmds.v.size() < 1 ) RageException::Throw( "Parse error in ScreenOptionsMaster::%s", sParam.c_str() ); defOut.bOneChoiceForAllPlayers = false; const int NumCols = atoi( cmds.v[0].m_vsArgs[0] ); for( unsigned i=1; i<cmds.v.size(); i++ ) { const Command &cmd = cmds.v[i]; CString sName = cmd.GetName(); if( sName == "together" ) defOut.bOneChoiceForAllPlayers = true; else if( sName == "selectmultiple" ) defOut.selectType = SELECT_MULTIPLE; else if( sName == "selectone" ) defOut.selectType = SELECT_ONE; else if( sName == "selectnone" ) defOut.selectType = SELECT_NONE; else if( sName == "showoneinrow" ) defOut.layoutType = LAYOUT_SHOW_ONE_IN_ROW; else if( sName == "reloadrowmessages" ) { for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ ) m_vsReloadRowMessages.push_back( cmd.m_vsArgs[a] ); } else if( sName == "enabledforplayers" ) { defOut.m_vEnabledForPlayers.clear(); for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ ) { CString sArg = cmd.m_vsArgs[a]; PlayerNumber pn = (PlayerNumber)(atoi(sArg)-1); ASSERT( pn >= 0 && pn < NUM_PLAYERS ); defOut.m_vEnabledForPlayers.insert( pn ); } } else if( sName == "exportonchange" ) defOut.m_bExportOnChange = true; else if( sName == "broadcastonexport" ) { for( unsigned i=1; i<cmd.m_vsArgs.size(); i++ ) m_vsBroadcastOnExport.push_back( cmd.m_vsArgs[i] ); } else RageException::Throw( "Unkown row flag \"%s\"", sName.c_str() ); } for( int col = 0; col < NumCols; ++col ) { GameCommand mc; mc.Load( 0, ParseCommands(ENTRY_MODE(sParam, col)) ); /* If the row has just one entry, use the name of the row as the name of the * entry. If it has more than one, each one must be specified explicitly. */ if( mc.m_sName == "" && NumCols == 1 ) mc.m_sName = sParam; if( mc.m_sName == "" ) RageException::Throw( "List \"%s\", col %i has no name", sParam.c_str(), col ); if( !mc.IsPlayable() ) { LOG->Trace( "\"%s\" is not playable.", sParam.c_str() ); continue; } ListEntries.push_back( mc ); CString sName = mc.m_sName; CString sChoice = mc.m_sName; defOut.choices.push_back( sChoice ); } // OpenITG hack: load player-defined speed mods if (sParam == "Speed") { set<CString> additionalSet; // load anything from the machine profile first Profile *pMProf = PROFILEMAN->GetMachineProfile(); if (pMProf != NULL) { FOREACH_CONST(CString, pMProf->m_sPlayerAdditionalModifiers, mod) additionalSet.insert(*mod); } // then load anything from the players' profiles FOREACH_EnabledPlayer( pn ) { Profile *pProf = PROFILEMAN->GetProfile(pn); if (pProf == NULL) continue; FOREACH_CONST(CString, pProf->m_sPlayerAdditionalModifiers, mod) additionalSet.insert(*mod); } FOREACHS_CONST( CString, additionalSet, addit_mod ) { Regex mult("^[0-9]{1,2}(\\.[0-9]{1,2})?x$"); Regex constmod("^C[0-9]{1,4}$"); Regex mmod("^M[0-9]{1,4}$"); CString sAdditModName; if (mult.Compare(*addit_mod)) { float factor = 1.0f; sscanf(*addit_mod, "%fx", &factor); sAdditModName = ssprintf("x%.1f", factor); } else if (constmod.Compare(*addit_mod)) { unsigned bpm = 300; sscanf(*addit_mod, "C%u", &bpm); sAdditModName = ssprintf("c%u", bpm); } else if (mmod.Compare(*addit_mod)) { unsigned bpm = 600; sscanf(*addit_mod, "M%u", &bpm); sAdditModName = ssprintf("m%u", bpm); } else ASSERT(0); // how'd it get in here in the first place... GameCommand mc; mc.Load( 0, ParseCommands(CString("mod,")+*addit_mod+";name,"+sAdditModName) ); if ( !mc.IsPlayable() ) { LOG->Trace( "Additional mod \"%s\" is not playable.", addit_mod->c_str() ); continue; } ListEntries.push_back(mc); defOut.choices.push_back(mc.m_sName); }
BOOL CDownloaderProperties_ListPage::DlgToVir() { CString strVir; m_wndVirName.GetWindowText (strVir); BOOL bVirCheck = IsDlgButtonChecked (IDC_VIRCHECK) == BST_CHECKED; if (strVir == "") { if (bVirCheck) { MessageBox (LS (L_ENTERAVIRNAME), LS (L_INPERR), MB_ICONEXCLAMATION); m_wndVirName.SetFocus (); return FALSE; } _DldsMgr.m_bVirCheck = FALSE; _DldsMgr.m_strVirName = ""; return TRUE; } BOOL bPredefined = FALSE; for (int i = 0; i < sizeof (_ppszAvirNames2) / sizeof (LPCSTR); i++) { if (strVir.CompareNoCase (_ppszAvirNames2 [i]) == 0) { strVir = _ppszAvirs2 [i]; bPredefined = TRUE; break; } } if (bPredefined) { bool bFound = false; bFound = DWORD (-1) != GetFileAttributes (vmsRegisteredApp::GetFullPath (strVir)); if (bFound == false) { MessageBox (LS (L_FAILEDTOFOUNDTHISAVIRTRYSPECIFYMANUALLY), LS (L_INPERR), MB_ICONEXCLAMATION); PostMessage (WM_COMMAND, IDC_CHOOSEVIR); return FALSE; } } else if (GetFileAttributes (strVir) == DWORD (-1)) { MessageBox (LS (L_NAMEISINVALID), LS (L_INPERR), MB_ICONEXCLAMATION); m_wndVirName.SetFocus (); return FALSE; } CString strArgs, strExts; GetDlgItemText (IDC_ARGS, strArgs); GetDlgItemText (IDC_VIREXTS, strExts); if (strArgs.Find ("%file%", 0) == -1) { CString str = LS (L_ARGSHAVNTFILEMACRO); str += "\n\n"; str += LS (L_CONTINUEANYWAY); if (IDNO == MessageBox (str, LS (L_WARNING), MB_ICONEXCLAMATION | MB_YESNO)) { GetDlgItem (IDC_ARGS)->SetFocus (); return FALSE; } } if (strExts == "" && bVirCheck) { MessageBox (LS (L_ENTEREXTS), LS (L_INPERR), MB_ICONEXCLAMATION); GetDlgItem (IDC_VIREXTS)->SetFocus (); return FALSE; } _DldsMgr.m_bVirCheck = TRUE; _DldsMgr.m_strVirName = strVir; _DldsMgr.m_strVirArgs = strArgs; _DldsMgr.m_strVirExts = strExts; _DldsMgr.m_bVirCheck = bVirCheck; return TRUE; }
BOOL CappIjaCtrl::InitInstance() { BOOL bInit = COleControlModule::InitInstance(); m_bHelpFileAvailable = TRUE; m_strHelpFile = _T("ija.chm"); m_strNewHelpPath = _T(""); _tsetlocale(LC_TIME, _T("")); _tsetlocale(LC_NUMERIC,_T("")); _tsetlocale(LC_COLLATE,_T("")); _tsetlocale(LC_CTYPE,_T("")); m_sessionManager.SetDescription (_T("Ingres Journal Analyzer")); m_dateFormat = II_DATE_US; if (bInit) { // // Allow to use the owner prefixed of table in the argument of the auditdb command: m_bTableWithOwnerAllowed = TRUE; m_strAllUser = _T("<all>"); LPCTSTR pEnv = _tgetenv(_T("II_SYSTEM")); if (!pEnv) { CString strMsg = _T("II_SYSTEM is not defined"); strMsg.LoadString (IDS_MSG_II_SYSTEM_NOT_DEFINED); AfxMessageBox (strMsg); m_strLocalIISystem = _T(""); } else m_strLocalIISystem = (LPCTSTR)pEnv; CString strValue; BOOL bOK = INGRESII_CheckVariable (_T("II_DATE_FORMAT"), strValue); if (bOK) { if (strValue.IsEmpty()) { // // US (default format) m_dateFormat = II_DATE_US; } else if (strValue.CompareNoCase (_T("US")) == 0) { m_dateFormat = II_DATE_US; } else if (strValue.CompareNoCase (_T("MULTINATIONAL")) == 0) { m_dateFormat = II_DATE_MULTINATIONAL; } else if (strValue.CompareNoCase (_T("II_DATE_MULTINATIONAL4")) == 0) { m_dateFormat = II_DATE_MULTINATIONAL4; } if (strValue.CompareNoCase (_T("ISO")) == 0) { m_dateFormat = II_DATE_ISO; } else if (strValue.CompareNoCase (_T("SWEDEN")) == 0 || strValue.CompareNoCase (_T("FINLAND")) == 0) { m_dateFormat = II_DATE_SWEDEN; // Use the Sweden II_DATE_FORMAT } else if (strValue.CompareNoCase (_T("GERMAN")) == 0) { m_dateFormat = II_DATE_GERMAN; } else if (strValue.CompareNoCase (_T("YMD")) == 0) { m_dateFormat = II_DATE_YMD; } else if (strValue.CompareNoCase (_T("DMY")) == 0) { m_dateFormat = II_DATE_DMY; } else if (strValue.CompareNoCase (_T("MDY")) == 0) { m_dateFormat = II_DATE_MDY; } } m_dateCenturyBoundary = 0; strValue = _T(""); bOK = INGRESII_CheckVariable (_T("II_DATE_CENTURY_BOUNDARY"), strValue); if (bOK && !strValue.IsEmpty()) m_dateCenturyBoundary = _ttoi (strValue); #ifdef MAINWIN m_strLocalIITemporary = _T("/tmp"); #else m_strLocalIITemporary = m_strLocalIISystem + _T("\\ingres\\temp"); #endif strValue = _T(""); bOK = INGRESII_CheckVariable (_T("II_TEMPORARY"), strValue); if (bOK && !strValue.IsEmpty()) m_strLocalIITemporary = strValue; } return bInit; }
BOOL CSetMainPage::OnInitDialog() { ISettingsPropPage::OnInitDialog(); EnableToolTips(); m_sTempExtensions = m_regExtensions; m_dwLanguage = m_regLanguage; m_bUseAero = m_regUseAero; CDwmApiImpl dwm; dwm.Initialize(); DialogEnableWindow(IDC_AERODWM, dwm.IsDwmCompositionEnabled()); CString temp; temp = m_regLastCommitTime; m_bLastCommitTime = (temp.CompareNoCase(L"yes")==0); m_tooltips.Create(this); m_tooltips.AddTool(IDC_TEMPEXTENSIONSLABEL, IDS_SETTINGS_TEMPEXTENSIONS_TT); m_tooltips.AddTool(IDC_TEMPEXTENSIONS, IDS_SETTINGS_TEMPEXTENSIONS_TT); m_tooltips.AddTool(IDC_COMMITFILETIMES, IDS_SETTINGS_COMMITFILETIMES_TT); m_tooltips.AddTool(IDC_CREATELIB, IDS_SETTINGS_CREATELIB_TT); DialogEnableWindow(IDC_CREATELIB, SysInfo::Instance().IsWin7OrLater()); // set up the language selecting combobox TCHAR buf[MAX_PATH] = { 0 }; GetLocaleInfo(1033, LOCALE_SNATIVELANGNAME, buf, _countof(buf)); m_LanguageCombo.AddString(buf); m_LanguageCombo.SetItemData(0, 1033); CString path = CPathUtils::GetAppParentDirectory(); path = path + L"Languages\\"; CSimpleFileFind finder(path, L"*.dll"); int langcount = 1; while (finder.FindNextFileNoDirectories()) { CString file = finder.GetFilePath(); CString filename = finder.GetFileName(); if (filename.Left(12).CompareNoCase(L"TortoiseProc")==0) { CString sVer = _T(STRPRODUCTVER); sVer = sVer.Left(sVer.ReverseFind('.')); CString sFileVer = CPathUtils::GetVersionFromFile(file); sFileVer = sFileVer.Left(sFileVer.ReverseFind('.')); if (sFileVer.Compare(sVer)!=0) continue; CString sLoc = filename.Mid(12); sLoc = sLoc.Left(sLoc.GetLength()-4); // cut off ".dll" if ((sLoc.Left(2) == L"32")&&(sLoc.GetLength() > 5)) continue; DWORD loc = _tstoi(filename.Mid(12)); GetLocaleInfo(loc, LOCALE_SNATIVELANGNAME, buf, _countof(buf)); CString sLang = buf; GetLocaleInfo(loc, LOCALE_SNATIVECTRYNAME, buf, _countof(buf)); if (buf[0]) { sLang += L" ("; sLang += buf; sLang += L")"; } m_LanguageCombo.AddString(sLang); m_LanguageCombo.SetItemData(langcount++, loc); } } for (int i=0; i<m_LanguageCombo.GetCount(); i++) { if (m_LanguageCombo.GetItemData(i) == m_dwLanguage) m_LanguageCombo.SetCurSel(i); } UpdateData(FALSE); return TRUE; }