bool MisprintManage::CreateMisprintTipLib() { CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd; CString bookName=pFrame->m_wndProperties.m_pHtmlProperty->GetBookName(); bookName.TrimLeft(_T(" ")); bookName.TrimRight(_T(" ")); //获得当前可执行文件的路径 CString sModFileName; GetModuleFileName(NULL,sModFileName.GetBuffer(MAX_PATH),MAX_PATH); sModFileName.ReleaseBuffer(); sModFileName.MakeReverse(); CString sIniFilePath; sIniFilePath=sModFileName.Right(sModFileName.GetLength()-sModFileName.Find( '\\')); sIniFilePath.MakeReverse(); //当前路径和新建文件夹名 CString newFileName=sIniFilePath+bookName; if(!PathFileExists(newFileName)){ //创建文件夹 if(!CreateDirectory(newFileName,NULL)) { AfxMessageBox(_T("创建文件夹失败!")); return false; } } if(!PathFileExists(newFileName+_T("\\system"))){ if(!CreateDirectory(newFileName+_T("\\system"),NULL)) { AfxMessageBox(_T("创建文件夹失败!")); return false; } } //错字库文件名 m_libFileName.Format(_T("%s\\system\\%s_错字库.txt"),newFileName,bookName); try{ if(!PathFileExists(m_libFileName)){ m_misprintLibFile.Open(m_libFileName,CFile::modeCreate); m_misprintLibFile.Close(); } } catch(CFileException fe) { AfxMessageBox(_T("创建错字库文件失败!")); return false; } return true; }
/////////////////////////////////////////////////////////////////// // Function: GetFileSize() // Purpose: Returns the comma seperated size of the file. /////////////////////////////////////////////////////////////////// CString CSHFileInfo::GetFileSize() { CString strFileSize; CString strTemp; strTemp.Format(_T("%d"), m_pFoundFile->GetLength()); int nSize = strTemp.GetLength()-1; int nCount = 1; while (nSize >= 0) { strFileSize += strTemp.GetAt(nSize); if (nSize == 0) break; if (nCount != 3) ++nCount; else { strFileSize += ","; nCount = 1; } nSize--; } strFileSize.MakeReverse(); return strFileSize; }
CString add(CString a,CString b) { CString c; carry=0; i=a.GetLength(); j=b.GetLength(); l=i; l=i>j?i:j; if(i>j) insert(b,i-j,"0",1); else if(j>i) insert(a,j-i,"0",1); for(i=l;i>0;i--) { j = a.GetAt(i-1)-'0' + b.GetAt(i-1)-'0' + carry; carry = j / 10; j = j % 10; c+=j+'0'; } if(carry>0) c+=carry+'0'; c.MakeReverse(); return c; }
CString TcHexColor(DWORD dwColor) { CString strHex = _T(""); while (dwColor != 0) { int iFlag = dwColor % 16; switch (iFlag) { case 10: strHex += _T("A"); break; case 11: strHex += _T("B"); break; case 12: strHex += _T("C"); break; case 13: strHex += _T("D"); break; case 14: strHex += _T("E"); break; case 15: strHex += _T("F"); break; default: CString strTemp; strTemp.Format(_T("%i"), dwColor % 16); strHex += strTemp; break; } dwColor /= 16; } strHex.MakeReverse(); switch (strHex.GetLength()) { case 0: strHex = _T("000000"); break; case 1: strHex = _T("00000") + strHex; break; case 2: strHex = _T("0000") + strHex; break; case 3: strHex = _T("000") + strHex; break; case 4: strHex = _T("00") + strHex; break; case 5: strHex = _T("0") + strHex; break; } return strHex; }
void CNoteModelDlg::InitMineModelFromFile() { CString sIniFilePath; CString sModFileName; GetModuleFileName(NULL,sModFileName.GetBuffer(MAX_PATH),MAX_PATH); sModFileName.ReleaseBuffer(); sModFileName.MakeReverse(); sIniFilePath=sModFileName.Right(sModFileName.GetLength()-sModFileName.Find( '\\')); sIniFilePath.MakeReverse(); this->m_filePath=sIniFilePath+_T("noteModel.txt"); CStdioFile file; if(!file.Open(m_filePath,CFile::modeRead)){ AfxMessageBox(_T("打开注释模板文件失败")); return; } CString rString; file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE1_1,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE1_2,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE1_3,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE1_4,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE2_1,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE2_2,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE2_3,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE2_4,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE3_1,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE3_2,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE3_3,rString); file.ReadString(rString); this->SetDlgItemTextW(IDC_NOTEMINE_LINE3_4,rString); }
void CUsefulStringList::GetDataFromTxt() { char* old_locale = _strdup( setlocale(LC_CTYPE,NULL) ); setlocale( LC_CTYPE, "chs" );//设定 //获得当前可执行文件的路径 CString sModFileName; GetModuleFileName(NULL,sModFileName.GetBuffer(MAX_PATH),MAX_PATH); sModFileName.ReleaseBuffer(); sModFileName.MakeReverse(); CString sIniFilePath; sIniFilePath=sModFileName.Right(sModFileName.GetLength()-sModFileName.Find( '\\')); sIniFilePath.MakeReverse(); //从文件中读取以前的信息 CStdioFile fOftenUseList; m_fPath.Format(_T("%s//oftenUseList.txt"),sIniFilePath); if(fOftenUseList.Open(m_fPath,CFile::modeRead)){ CString readStr; CString shortcut; if(fOftenUseList.ReadString(readStr)){ int strNum; strNum=_wtoi(readStr); for(int i=1;i<=strNum;i++){ fOftenUseList.ReadString(readStr); InsertItem(i-1,readStr); if(i<=9){ //快捷键 shortcut.Format(_T("Ctrl+%d"),i); } else{ shortcut=_T("无快捷键"); } this->SetItemText(i-1,1,shortcut); } } fOftenUseList.Close(); } //恢复区域设定 setlocale( LC_CTYPE, old_locale ); free( old_locale );//还原区域设定 }
BOOL CMsregDllApp::UserIsBonusEnabled(void) { BOOL fResult = FALSE; CString csRegistrationCode; TRY { csRegistrationCode = UserIniFile().GetString(ApplicationName(), MSREGUSRINI_Application_RegistrationCode); if (csRegistrationCode == MODEM_REGISTRATION_CODE) { fResult = TRUE; } else { if (!csRegistrationCode.IsEmpty()) { // 6/6/97 (FF) Switched to scheme where registration code is last four digits of // Parent Part Number reversed. CString csParentPartNumber; TRY { csParentPartNumber = GetApp()->IniFile().GetString(MSREGINI_Section_Configuration, MSREGINI_Configuration_ParentPartNumber); if (csParentPartNumber.GetLength() >= 4) { csParentPartNumber.MakeReverse(); csParentPartNumber = csParentPartNumber.Left(4); Util::Trim(csRegistrationCode); if (csRegistrationCode == csParentPartNumber) { fResult = TRUE; } } } END_TRY #if 0 unsigned long lKey = (unsigned long)IniFile().GetLong(MSREGINI_Section_Configuration, MSREGINI_Configuration_Key, 0); if (lKey == KeyFromString(csRegistrationCode)) { fResult = TRUE; } #endif } } }
CString CFanmotorDlg::int2bin_anybits(int dec, int length) { CString result; int i; for(i = (length - 1); i >=0; i--) { if(dec%2){ result += "1"; } else { result += "0"; } dec = dec/2; } result.MakeReverse(); return result; }
CString CFanmotorDlg::int2bin(int dec) { CString result; int i; for(i = 7; i >=0; i--) { if(dec%2){ result += "1"; } else { result += "0"; } dec = dec/2; } result.MakeReverse(); return result; }
// 根据网卡MAC计算得到一个唯一机器码 BOOL GetMachineCode(CString& szMachineCode) { ///////////////////////////////////////// u_char g_ucLocalMac[6]; // 本地MAC地址 //DWORD g_dwGatewayIP; // 网关IP地址 //DWORD g_dwLocalIP; // 本地IP地址 //DWORD g_dwMask; // 子网掩码 PIP_ADAPTER_INFO pAdapterInfo = NULL; ULONG ulLen = 0; // 为适配器结构申请内存 ::GetAdaptersInfo(pAdapterInfo,&ulLen); pAdapterInfo = (PIP_ADAPTER_INFO)::GlobalAlloc(GPTR, ulLen); // 取得本地适配器结构信息 if(::GetAdaptersInfo(pAdapterInfo,&ulLen) == ERROR_SUCCESS) { if(pAdapterInfo != NULL) { memcpy(g_ucLocalMac, pAdapterInfo->Address, 6); //g_dwGatewayIP = ::inet_addr(pAdapterInfo->GatewayList.IpAddress.String); //g_dwLocalIP = ::inet_addr(pAdapterInfo->IpAddressList.IpAddress.String); //g_dwMask = ::inet_addr(pAdapterInfo->IpAddressList.IpMask.String); } } //printf(" \n -------------------- 本地主机信息 -----------------------\n\n"); //in_addr in; //in.S_un.S_addr = g_dwLocalIP; //printf(" IP Address : %s \n", ::inet_ntoa(in)); //in.S_un.S_addr = g_dwMask; //printf(" Subnet Mask : %s \n", ::inet_ntoa(in)); //in.S_un.S_addr = g_dwGatewayIP; //printf(" Default Gateway : %s \n", ::inet_ntoa(in)); u_char *p = g_ucLocalMac; int nMasterVer = (int)PRODUCT_ID%100; int nMonirVer = (int)PRODUCT_ID/100; szMachineCode.Format("%02X%02X-%02X%d-%02X%02X-%02X%d", p[1]^0xFF, p[4]^0xFF, p[5]^0xFF, nMonirVer, p[0]^0xFF, p[2]^0xFF, p[3]^0xFF, nMasterVer); szMachineCode.MakeReverse(); return TRUE; }
int HexToDec(CString strHex) { int iLen = strHex.GetLength(); if (iLen > 2 || iLen < 1) { return 0; } else if (iLen == 1) { if (strHex == _T("A") || strHex == _T("a")) { return 10; } else if (strHex == _T("B") || strHex == _T("b")) { return 11; } else if (strHex == _T("C") || strHex == _T("c")) { return 12; } else if (strHex == _T("D") || strHex == _T("d")) { return 13; } else if (strHex == _T("E") || strHex == _T("e")) { return 14; } else if (strHex == _T("F") || strHex == _T("f")) { return 15; } else { return ::_ttoi(strHex); } } else { strHex.MakeReverse(); return HexToDec(strHex.Mid(1, 1)) * 16 + HexToDec(strHex.Mid(0, 1)); } }
bool CGit::IsBranchNameValid(CString branchname) { if (branchname.IsEmpty()) return false; for(int i=0; i < branchname.GetLength(); i++) { TCHAR c = branchname.GetAt(i); if (c <= ' ' || c == '~' || c == '^' || c == ':' || c == '\\' || c == '?' || c == '[') return false; } if (branchname.Find(L".") == 0 || branchname.Find(L"/.") >= 0 || branchname.Find(L"..") >= 0 || branchname.Find(L"@{") >= 0 || branchname.ReverseFind('*') >= 0) return false; CString reverseBranchname = branchname.MakeReverse(); if (branchname.Find(L'.') == 0 || branchname.Find(L'/') == 0 || reverseBranchname.Find(L"kcol.") >= 0) return false; return true; }
BOOL CDXprocessDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: 在此添加额外的初始化 m_dxprocessList.InsertColumn(0,_T("应用路径"),0,350); CString sModFileName; GetModuleFileName(NULL,sModFileName.GetBuffer(MAX_PATH),MAX_PATH); sModFileName.ReleaseBuffer(); sModFileName.MakeReverse(); mv_filePath=sModFileName.Right(sModFileName.GetLength()-sModFileName.Find( '\\')); mv_filePath.MakeReverse(); mv_filePath+=_T("DXprocess.txt"); CStdioFile sFile; if(sFile.Open(mv_filePath,CFile::modeRead)) { CString str; int nItem=0; while(sFile.ReadString(str)) { if(str.GetLength()>0){ m_dxprocessList.InsertItem(nItem,str); nItem++; } } sFile.Close(); } else { AfxMessageBox(_T("打开DX列表文件失败!")); } return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
void CJSRModParam::DoSpinID(NMHDR* pNMHDR, LRESULT* pResult, int MIN, int MAX, int DLGITEM) { if (m_pPS)m_pPS->SetToClose(0); NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; int iNew = pNMUpDown->iPos + pNMUpDown->iDelta; if (iNew > MAX) { iNew = MAX; pNMUpDown->iDelta = 0; pNMUpDown->iPos = MAX; } if (iNew < MIN) { iNew = MIN; pNMUpDown->iDelta = 0; pNMUpDown->iPos = MIN; } char temp[3]; _itoa(iNew,temp,10); while (strlen(temp) < 2) { temp[2] = NULL; temp[1] = temp[0]; temp[0] = '0'; } SetDlgItemText(DLGITEM,temp); CString Text; GetDlgItemText(IDC_JSRMODPARAMS_SAVELOC,Text); // if "JSR" at end then... Text.MakeReverse(); switch (Text.Find("RSJ")) { case 0: Text.MakeReverse(); break; case 1: if ( ((Text[0] >= '0') && (Text[0] <= '9')) || ((Text[0] >= 'A') && (Text[0] <= 'Z')) || ((Text[0] >= 'a') && (Text[0] <= 'z')) ) { Text.MakeReverse(); Text = Text.Left(Text.GetLength()-1); } else { Text.MakeReverse(); if (Text.Right(1) == "\\") Text += "JSR"; else Text += "\\JSR"; } break; case 2: if ( ( ((Text[0] >= '0') && (Text[0] <= '9')) || ((Text[0] >= 'A') && (Text[0] <= 'Z')) || ((Text[0] >= 'a') && (Text[0] <= 'z')) ) && ( ((Text[1] >= '0') && (Text[1] <= '9')) || ((Text[1] >= 'A') && (Text[1] <= 'Z')) || ((Text[1] >= 'a') && (Text[1] <= 'z')) ) ) { Text.MakeReverse(); Text = Text.Left(Text.GetLength()-2); } else { Text.MakeReverse(); if (Text.Right(1) == "\\") Text += "JSR"; else Text += "\\JSR"; } break; default: { Text.MakeReverse(); if (Text.Right(1) == "\\") Text += "JSR"; else Text += "\\JSR"; } } *pResult = 0; Text += temp; SetDlgItemText(IDC_JSRMODPARAMS_SAVELOC,Text); }
void CEventModParam::DoSpinID(NMHDR* pNMHDR, LRESULT* pResult, int MIN, int MAX, int DLGITEM) { if (m_pPS) m_pPS->SetToClose(0); NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; int iNew = pNMUpDown->iPos + pNMUpDown->iDelta; if (iNew > MAX) { iNew = MAX; pNMUpDown->iDelta = 0; pNMUpDown->iPos = MAX; } if (iNew < MIN) { iNew = MIN; pNMUpDown->iDelta = 0; pNMUpDown->iPos = MIN; } char temp[3]; if (iNew > 99) { int iTemp = iNew - 100; int i1 = iTemp/36; int i2 = iTemp % 36; temp[0] = (char)('A' + i1); if (i2 < 10) temp[1] = (char)('0' + i2); else temp[1] = (char)('A' + i2-10); } else sprintf(temp,"%02d",iNew); temp[2] = NULL; SetDlgItemText(DLGITEM,temp); CString Text; GetDlgItemText(IDC_EVENTMODPARAMS_SAVELOC,Text); // if "EVENT" at end of name Text.MakeReverse(); switch (Text.Find("TNEVE")) { case 0: Text.MakeReverse(); break; case 1: if ( ((Text[0] >= '0') && (Text[0] <= '9')) || ((Text[0] >= 'A') && (Text[0] <= 'Z')) || ((Text[0] >= 'a') && (Text[0] <= 'z')) ) { Text.MakeReverse(); Text = Text.Left(Text.GetLength()-1); } else { Text.MakeReverse(); if (Text.Right(1) == "\\") Text += "EVENT"; else Text += "\\EVENT"; } break; case 2: if ( ( ((Text[0] >= '0') && (Text[0] <= '9')) || ((Text[0] >= 'A') && (Text[0] <= 'Z')) || ((Text[0] >= 'a') && (Text[0] <= 'z')) ) && ( ((Text[1] >= '0') && (Text[1] <= '9')) || ((Text[1] >= 'A') && (Text[1] <= 'Z')) || ((Text[1] >= 'a') && (Text[1] <= 'z')) ) ) { Text.MakeReverse(); Text = Text.Left(Text.GetLength()-2); } else { Text.MakeReverse(); if (Text.Right(1) == "\\") Text += "EVENT"; else Text += "\\EVENT"; } break; default: { Text.MakeReverse(); if (Text.Right(1) == "\\") Text += "EVENT"; else Text += "\\EVENT"; } } *pResult = 0; Text += temp; SetDlgItemText(IDC_EVENTMODPARAMS_SAVELOC,Text); }
void CParamScintilla::OnChar(NMHDR* pNMHDR, LRESULT* pResult,CScintillaWnd& scintWin, CObjTypeMap* objectMap, CParamTooltipCtrl& m_Tooltip, bool& m_ParameterTooltipIsVisible, bool& m_QuotesOpen, CApplication* pApp, bool bInline) { // This function is only for CScintilla... SCNotification *scn = (SCNotification*)pNMHDR; CString text; scintWin.GetWindowText(text); CString theChar = "a"; theChar.SetAt(0, scn->ch); ::SendMessage(scintWin.m_hWnd, SCI_AUTOCSETSEPARATOR, '|', '|'); int carretPosition = scintWin.GetCurrentPosition(); text = text.Left(carretPosition); // everything to the right is irrelavant // Get last char if (scn->ch=='.') { // Get name of object // First we need to get the current char. text = text.Left(scintWin.GetCurrentPosition()); int pos = 0; char finds[] = " ()+-/*{},"; for(int a = 0; a < strlen(finds); a++) pos = max(pos, text.ReverseFind(finds[a])); CString name = text.Right(text.GetLength() - pos); name = name.Left(name.GetLength() - 1); if(pos!=0) name = name.Right(name.GetLength()-1); bool exists = true; { pApp->m_sort.RemoveAll(); CString intel; if (name != "System") { // Display intellisense // Loop m_TypeCheckerressions CObjType* oT; //POSITION pos = objectMap->GetStartPosition(); //long nKey; //while (pos != NULL) vector<CObjType*> objects; pApp->GetObjectTypes(objects); pApp->GetFamilyObjectTypes(objects); vector<CObjType*>::iterator i = objects.begin(); for(; i != objects.end(); i++) { oT = *i; //objectMap->GetNextAssoc(pos, nKey, oT); CString l = oT->GetName(); CString r = name; l.MakeLower(); r.MakeLower(); if (l == r) { // Enum m_TypeCheckerressions for (int i = 0; i < oT->GetTableCount(2); i++) { ACESEntry2* acesEntry = oT->GetACESEntry(2, i); if(acesEntry->aceDisplayText != "") pApp->m_sort.Add(acesEntry->aceDisplayText); } break; } } } else // System { for (int i = 0; i < GetSystemTableCount(2); i++) { ACESEntry2* ACE; GetSystemExpression(i, ACE); pApp->m_sort.Add(ACE->aceDisplayText); } } pApp->m_sort.Sort(); for (int i = 0; i < pApp->m_sort.GetSize(); i++) { intel += pApp->m_sort.GetAt(i); intel += "|"; } intel = intel.Left(intel.GetLength() - 1); if (intel != "") ::SendMessage(scintWin.m_hWnd, SCI_AUTOCSHOW, 0, (long)(const char*)intel); } } // Add: Check for inline editing, don't handle this if we are. 0.96.2 else if (scn->ch == '(' && !bInline) { if (m_ParameterTooltipIsVisible) { m_Tooltip.ShowWindow(SW_HIDE); m_ParameterTooltipIsVisible = false; } CString m_TypeCheckerressionName, ObjectName; // Get name of m_TypeCheckerression int pos = text.ReverseFind('.'); CString name = text.Right(text.GetLength() - pos - 1); int start = (text.GetLength() - pos) - 1; m_TypeCheckerressionName = name.Left(name.GetLength() - 1); // Get name of object CString object = text.Left(text.GetLength() - start); pos = object.ReverseFind(' '); name = object.Right(object.GetLength() - pos); ObjectName = name.Left(name.GetLength() - 1); ObjectName.Trim(); bool exists = true; bool alsoexists = false; if (ObjectName == "") ObjectName = "System"; if (exists) { vector<CString> setParams; m_Tooltip.FlushMethods(); if (ObjectName != "System") { CObjType* oT; POSITION pos = objectMap->GetStartPosition(); long nKey; while (pos != NULL) { objectMap->GetNextAssoc(pos, nKey, oT); CString l = oT->GetName(); CString r = ObjectName; l.MakeLower(); r.MakeLower(); if (l == r) { // Enum m_TypeCheckerressions for (int i = 0; i < oT->GetTableCount(2); i++) { ACESEntry2* acesEntry = oT->GetACESEntry(2, i); if (acesEntry->aceDisplayText == m_TypeCheckerressionName) { alsoexists = true; for (int x = 0; x < acesEntry->params.size();x++) { CString addParameter; // Check type if (acesEntry->params[x].type == 1) addParameter.Format("%s [number]", acesEntry->params[x].name); if (acesEntry->params[x].type == 2) addParameter.Format("%s [string]", acesEntry->params[x].name); setParams.push_back(addParameter); } } } break; } } } /*else { int numTableEntries = sizeof(SysExpIntellisenseTable) / sizeof(SysExpIntellisenseTable[0]); setParams.resize(0); for (int i = 0; i < numTableEntries; i++) { CString l = m_TypeCheckerressionName; CString r = SysExpIntellisenseTable[i].expname; l.MakeLower(); r.MakeLower(); if (l == r) { alsoexists = true; CString curParam; int paramNum = 0; do { AfxExtractSubString(curParam, SysExpIntellisenseTable[i].params, paramNum, ','); curParam.Trim(); if (curParam != "") setParams.push_back(curParam); paramNum++; } while (curParam != ""); m_Tooltip.AddMethod(m_TypeCheckerressionName, setParams); setParams.resize(0); } } }*/ if (alsoexists && !m_ParameterTooltipIsVisible) { // Get position of caret int currentPosition = scintWin.SendMessage(SCI_GETCURRENTPOS, 0, 0); int caretX = scintWin.SendMessage(SCI_POINTXFROMPOSITION, 0, 0); int caretY = scintWin.SendMessage(SCI_POINTXFROMPOSITION, 0, 0); if (ObjectName != "System") { CString sMethod; m_Tooltip.AddMethod(m_TypeCheckerressionName, setParams); } m_Tooltip.SetCurMethod(0); m_Tooltip.SetCurParam(0); m_Tooltip.ShowTooltip(CPoint(caretX, caretY)); m_ParameterTooltipIsVisible = true; m_QuotesOpen = false; } } } // Increment parameter count else if (scn->ch == ',' && !bInline) { //scintWin.SendMessage(SCI_AUTOCCOMPLETE, 0, 0); if (m_ParameterTooltipIsVisible && !m_QuotesOpen) m_Tooltip.ShowNextParam(); } // Hide parameter tooltip else if (scn->ch == ')' && !bInline) { //scintWin.SendMessage(SCI_AUTOCCOMPLETE, 0, 0); if (m_ParameterTooltipIsVisible) { m_Tooltip.ShowWindow(SW_HIDE); m_ParameterTooltipIsVisible = false; } } // Hide parameter tooltip else if (scn->ch == '"') { if (m_QuotesOpen) m_QuotesOpen = false; else m_QuotesOpen = true; } // Prompt variable names else if (scn->ch == '\'') { // Trim the right two (' chars eg. Sprite(' text = text.Left(text.GetLength() - 2); CString temp = text; temp.MakeReverse(); int index = temp.FindOneOf(" {}()+-*/"); if (index > -1) text = text.Right(index); // Now find if there's a dot to get the object name index = text.Find('.'); if (index > -1) text = text.Left(index); CObjType* pType = GetTypeFromName(pApp, text); if (pType != NULL) { CString varnames; vector<PrivateValue>::iterator i = pType->m_PrivateValues.begin(); vector<PrivateValue>::iterator end = pType->m_PrivateValues.end(); for ( ; i != end; i++) varnames += i->name + "|"; varnames = varnames.Left(varnames.GetLength() - 1); if (varnames != "") ::SendMessage(scintWin.m_hWnd, SCI_AUTOCSHOW, 0, (long)(const char*)varnames); } else{ if(text == "global") { CString varnames; list<CApplication::GlobalVariable>::iterator i = pApp->global_variables.begin(); list<CApplication::GlobalVariable>::iterator end = pApp->global_variables.end(); for ( ; i != end; i++) varnames += i->name + "|"; varnames = varnames.Left(varnames.GetLength() - 1); if (varnames != "") ::SendMessage(scintWin.m_hWnd, SCI_AUTOCSHOW, 0, (long)(const char*)varnames); } } } /*else { if(text.GetLength() == 2) { // Any other type of letter, display intellisense for system expressions and object names CString suggestions; int numTableEntries = sizeof(SysExpIntellisenseTable) / sizeof(SysExpIntellisenseTable[0]); for (int i = 0; i < numTableEntries; i++) { CString expression = SysExpIntellisenseTable[i].expname; suggestions += expression + "|"; } suggestions = suggestions.Left(suggestions.GetLength() - 1); if (suggestions != "") ::SendMessage(scintWin.m_hWnd, SCI_AUTOCSHOW, 0, (long)(const char*)suggestions); } }*/ }
CFieldValuePair::DumpARX(CARSConnection &arsConnect, CString Form, CStdioFile &File, CString &strAttachDir, unsigned int *p_uiAttachNum, CEntryId &EntryId, CString &strBuffer) { // Insert a space before the value // File.Write(" ", 1); strBuffer += " "; CString cleanValue(Value); // dump the value to the file switch(uiType) { case AR_DATA_TYPE_NULL: //File.Write("\"\"", 2); strBuffer += "\"\""; break; // basically an value exported via this case will not have any double // quotes exported case AR_DATA_TYPE_INTEGER: case AR_DATA_TYPE_REAL: case AR_DATA_TYPE_ENUM: case AR_DATA_TYPE_TIME: case AR_DATA_TYPE_DECIMAL: //File.Write(LPCSTR(Value), Value.GetLength()); // write the value strBuffer += Value; break; // any value exported via this case will have double quotes // inserted before and after the Value. case AR_DATA_TYPE_CHAR: case AR_DATA_TYPE_DIARY: case AR_DATA_TYPE_CURRENCY: // treat currency like a char because we need to double quotes cleanValue.Replace("\"", "\\\""); // insert a \ before each double quote cleanValue.Replace("\n", "\\r\\n"); // replace carriage returns with \r\n text //File.Write("\"", 1); // write double quote before value strBuffer += "\""; //File.Write(LPCSTR(cleanValue), cleanValue.GetLength()); // write the text value strBuffer += cleanValue; //File.Write("\"", 1); // write double quote after value strBuffer += "\""; break; case AR_DATA_TYPE_ATTACH: CString strExt; // working extenstion of the attachment CString strFile; // working file name with no extension CString strAttachNum; // working string for attachment number CString strFinishedAttach; // working completed attachment name to use when calling GetEntryBLOB() CString strFilePath; // the full path the the filename for saving the BLOB file // Save the file extension strExt = Value; strExt.MakeReverse(); strExt = strExt.Left(4); strExt.MakeReverse(); // Save the file name with out extenstion strFile = Value.Left(Value.GetLength() - 4); // convert the Attachment number to a string and increment it strAttachNum.Format("%d", *p_uiAttachNum); *p_uiAttachNum = *p_uiAttachNum + 1; // build the completed attachment name to save // strBuffer += "\"" + strAttachDir + "\\" + strFile + "_" + \ // strAttachNum + strExt + "\""; strFinishedAttach = strAttachDir + "\\" + strFile + "_" + strAttachNum + strExt; strBuffer += "\"" + strFinishedAttach + "\""; // Lastly, save the attachment file BLOB // This function call needs the full path\filename to save the BLOB // this should be specified in strAttachFileName strFilePath = File.GetFilePath(); strFilePath.Replace(File.GetFileName(), LPCSTR(strFinishedAttach)); // replace the filename with the relative attachment name DumpAttachment(arsConnect, Form, EntryId, uiFieldId, strFilePath); break; } // end switch }