int CDevMgr::SetAlarmInfo(LONG lLoginID, LONG lCommand, char *pchDVRIP, LONG nDVRPort, char *pBuf, DWORD dwBufLen) { int nRet = 0; ::EnterCriticalSection(&m_csAlarm); list<DeviceNode*>::iterator it = find_if(m_lstDevice.begin(), m_lstDevice.end(), CDevMgr::SearchDevByHandle(lLoginID)); AlarmNode *thisNode = new AlarmNode; if (!thisNode) { return -1; } memset(thisNode, 0, sizeof(AlarmNode)); thisNode->timeStamp = CTime::GetCurrentTime(); if (it != m_lstDevice.end()) { thisNode->alarmType = lCommand; switch(lCommand) { case COMM_ALARM: { if (dwBufLen != sizeof(NET_CLIENT_STATE)) { nRet = -1; break; } NET_CLIENT_STATE *State = (NET_CLIENT_STATE *)pBuf; if(!State) { nRet = -1; break; } //设备列表中信息刷新 (*it)->State.cState.channelcount = State->channelcount; (*it)->State.cState.alarminputcount = State->alarminputcount; memcpy((*it)->State.cState.alarm, State->alarm, 16); memcpy((*it)->State.cState.motiondection, State->motiondection, 16); memcpy((*it)->State.cState.videolost, State->videolost, 16); thisNode->alarmType = COMM_ALARM; memcpy(&thisNode->state, &(*it)->State, sizeof(DEV_STATE)); nRet = 0; break; } case SHELTER_ALARM: { if (dwBufLen != 16) { nRet = -1; break; } memcpy((*it)->State.shelter, pBuf, 16); thisNode->alarmType = SHELTER_ALARM; memcpy(&thisNode->state, &(*it)->State, sizeof(DEV_STATE)); nRet = 0; break; } case DISK_FULL_ALARM: { if (dwBufLen != sizeof(DWORD)) { nRet = -1; break; } (*it)->State.dFull = *(DWORD*)pBuf; thisNode->alarmType = DISK_FULL_ALARM; memcpy(&thisNode->state, &(*it)->State, sizeof(DEV_STATE)); nRet = 0; break; } case DISK_ERROR_ALARM: { if (dwBufLen != sizeof(DWORD)) { nRet = -1; break; } (*it)->State.dError = *(DWORD*)pBuf; thisNode->alarmType = DISK_ERROR_ALARM; memcpy(&thisNode->state, &(*it)->State, sizeof(DEV_STATE)); nRet = 0; break; } case SOUND_DETECT_ALARM: { if (dwBufLen != 16) { nRet = -1; break; } memcpy((*it)->State.soundalarm, pBuf, 16); thisNode->alarmType = SOUND_DETECT_ALARM; memcpy(&thisNode->state, &(*it)->State, sizeof(DEV_STATE)); nRet = 0; break; } case ALARM_DECODER_ALARM_EX: { if (dwBufLen != 16) { nRet = -1; break; } memcpy((*it)->State.almDecoder, pBuf, 16); thisNode->alarmType = ALARM_DECODER_ALARM_EX; memcpy(&thisNode->state, &(*it)->State, sizeof(DEV_STATE)); nRet = 0; } break; case POS_TICKET_ALARM: { memcpy((*it)->State.PosTicket, pBuf, 1024); thisNode->alarmType = POS_TICKET_ALARM; memcpy(&thisNode->state, &(*it)->State, sizeof(DEV_STATE)); nRet = 0; } break; case POS_TICKET_RAWDATA: { memcpy((*it)->State.PosTicketRawData, pBuf, 1024); thisNode->alarmType = POS_TICKET_RAWDATA; memcpy(&thisNode->state, &(*it)->State, sizeof(DEV_STATE)); nRet = 0; } break; case REBOOT_EVENT_EX: { AfxMessageBox(ConvertString("Reboot?(y/n)")); } break; /* //以下针对新的报警接口 case ALARM_ALARM_EX: if (dwBufLen != 16) { break; } memcpy((*it)->State.alarmout, pBuf, 16); break; case MOTION_ALARM_EX: if (dwBufLen != 16) { break; } memcpy((*it)->State.motion, pBuf, 16); break; case VIDEOLOST_ALARM_EX: if (dwBufLen != 16) { break; } memcpy((*it)->State.videolost, pBuf, 16); break; case SHELTER_ALARM_EX: if (dwBufLen != 16) { break; } memcpy((*it)->State.shelter, pBuf, 16); break; case SOUND_DETECT_ALARM_EX: if (dwBufLen != 16) { break; } memcpy((*it)->State.soundalarm, pBuf, 16); break; case DISKFULL_ALARM_EX: if (dwBufLen != 1) { break; } (*it)->State.diskfull = *pBuf; break; case DISKERROR_ALARM_EX: if (dwBufLen != 32) { break; } memcpy((*it)->State.diskerror, pBuf, 32); break; */ default: nRet = -1; break; } memcpy(&thisNode->state, &(*it)->State, sizeof(DEV_STATE)); } ::LeaveCriticalSection(&m_csAlarm); if (nRet >= 0) { ::EnterCriticalSection(&m_csAlmList); m_lstAlarm.push_back(thisNode); ::LeaveCriticalSection(&m_csAlmList); } else { delete thisNode; } return nRet; }
void CmdFontShape(int code) /**************************************************************************** purpose : sets the font to upright, italic, or small caps F_SHAPE_ITALIC for \itshape F_SHAPE_ITALIC_1 for \it F_SHAPE_ITALIC_2 for \textit{...} F_SHAPE_ITALIC_3 for \begin{itshape} F_SHAPE_ITALIC_4 for \begin{it} ****************************************************************************/ { int true_code = code & ~ON; char *s; diagnostics(5, "CmdFontShape (before) depth=%d, family=%d, size=%d, shape=%d, series=%d", FontInfoDepth, RtfFontInfo[FontInfoDepth].family, RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape, RtfFontInfo[FontInfoDepth].series); /* \end{itshape}, \end{sc} ... */ if (!(code & ON) && (true_code == F_SHAPE_UPRIGHT_3 || true_code == F_SHAPE_ITALIC_3 || true_code == F_SHAPE_SLANTED_3 || true_code == F_SHAPE_CAPS_3 || true_code == F_SHAPE_ITALIC_4 || true_code == F_SHAPE_SLANTED_4 || true_code == F_SHAPE_CAPS_4)) return; if (true_code == F_SHAPE_UPRIGHT_2 || true_code == F_SHAPE_ITALIC_2 || true_code == F_SHAPE_SLANTED_2 || true_code == F_SHAPE_CAPS_2) { s = getBraceParam(); if (strlen(s) != 0 && getTexMode() == MODE_VERTICAL) changeTexMode(MODE_HORIZONTAL); } switch (true_code) { case F_SHAPE_UPRIGHT: case F_SHAPE_UPRIGHT_3: fprintRTF("\\i0\\scaps0 "); break; case F_SHAPE_UPRIGHT_1: fprintRTF("\\i0\\scaps0\\b0 "); break; case F_SHAPE_UPRIGHT_2: fprintRTF("{\\i0\\b0\\scaps0 "); break; case F_SHAPE_SLANTED: case F_SHAPE_ITALIC: fprintRTF("\\scaps0\\i "); break; case F_SHAPE_SLANTED_1: case F_SHAPE_ITALIC_1: fprintRTF("\\scaps0\\b0\\i "); break; case F_SHAPE_SLANTED_2: case F_SHAPE_ITALIC_2: fprintRTF("{\\i "); break; case F_SHAPE_SLANTED_3: case F_SHAPE_ITALIC_3: fprintRTF("\\scaps0\\i "); break; case F_SHAPE_SLANTED_4: case F_SHAPE_ITALIC_4: fprintRTF("\\scaps0\\b0\\i "); break; case F_SHAPE_CAPS: case F_SHAPE_CAPS_3: fprintRTF("\\scaps "); break; case F_SHAPE_CAPS_1: case F_SHAPE_CAPS_4: fprintRTF("\\i0\\b0\\scaps "); break; case F_SHAPE_CAPS_2: fprintRTF("{\\scaps "); break; } if (true_code == F_SHAPE_UPRIGHT_2 || true_code == F_SHAPE_ITALIC_2 || true_code == F_SHAPE_SLANTED_2 || true_code == F_SHAPE_CAPS_2) { ConvertString(s); fprintRTF("}"); free(s); } diagnostics(5, "CmdFontShape (after) depth=%d, family=%d, size=%d, shape=%d, series=%d", FontInfoDepth, RtfFontInfo[FontInfoDepth].family, RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape, RtfFontInfo[FontInfoDepth].series); }
void GlobalPoseSensorPanel::OnNewImage( wxCommandEvent& event ) { int width = mpImagePanel->GetSize().GetWidth(); int height = mpImagePanel->GetSize().GetHeight(); if(width <= 0 || height <= 0) return; if(width != mLocalPoseImage.GetWidth() || height != mLocalPoseImage.GetHeight()) { mLocalPoseImage.Create(width, height, -1); } wxMemoryDC memoryDC; memoryDC.SelectObject(mLocalPoseImage); // Set line color to green, fill color to green int penSize = 2; memoryDC.SetPen(wxPen(*wxGREEN, penSize, wxSOLID)); memoryDC.SetBrush(wxBrush(*wxGREEN, wxSOLID)); memoryDC.SetBackground(wxBrush(*wxBLACK, wxSOLID)); memoryDC.Clear(); double zoomScale = mZoomSlider->GetValue()/50.0; double gridScale = 100; for(int i = width/2.0; i < width; i+=zoomScale*gridScale) { int offset = i - width/2.0; if(offset == 0) { memoryDC.SetPen(wxPen(*wxGREEN, penSize, wxSOLID)); memoryDC.DrawLine(i,0,i,height); } else { memoryDC.SetPen(wxPen(*wxGREEN, penSize, wxDOT)); memoryDC.DrawLine(i,0,i,height); memoryDC.DrawLine(width/2.0 - offset,0,width/2.0 - offset,height); } } for(int j = height/2.0; j < height; j+=zoomScale*gridScale) { int offset = j - height/2.0; if(offset == 0) { memoryDC.SetPen(wxPen(*wxGREEN, penSize, wxSOLID)); memoryDC.DrawLine(0,height/2.0,width,height/2.0); } else { memoryDC.SetPen(wxPen(*wxGREEN, penSize, wxDOT)); memoryDC.DrawLine(0,j,width,j); memoryDC.DrawLine(0,height/2.0 - offset, width,height/2.0 - offset); } } if(mConnectFlag) { mDataMutex.Lock(); boost::circular_buffer<JAUS::ReportLocalPose>::iterator it; //Global pose data commented out, but comment in if you want to add global pose info to GUI. //boost::circular_buffer<JAUS::ReportGlobalPose>::iterator git; if(mPoseHistory.find(mGPSToMonitorAddress.mSubsystem) != mPoseHistory.end() /*&& mGlobalPoseHistory.find(mGPSToMonitorAddress.mSubsystem) != mGlobalPoseHistory.end()*/) { it = mPoseHistory[mGPSToMonitorAddress.mSubsystem].begin(); //git = mGlobalPoseHistory[mGPSToMonitorAddress.mSubsystem].begin(); //mpReportLocalPose->GetTimeStamp double xpos,ypos,rotation=0; JAUS::ReportLocalPose currentpos = mPoseHistory[mGPSToMonitorAddress.mSubsystem].back(); //JAUS::ReportGlobalPose globalpos = mGlobalPoseHistory[mGPSToMonitorAddress.mSubsystem].back(); std::stringstream str; str << "Latitude: "<< std::setprecision(2) << currentpos.GetY() << " Longitude: " << std::setprecision(2) << currentpos.GetX() << " Altitude: " << std::setprecision(2) << currentpos.GetZ() << " Heading: " << std::setprecision(2) << CxUtils::CxToDegrees(CxUtils::Orientation::AddToAngle(currentpos.GetYaw(), CxUtils::CX_HALF_PI)); //if(mGlobalPoseHistory.find(mGPSToMonitorAddress.mSubsystem) != mGlobalPoseHistory.end()) //{ // JAUS::ReportGlobalPose globalpos = mGlobalPoseHistory[mGPSToMonitorAddress.mSubsystem].back(); // str << " Global X: "<< globalpos.GetLatitude() << " Global Y: " << globalpos.GetLongitude() << " Global Z: " << globalpos.GetAltitude() << " Global Heading: " << CxUtils::CxToDegrees(globalpos.GetYaw()); //} this->mScanNumberLabel->SetLabel(ConvertString(str.str())); //Draws the most recent pose object as green/red based on if data has been seen in the last //few seconds. Draws history as gray. for(it; it != mPoseHistory[mGPSToMonitorAddress.mSubsystem].end(); it++) { if(it == mPoseHistory[mGPSToMonitorAddress.mSubsystem].end()-1) { if(CxUtils::Time::DifferenceInSeconds(CxUtils::Time(true),it->GetTimeStamp()) > 2) { memoryDC.SetPen(wxPen(*wxRED, penSize, wxSOLID)); memoryDC.SetBrush(wxBrush(*wxRED, wxSOLID)); } else { memoryDC.SetPen(wxPen(*wxGREEN, penSize, wxSOLID)); memoryDC.SetBrush(wxBrush(*wxGREEN, wxSOLID)); } } else { memoryDC.SetPen(wxPen(*wxLIGHT_GREY, penSize, wxSOLID)); memoryDC.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID)); } xpos = (it->GetY() *gridScale * zoomScale+width/2.0); ypos = (it->GetX() *gridScale * -zoomScale+height/2.0); rotation = it->GetYaw(); CxUtils::Point3D line = CxUtils::Point3D(30*zoomScale,0,0); line = line.Rotate(rotation,CxUtils::Point3D::Z); memoryDC.DrawCircle(xpos,ypos,20*zoomScale); memoryDC.DrawLine(xpos,ypos,line.mX+xpos, line.mY+ypos); } } mDataMutex.Unlock(); } mpImagePanel->SetBitmap(mLocalPoseImage); }
///////////////////////////////////////////////////////////////////////////// // ClientState message handlers void CClientState::UpdateState() { if (!m_dev) { return; } CDevMgr::GetDevMgr().GetAlarmInfo(m_dev->LoginID, &m_myState); CString str; str.Format("(%s [%s])",m_dev->Name, m_dev->IP); CString strTmp; CString strDiskError = ConvertString(MSG_CLIENTSTATE_DISKERR); for (int i=0; i<32; i++) { // if (m_myState.diskerror[i]) if (m_myState.dError & (0x01<<i)) { strTmp.Format(" %d", i+1); strDiskError += strTmp; } } CString strDiskFull = ConvertString(MSG_CLIENTSTATE_DISKFULL); //if (m_myState.diskfull) if (m_myState.dFull) { strDiskFull += ConvertString("Full"); } else { strDiskFull += ConvertString("Not"); } CString strShelter = ConvertString(MSG_CLIENTSTATE_SHELTER); for (i=0; i<16; i++) { if (m_myState.shelter[i]) { strTmp.Format(" %d", i+1); strShelter += strTmp; } } CString strAlarm = ConvertString(MSG_CLIENTSTATE_ALARM); for (i=0; i<m_dev->Info.byAlarmInPortNum; i++) { // if (m_myState.alarmout[i]) if (m_myState.cState.alarm[i]) { strTmp.Format(" %d", i+1); strAlarm += strTmp; } } CString strMD = ConvertString(MSG_CLIENTSTATE_MOTION); CString strVideoLost = ConvertString(MSG_CLIENTSTATE_VIDEOLOST); CString strSD = ConvertString(MSG_CLIENTSTATE_SOUND); for (i=0; i<m_dev->Info.byChanNum; i++) { if (m_myState.cState.motiondection[i]) { strTmp.Format(" %d", i+1); strMD += strTmp; } if (m_myState.cState.videolost[i]) { strTmp.Format(" %d", i+1); strVideoLost += strTmp; } if (m_myState.soundalarm[i]) { strTmp.Format(" %d", i+1); strSD += strTmp; } } CString strSerial = ConvertString(MSG_CLIENTSTATE_SERIAL); strTmp.Format("%s", m_dev->Info.sSerialNumber); strSerial += strTmp; CString strAlmDec = ConvertString(MSG_CLIENTSTATE_ALMDEC); strAlmDec += ": \n"; for (i = 0; i < 16; i++) { for(int j = 0; j < 8; j++) { if (m_myState.almDecoder[i] & (1<<j)) { strTmp.Format("%d", 1); } else { strTmp.Format("%d", 0); } strAlmDec += strTmp; } strAlmDec += " "; } str += ConvertString(MSG_CLIENTSTATE_CLIENTSTATE); str = str +"\n" +"\n"+ strDiskError + "\n" +"\n"+ strDiskFull + "\n" +"\n"+ strShelter +"\n" + "\n"+ strAlarm + "\n" +"\n"+ strMD + "\n" +"\n"+ strVideoLost + "\n" +"\n"+ strSD + "\n" +"\n"+ strAlmDec + "\n" + "\n" + strSerial; GetDlgItem(IDC_CLIENT_STATE)->SetWindowText(str); }
HMENU setServerMenu() { HMENU sTemp = CreateMenu(); TCHAR wszServer[128]; TCHAR wszNick[128]; TCHAR wszMenuEntry[256]; std::vector<int> xs; std::vector<int>::iterator xsi; hexchat_list *xl = hexchat_list_get(ph, "channels"); AppendMenu(sTemp, MF_STRING, ACT_AWAY, _T("Set Globally Away")); AppendMenu(sTemp, MF_STRING, ACT_BACK, _T("Set Globally Back")); AppendMenu(sTemp, MF_SEPARATOR, 0, NULL); if(xl) { while(hexchat_list_next(ph, xl)) { xsi = std::find(xs.begin(), xs.end(), hexchat_list_int(ph, xl, "id")); if( (xsi == xs.end()) && ((strlen(hexchat_list_str(ph, xl, "server")) > 0) || (strlen(hexchat_list_str(ph, xl, "channel")) > 0))) { hexchat_set_context(ph, (hexchat_context *)hexchat_list_str(ph, xl, "context")); xs.push_back(hexchat_list_int(ph, xl, "id")); char *network = _strdup(hexchat_list_str(ph, xl, "network")); char *server = _strdup(hexchat_list_str(ph, xl, "server")); char *nick = _strdup(hexchat_get_info(ph, "nick")); if(network != NULL) { ConvertString(network, wszServer, 128); } else { ConvertString(server, wszServer, 128); } if(server != NULL) { ConvertString(nick, wszNick, 128); _sntprintf(wszMenuEntry, 256, _T("%s @ %s\0"), wszNick, wszServer); if(!hexchat_get_info(ph, "away")) { AppendMenu(sTemp, MF_STRING, (hexchat_list_int(ph, xl, "id") + 1), wszMenuEntry); } else { AppendMenu(sTemp, (MF_CHECKED | MF_STRING), (hexchat_list_int(ph, xl, "id") + 1), wszMenuEntry); } } free(network); free(server); free(nick); } } hexchat_list_free(ph, xl); } return sTemp; }
void CmdCite(int code) /****************************************************************************** purpose: handles \cite ******************************************************************************/ { char punct[4]="[],"; char *text, *str1; char *keys, *key, *next_keys; char *option = NULL; char *pretext = NULL; /* Setup punctuation and read options before citation */ g_current_cite_paren=TRUE; *g_last_author_cited='\0'; if (g_document_bibstyle == BIBSTYLE_STANDARD){ option = getBracketParam(); } if (g_document_bibstyle == BIBSTYLE_APALIKE){ strcpy(punct,"();"); option = getBracketParam(); } if (g_document_bibstyle == BIBSTYLE_AUTHORDATE){ strcpy(punct,"();"); option = getBracketParam(); } if (g_document_bibstyle == BIBSTYLE_NATBIB){ pretext = getBracketParam(); option = getBracketParam(); strcpy(punct,"();"); if (code!=CITE_P && code!=CITE_P_STAR && code!=CITE_ALP && code!=CITE_ALP_STAR && code!=CITE_YEAR_P) g_current_cite_paren=FALSE; } if (g_document_bibstyle == BIBSTYLE_APACITE){ pretext = getAngleParam(); option = getBracketParam(); strcpy(punct,"();"); if (code!=CITE_CITE && code!=CITE_FULL && code!=CITE_SHORT && code!=CITE_YEAR) g_current_cite_paren=FALSE; g_current_cite_type=code; } text = getBraceParam(); str1 = strdup_nocomments(text); free(text); text=str1; if (strlen(text)==0) { free(text); if (pretext) free(pretext); if (option) free(option); return; } /* output text before citation */ if (g_current_cite_paren) fprintRTF("\n%c", punct[0]); if (pretext && g_document_bibstyle == BIBSTYLE_APACITE ) { ConvertString(pretext); fprintRTF(" "); } /* now start processing keys */ keys = strdup_noblanks(text); free(text); key = keys; next_keys = popCommaName(key); g_current_cite_item=0; while (key) { char *s, *t; g_current_cite_item++; s = ScanAux("bibcite", key, 0); /* look up bibliographic reference */ if (g_document_bibstyle == BIBSTYLE_APALIKE) { /* can't use Word refs for APALIKE or APACITE*/ t = s ? s : key; ConvertString(t); } if (g_document_bibstyle == BIBSTYLE_AUTHORDATE) { t = s ? s : key; if (code==CITE_SHORT) g_suppress_name=TRUE; ConvertString(t); if (code==CITE_SHORT) g_suppress_name=FALSE; } if (g_document_bibstyle == BIBSTYLE_APACITE) { /* */ t = s ? s : key; g_current_cite_seen=citation_used(key); ConvertString(t); } if (g_document_bibstyle == BIBSTYLE_NATBIB) { diagnostics(2,"natbib key=[%s] <%s>",key, s); if (s) { g_current_cite_seen=citation_used(key); ConvertNatbib(s,code,pretext,option); } else ConvertString(key); } if (g_document_bibstyle == BIBSTYLE_STANDARD) { /* */ char *signet = strdup_nobadchars(key); t = s ? s : signet; /* if .aux is missing or incomplete use original citation */ if (g_fields_use_REF) { fprintRTF("{\\field{\\*\\fldinst{\\lang1024 REF BIB_%s \\\\* MERGEFORMAT }}",signet); fprintRTF("{\\fldrslt{"); } ConvertString(t); if (g_fields_use_REF) fprintRTF("}}}"); if (signet) free(signet); } if (next_keys) fprintRTF("%c ",punct[2]); /* punctuation between citations */ key=next_keys; next_keys=popCommaName(key); /* key modified to be a single key */ if (s) free(s); } /* final text after citation */ if (option && (g_document_bibstyle == BIBSTYLE_APACITE || g_document_bibstyle == BIBSTYLE_AUTHORDATE)) { fprintRTF(", "); ConvertString(option); } if (g_current_cite_paren) fprintRTF("\n%c", punct[1]); if (keys) free(keys); if (option) free(option); if (pretext) free(pretext); }
void CDLGsoap::DisplayerList() { m_list.DeleteAllItems(); soapList.clear(); if(0==ListTotal) { GetDlgItem(IDC_STATIC_INFO)->SetWindowText("共0条 1/1页"); InvalidateRect(printf_Rect, TRUE); return ; } unsigned long int si,ei; si=ListNow+1; if((ListNow+PAGE_MAX_NUM) < ListTotal) ei=ListNow+PAGE_MAX_NUM ; else ei=ListTotal; if(m_sreach.IsEmpty()) soapDB.SOAP_Read(soapList,si-1,ei-(si-1)); else soapDB.SOAP_ReadForSearch(m_sreach.GetBuffer(0),soapList,si-1,ei-(si-1)); if(soapList.size()<=0) return ; list<struct FILE_SOAP_READ_ST>::iterator beglist; char str[128]; int i=0; for(beglist=soapList.begin();beglist!=soapList.end();beglist++) { sprintf(str,"%I64u",beglist->file_nid); m_list.InsertItem( i,str); m_list.SetItemText(i,1,beglist->name); DisplaySize(beglist->filesize,str); m_list.SetItemText(i,2,str); m_list.SetItemText(i,3,beglist->ed2k); m_list.SetItemText(i,4,beglist->aich); m_list.SetItemText(i,5,beglist->btih); i++; } if(ListTotal%PAGE_MAX_NUM) { sprintf(str,ConvertString("共%d条 %d/%d页 每页%d条"), ListTotal, ListNow/PAGE_MAX_NUM+1,ListTotal/PAGE_MAX_NUM+1,PAGE_MAX_NUM); } else { sprintf(str,ConvertString("共%d条 %d/%d页 每页%d条"), ListTotal, ListNow/PAGE_MAX_NUM+1,ListTotal/PAGE_MAX_NUM,PAGE_MAX_NUM); } GetDlgItem(IDC_STATIC_INFO)->SetWindowText(str); InvalidateRect(printf_Rect, TRUE); UpdateData(FALSE); }
void CDlgFileList::OnFilenameBtnGet() { // TODO: Add your control notification handler code here if (0 == m_hLoginId) { MessageBox(ConvertString(CString("we haven't login a device yet!"), DLG_FILENAME), ConvertString("Prompt")); return; } m_lsFileList.DeleteAllItems(); DH_IN_LIST_REMOTE_FILE stuIn = {sizeof(stuIn)}; CString csPath; GetDlgItemText(IDC_FILENAME_EDT_PATH, csPath); stuIn.bFileNameOnly = TRUE; stuIn.pszPath = csPath.GetBuffer(0); DH_OUT_LIST_REMOTE_FILE stuOut = {sizeof(stuOut)}; int nCount = GetDlgItemInt(IDC_FILENAME_EDT_MAXNUMBER, NULL, FALSE); if (nCount <= 0) { nCount = 16; SetDlgItemInt(IDC_FILENAME_EDT_MAXNUMBER, 16, FALSE); } DH_REMOTE_FILE_INFO* pFile = new DH_REMOTE_FILE_INFO[nCount]; if (!pFile) { return; } memset(pFile, 0, sizeof(DH_REMOTE_FILE_INFO) * nCount); for (int i = 0; i < nCount; i++) { pFile[i].dwSize = sizeof(DH_REMOTE_FILE_INFO); } stuOut.nMaxFileCount = nCount; stuOut.pstuFiles = pFile; BOOL bRet = CLIENT_ListRemoteFile(m_hLoginId, &stuIn, &stuOut, SDK_API_WAIT); SetDlgItemInt(IDC_FILENAME_EDT_RETNUMBER, stuOut.nRetFileCount, FALSE); if (bRet) { for (int j = 0; j < stuOut.nRetFileCount; j++) { m_lsFileList.InsertItem(j, "", 0); char szSeq[8] = {0}; itoa(j + 1, szSeq, 10); m_lsFileList.SetItemText(j, 0, szSeq); m_lsFileList.SetItemText(j, 1, pFile[j].szPath); m_listInfo.push_back(pFile[j].szPath); } } else { if (NET_INSUFFICIENT_BUFFER == CLIENT_GetLastError()) { SetDlgItemInt(IDC_FILENAME_EDT_RETNUMBER, stuOut.nRetFileCount, TRUE); } CString csOut; csOut.Format("%s %08x...", ConvertString("Get file_list err:", DLG_FILENAME), CLIENT_GetLastError()); MessageBox(csOut, ConvertString("Prompt")); } if (pFile) { delete []pFile; pFile = NULL; } }
FString ConvertString(const icu::UnicodeString& Source) { FString Destination; ConvertString(Source, Destination); return Destination; }
void CConfigChannel::OnApply() { if (!m_bInited || m_chnIdx < 0) { return; } int strmIdx = m_streamsel.GetCurSel(); if (strmIdx < 0) { return; } int osdIdx = m_osdsel.GetCurSel(); if (osdIdx < 0) { return; } GetDlgItemText(IDC_EDIT_CHANNAME, m_chnCFG[m_chnIdx].szChannelName, CHANNEL_NAME_LEN+1); BYTE rsOIdx, ecOIdx; GetOrigIndex(&rsOIdx, m_resolutionsel.GetCurSel(), m_sysCFG.stDspEncodeCap.dwImageSizeMask); GetOrigIndex(&ecOIdx, m_encodetypesel.GetCurSel(), m_sysCFG.stDspEncodeCap.dwEncodeModeMask); if (strmIdx < 3) //main stream - for record { m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byVideoEnable= m_videochk.GetCheck(); m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byAudioEnable= m_audiochk.GetCheck(); m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byBitRateControl= m_bitratectrlsel.GetCurSel(); m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byFramesPerSec= m_framesel.GetCurSel(); m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byEncodeMode= ecOIdx; m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byImageSize= rsOIdx; m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byImageQlty= m_imgqualitysel.GetCurSel()+1; } else if (strmIdx < 6) //assistant - for net-transfor { m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byVideoEnable= m_videochk.GetCheck(); m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byAudioEnable= m_audiochk.GetCheck(); m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byBitRateControl= m_bitratectrlsel.GetCurSel(); m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byFramesPerSec= m_framesel.GetCurSel(); m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byEncodeMode= m_encodetypesel.GetCurSel(); m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byImageSize= m_resolutionsel.GetCurSel(); m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byImageQlty= m_imgqualitysel.GetCurSel()+1; } m_chnCFG[m_chnIdx].stColorCfg[0].byBrightness = GetDlgItemInt(IDC_EDIT_BRIGHTNESS); m_chnCFG[m_chnIdx].stColorCfg[0].bySaturation = GetDlgItemInt(IDC_EDIT_SATURATION); m_chnCFG[m_chnIdx].stColorCfg[0].byContrast = GetDlgItemInt(IDC_EDIT_CONTRAST); m_chnCFG[m_chnIdx].stColorCfg[0].byHue = GetDlgItemInt(IDC_EDIT_HUE); m_chnCFG[m_chnIdx].stColorCfg[0].byGainEn = m_gainchk.GetCheck(); m_chnCFG[m_chnIdx].stColorCfg[0].byGain = GetDlgItemInt(IDC_EDIT_GAIN); // m_chnCFG[1].stChannelOSD.bShow = 1; // m_chnCFG[1].stChannelOSD.rgbaFrontground = 0xFFFFFFFF; BOOL bRet = CLIENT_SetDevConfig(m_pDev->LoginID, DEV_CHANNELCFG, -1/*all channel*/, &m_chnCFG, 16*sizeof(DEV_CHANNEL_CFG), CONFIG_WAITTIME); if (!bRet) { ((CNetSDKDemoDlg*)AfxGetMainWnd())->LastError(); return; } else { MessageBox(ConvertString(MSG_CONFIG_SUCCESS), "OK"); } }
void _fastcall ConvertTriggerName_Hook(char* src, char* dst, int len) { ConvertString(src, dst, len); }
void CDlgCfgAccessControl::InitDlg() { int i = 0; // channel m_cmbChannel.ResetContent(); for (i = 0; i < 4; i++) { CString csInfo; csInfo.Format("%s%d", ConvertString("Channel", DLG_CFG_ACCESS_CONTROL), i + 1); m_cmbChannel.InsertString(-1, csInfo); } m_cmbChannel.SetCurSel(0); // door open method m_cmbOpenMethod.ResetContent(); for (i = 0; i < sizeof(stuDemoOpenMethod)/sizeof(stuDemoOpenMethod[0]); i++) { m_cmbOpenMethod.InsertString(-1, ConvertString(stuDemoOpenMethod[i].szName)); } m_cmbOpenMethod.SetCurSel(-1); m_stuInfo.abDoorOpenMethod = true; // door unlock hold time m_stuInfo.abUnlockHoldInterval = true; // door close timeout m_stuInfo.abCloseTimeout = true; // open time index in config of AccessTimeSchedule, start from 0 m_cmbOpenTimeIndex.ResetContent(); for (i = 0; i < 128; i++) { CString csInfo; csInfo.Format("%02d", i); m_cmbOpenTimeIndex.InsertString(-1, csInfo); } m_cmbOpenTimeIndex.SetCurSel(-1); m_stuInfo.abOpenAlwaysTimeIndex = true; // holiday record set recNo m_stuInfo.abHolidayTimeIndex = true; // break in alarm enable m_stuInfo.abBreakInAlarmEnable = true; m_chkBreakAlarm.SetCheck(BST_UNCHECKED); // repeat enter alarm enable m_stuInfo.abRepeatEnterAlarmEnable = true; m_chkRepeatEnterAlarm.SetCheck(BST_UNCHECKED); // door not close enable m_stuInfo.abDoorNotClosedAlarmEnable = true; m_chkDoorNotCloseAlarm.SetCheck(BST_UNCHECKED); // duress alarm enable m_stuInfo.abDuressAlarmEnable = true; m_chkDuressAlarm.SetCheck(BST_UNCHECKED); // sensor alarm enable m_stuInfo.abSensorEnable = true; m_chkSensor.SetCheck(BST_UNCHECKED); }
bool PWSfile::Decrypt(const stringT &fn, const StringX &passwd, stringT &errmess) { ulong64 file_len; size_t len; unsigned char* buf = NULL; bool status = true; unsigned char salt[SaltLength]; unsigned char ipthing[8]; unsigned char randstuff[StuffSize]; unsigned char randhash[SHA1::HASHLEN]; unsigned char temphash[SHA1::HASHLEN]; FILE *in = pws_os::FOpen(fn, _T("rb")); if (in == NULL) { status = false; goto exit; } file_len = pws_os::fileLength(in); if (file_len < (8 + sizeof(randhash) + 8 + SaltLength)) { fclose(in); LoadAString(errmess, IDSC_FILE_TOO_SHORT); return false; } fread(randstuff, 1, 8, in); randstuff[8] = randstuff[9] = TCHAR('\0'); // ugly bug workaround fread(randhash, 1, sizeof(randhash), in); GenRandhash(passwd, randstuff, temphash); if (memcmp(reinterpret_cast<char *>(randhash), reinterpret_cast<char *>(temphash), SHA1::HASHLEN) != 0) { fclose(in); LoadAString(errmess, IDSC_BADPASSWORD); return false; } { // decryption in a block, since we use goto fread(salt, 1, SaltLength, in); fread(ipthing, 1, 8, in); unsigned char dummyType; unsigned char *pwd = NULL; size_t passlen = 0; ConvertString(passwd, pwd, passlen); Fish *fish = BlowFish::MakeBlowFish(pwd, reinterpret_cast<unsigned int &>(passlen), salt, SaltLength); trashMemory(pwd, passlen); delete[] pwd; // gross - ConvertString allocates. if (_readcbc(in, buf, len,dummyType, fish, ipthing, 0, file_len) == 0) { delete fish; delete[] buf; // if not yet allocated, delete[] NULL, which is OK return false; } delete fish; fclose(in); } // decrypt { // write decrypted data size_t suffix_len = CIPHERTEXT_SUFFIX.length(); size_t filepath_len = fn.length(); stringT out_fn = fn; out_fn = out_fn.substr(0,filepath_len - suffix_len); FILE *out = pws_os::FOpen(out_fn, _T("wb")); if (out != NULL) { size_t fret = fwrite(buf, 1, len, out); if (fret != len) { int save_errno = errno; fclose(out); errno = save_errno; goto exit; } if (fclose(out) != 0) { status = false; goto exit; } } else { // open failed status = false; goto exit; } } // write decrypted exit: if (!status) errmess = ErrorMessages(); delete[] buf; // allocated by _readcbc return status; }
bool PWSfile::Encrypt(const stringT &fn, const StringX &passwd, stringT &errmess) { ulong64 len = 0; size_t slen = 0; unsigned char* buf = NULL; Fish *fish = NULL; bool status = true; const stringT out_fn = fn + CIPHERTEXT_SUFFIX; unsigned char *pwd = NULL; size_t passlen = 0; FILE *out = NULL; FILE *in = pws_os::FOpen(fn, _T("rb")); if (in == NULL) { status = false; goto exit; } len = pws_os::fileLength(in); if (len > std::numeric_limits<uint32>::max()) { fclose(in); errno = EFBIG; status = false; goto exit; } slen = static_cast<size_t>(len); buf = new unsigned char[slen]; fread(buf, 1, slen, in); if (ferror(in)) { // this is how to detect fread errors status = false; int save_error = errno; fclose(in); errno = save_error; goto exit; } if (fclose(in) != 0) { status = false; goto exit; } out = pws_os::FOpen(out_fn, _T("wb")); if (out == NULL) { status = false; goto exit; } unsigned char randstuff[StuffSize]; unsigned char randhash[SHA1::HASHLEN]; // HashSize PWSrand::GetInstance()->GetRandomData( randstuff, 8 ); // miserable bug - have to fix this way to avoid breaking existing files randstuff[8] = randstuff[9] = TCHAR('\0'); GenRandhash(passwd, randstuff, randhash); SAFE_FWRITE(randstuff, 1, 8, out); SAFE_FWRITE(randhash, 1, sizeof(randhash), out); unsigned char thesalt[SaltLength]; PWSrand::GetInstance()->GetRandomData( thesalt, SaltLength ); SAFE_FWRITE(thesalt, 1, SaltLength, out); unsigned char ipthing[8]; PWSrand::GetInstance()->GetRandomData( ipthing, 8 ); SAFE_FWRITE(ipthing, 1, 8, out); ConvertString(passwd, pwd, passlen); fish = BlowFish::MakeBlowFish(pwd, reinterpret_cast<unsigned int &>(passlen), thesalt, SaltLength); trashMemory(pwd, passlen); delete[] pwd; // gross - ConvertString allocates. try { _writecbc(out, buf, slen, 0, fish, ipthing); } catch (...) { // _writecbc throws an exception if it fails to write fclose(out); errno = EIO; status = false; goto exit; } status = (fclose(out) == 0); exit: if (!status) errmess = ErrorMessages(); delete fish; delete[] buf; return status; }
void CDlgQuery::OnBnClickedQueryStart() { // TODO: 在此添加控件通知处理程序代码 //清空 if (m_stuDoFindNumberStat_out.pstuNumberStat) { delete[]m_stuDoFindNumberStat_out.pstuNumberStat; m_stuDoFindNumberStat_out.pstuNumberStat = NULL; } memset(&m_stuDoFindNumberStat_out, 0, sizeof(m_stuDoFindNumberStat_out.pstuNumberStat)); LONG lLogin = NULL; int nStatus = 0; BOOL bSuccess = FALSE; CDemoIVSPCDlg* pMainDlg = (CDemoIVSPCDlg*)AfxGetMainWnd(); if (pMainDlg) { lLogin = pMainDlg->GetLoginHandle(); } if (NULL == lLogin) { MessageBox(ConvertString("Please Logon frist!"), ConvertString("Prompt")); return; } CString cstrTmp, strResult; int nIndex = 0; int nBeginNumber = 0; int nCount = 0; //设置查询参数 NET_IN_FINDNUMBERSTAT stuFindNumberStat_in = {sizeof(NET_IN_FINDNUMBERSTAT)}; NET_OUT_FINDNUMBERSTAT stuFindNumberStat_out = {0}; NET_IN_DOFINDNUMBERSTAT stuDoFindNumberStat_in = {sizeof(NET_IN_DOFINDNUMBERSTAT)}; stuFindNumberStat_in.nChannelID = m_cmbChannel.GetCurSel(); stuFindNumberStat_in.nGranularityType = m_cmbTypes.GetCurSel(); SYSTEMTIME sysTime = {0}; m_dtpStartDate.GetTime(&sysTime); stuFindNumberStat_in.stStartTime.dwYear = sysTime.wYear; stuFindNumberStat_in.stStartTime.dwMonth = sysTime.wMonth; stuFindNumberStat_in.stStartTime.dwDay = sysTime.wDay; m_dtpStartTime.GetTime(&sysTime); stuFindNumberStat_in.stStartTime.dwHour = sysTime.wHour; stuFindNumberStat_in.stStartTime.dwMinute = sysTime.wMinute; stuFindNumberStat_in.stStartTime.dwSecond = sysTime.wSecond; m_dtpEndDate.GetTime(&sysTime); stuFindNumberStat_in.stEndTime.dwYear = sysTime.wYear; stuFindNumberStat_in.stEndTime.dwMonth = sysTime.wMonth; stuFindNumberStat_in.stEndTime.dwDay = sysTime.wDay; m_dtpEndTime.GetTime(&sysTime); stuFindNumberStat_in.stEndTime.dwHour = sysTime.wHour; stuFindNumberStat_in.stEndTime.dwMinute = sysTime.wMinute; stuFindNumberStat_in.stEndTime.dwSecond = sysTime.wSecond; stuFindNumberStat_in.nWaittime = 6000; LONG lFindNumberStat = CLIENT_StartFindNumberStat(lLogin, &stuFindNumberStat_in,&stuFindNumberStat_out); if (lFindNumberStat == NULL) { nStatus = 1; goto PRINT_EXIT; } m_editCount.GetWindowText(cstrTmp); nCount = atoi(cstrTmp.GetBuffer(0)); if (nCount <= 0) { nStatus = 4; goto PRINT_EXIT; } stuDoFindNumberStat_in.nCount = nCount; stuDoFindNumberStat_in.nWaittime = 6000; m_editBegin.GetWindowText(cstrTmp); nBeginNumber = atoi(cstrTmp.GetBuffer(0)); if (nBeginNumber > (int)stuFindNumberStat_out.dwTotalCount) { nStatus = 5; goto PRINT_EXIT; } stuDoFindNumberStat_in.nBeginNumber = nBeginNumber; memset(&m_stuDoFindNumberStat_out, 0 ,sizeof(m_stuDoFindNumberStat_out)); m_stuDoFindNumberStat_out.dwSize = sizeof(m_stuDoFindNumberStat_out); try { m_stuDoFindNumberStat_out.pstuNumberStat = new DH_NUMBERSTAT[stuDoFindNumberStat_in.nCount]; } catch (...) { nStatus = 2; goto PRINT_EXIT; } if (NULL== m_stuDoFindNumberStat_out.pstuNumberStat) { nStatus = 2; goto PRINT_EXIT; } for (nIndex= 0; nIndex < (int)stuDoFindNumberStat_in.nCount; nIndex++) { memset(m_stuDoFindNumberStat_out.pstuNumberStat+nIndex, 0, sizeof(DH_NUMBERSTAT)); m_stuDoFindNumberStat_out.pstuNumberStat[nIndex].dwSize = sizeof(DH_NUMBERSTAT); } m_stuDoFindNumberStat_out.nBufferLen = stuDoFindNumberStat_in.nCount*sizeof(DH_NUMBERSTAT); bSuccess = CLIENT_DoFindNumberStat(lFindNumberStat, &stuDoFindNumberStat_in, &m_stuDoFindNumberStat_out); if ( bSuccess == -1 ) { nStatus = 3; goto PRINT_EXIT; } ShowListResult(m_stuDoFindNumberStat_out); strResult = ConvertString("Result:"); cstrTmp.Format("%d", m_stuDoFindNumberStat_out.nCount); strResult += cstrTmp; GetDlgItem(IDC_STATIC_SHOW_RESULT)->SetWindowText(strResult); nStatus = 0; PRINT_EXIT: if (lFindNumberStat) { CLIENT_StopFindNumberStat(lFindNumberStat); } /*if (stuDoFindNumberStat_out.pstuNumberStat) { delete [] stuDoFindNumberStat_out.pstuNumberStat; stuDoFindNumberStat_out.pstuNumberStat = NULL; }*/ switch( nStatus) { case 0: //MessageBox("查询成功..."); break; case 1: MessageBox(ConvertString("Start query failed!"), ConvertString("Prompt")); break; case 2: MessageBox(ConvertString("Out Of Memory!"), ConvertString("Prompt")); break; case 3: MessageBox(ConvertString("Execute query failed!"), ConvertString("Prompt")); break; case 4: MessageBox(ConvertString("Query number should be greater than 0!"), ConvertString("Prompt")); break; case 5: MessageBox(ConvertString("Start number should be smaller than totall query number!"), ConvertString("Prompt")); break; } if (nStatus != 0) { //若查询失败,清空列表,重置上一页,下一页按钮 ShowListResult(m_stuDoFindNumberStat_out); strResult = ConvertString("Query failed!"); GetDlgItem(IDC_STATIC_SHOW_RESULT)->SetWindowText(strResult); } }
FString ConvertString(const icu::UnicodeString& Source, const int32 SourceStartIndex, const int32 SourceLen) { FString Destination; ConvertString(Source, SourceStartIndex, SourceLen, Destination); return Destination; }
static void ConvertNatbib(char *s, int code, char *pre, char *post) { char *n, *year, *abbv, *full, *v; PushSource(NULL,s); n=getBraceParam(); year=getBraceParam(); abbv=getBraceParam(); full=getBraceParam(); PopSource(); diagnostics(5,"natbib [%s] <%s> <%s> <%s> <%s>",pre,n,year,abbv,full); switch (code) { case CITE_CITE: case CITE_T: case CITE_T_STAR: v=abbv; if (CITE_T==code && g_citation_longnamesfirst && !g_current_cite_seen) if (!isEmptyName(full)) v = full; if (CITE_T_STAR==code) if (!isEmptyName(full)) v = full; if (CITE_CITE==code && g_citation_longnamesfirst) if (!isEmptyName(full)) v = full; ConvertString(v); fprintRTF(" ("); ConvertString(year); if (pre){ fprintRTF(", "); ConvertString(pre); } if (post) { fprintRTF(", "); ConvertString(post); } fprintRTF(")"); break; case CITE_P: case CITE_P_STAR: v=abbv; if (CITE_P==code && g_citation_longnamesfirst && !g_current_cite_seen) if (!isEmptyName(full)) v = full; if (CITE_P_STAR==code) if (!isEmptyName(full)) v = full; if (pre && g_current_cite_item==1){ ConvertString(pre); fprintRTF(" "); } if (strcmp(v,g_last_author_cited)!=0) { /*suppress repeated names */ ConvertString(v); strcpy(g_last_author_cited,v); } fprintRTF(", "); ConvertString(year); if (post && *post !='\0') { fprintRTF(", "); ConvertString(post); fprintRTF(" "); } break; case CITE_AUTHOR: case CITE_AUTHOR_STAR: v=abbv; if (CITE_AUTHOR==code && g_citation_longnamesfirst && !g_current_cite_seen) v = full; if (CITE_AUTHOR_STAR==code) v = full; ConvertString(v); break; case CITE_YEAR: case CITE_YEAR_P: if (pre){ ConvertString(pre); fprintRTF(" "); } ConvertString(year); if (post) { fprintRTF(", "); ConvertString(post); } break; } free(n); free(year); free(abbv); free(full); }
void FStringConverter::ConvertString(const FString& Source, icu::UnicodeString& Destination, const bool ShouldNullTerminate) { ConvertString(*Source, 0, Source.Len(), Destination, ShouldNullTerminate); }
void CmdBCAY(int code) { char *s, *t, *v, *year; diagnostics(4,"Entering CmdBCAY", s); s = getBraceParam(); t = getBraceParam(); year = getBraceParam(); v = g_current_cite_seen ? t : s; diagnostics(4,"s = <%s>", s); diagnostics(4,"t = <%s>", t); diagnostics(4,"year = <%s>", year); diagnostics(4,"type = %d, seen = %d, item= %d",g_current_cite_type,g_current_cite_seen,g_current_cite_item); switch (g_current_cite_type){ case CITE_CITE: case CITE_CITE_NP: case CITE_CITE_A: if (strcmp(v,g_last_author_cited)!=0) { /*suppress repeated names */ ConvertString(v); strcpy(g_last_author_cited,v); if (g_current_cite_type==CITE_CITE_A) fprintRTF(" ("); else fprintRTF(", "); } ConvertString(year); if (g_current_cite_type==CITE_CITE_A) fprintRTF(")"); break; case CITE_CITE_AUTHOR: ConvertString(v); break; case CITE_FULL: case CITE_FULL_NP: case CITE_FULL_A: ConvertString(s); if (g_current_cite_type==CITE_FULL_A) fprintRTF(" ("); else fprintRTF(", "); ConvertString(year); if (g_current_cite_type==CITE_FULL_A) fprintRTF(")"); break; case CITE_FULL_AUTHOR: ConvertString(s); break; case CITE_SHORT: case CITE_SHORT_NP: case CITE_SHORT_A: case CITE_SHORT_AUTHOR: ConvertString(t); break; case CITE_YEAR: case CITE_YEAR_NP: ConvertString(year); break; } free(s); free(t); free(year); }
icu::UnicodeString FStringConverter::ConvertString(const FString& Source, const bool ShouldNullTerminate) { icu::UnicodeString Destination; ConvertString(Source, Destination, ShouldNullTerminate); return Destination; }
HRESULT CMpeg2DataParser::ParseSDT(ULONG ulFreq) { HRESULT hr; CComPtr<ISectionList> pSectionList; DWORD dwLength; PSECTION data; WORD wTSID; WORD wONID; WORD wSectionLength; CheckNoLog (m_pData->GetSection (PID_SDT, SI_SDT, &m_Filter, 5000, &pSectionList)); CheckNoLog (pSectionList->GetSectionData (0, &dwLength, &data)); CGolombBuffer gb ((BYTE*)data, dwLength); // service_description_section() CheckNoLog (ParseSIHeader (gb, SI_SDT, wSectionLength, wTSID)); wONID = gb.BitRead(16); // original_network_id gb.BitRead(8); // reserved_future_use while (gb.GetSize() - gb.GetPos() > 4) { CDVBChannel Channel; Channel.SetFrequency (ulFreq); Channel.SetTSID (wTSID); Channel.SetONID (wONID); Channel.SetSID (gb.BitRead(16)); // service_id uimsbf gb.BitRead(6); // reserved_future_use bslbf gb.BitRead(1); // EIT_schedule_flag bslbf Channel.SetNowNextFlag(!!gb.BitRead(1)); // EIT_present_following_flag bslbf gb.BitRead(3); // running_status uimsbf Channel.SetEncrypted (!!gb.BitRead(1)); // free_CA_mode bslbf // Descriptors: BeginEnumDescriptors(gb, nType, nLength) { switch (nType) { case DT_SERVICE : gb.BitRead(8); // service_type nLength = gb.BitRead(8); // service_provider_name_length gb.ReadBuffer (DescBuffer, nLength); // service_provider_name nLength = gb.BitRead(8); // service_name_length gb.ReadBuffer (DescBuffer, nLength); // service_name DescBuffer[nLength] = 0; Channel.SetName (ConvertString (DescBuffer, nLength)); TRACE ("%15S %d\n", Channel.GetName(), Channel.GetSID()); break; default : SkipDescriptor (gb, nType, nLength); // descriptor() break; } } EndEnumDescriptors if (!Channels.Lookup(Channel.GetSID())) { Channels [Channel.GetSID()] = Channel; } } return S_OK; }
icu::UnicodeString FStringConverter::ConvertString(const TCHAR* Source, const int32 SourceStartIndex, const int32 SourceLen, const bool ShouldNullTerminate) { icu::UnicodeString Destination; ConvertString(Source, SourceStartIndex, SourceLen, Destination, ShouldNullTerminate); return Destination; }
BOOL CUserConfig::OnInitDialog() { CDialog::OnInitDialog(); g_SetWndStaticText(this); CRect rc(0, 0, 0, 0); GetParent()->GetClientRect(&rc); ((CTabCtrl*)GetParent())->AdjustRect(FALSE, &rc); MoveWindow(&rc); CString csUserName; DWORD dwReturned; bSetUserParams = FALSE; char cTemp[100]; // if(m_bConnectServer) // { if(!CLIENT_GetDevConfig(m_Device->LoginID, DEV_GET_USERCFG , 0,&m_user, sizeof(NET_DEV_USER), &dwReturned, CONFIG_WAITTIME)) { // CString sTemp; // sTemp.Format("ERROR: NET_DVR_GET_USERCFG = %d \n", NET_DVR_GetLastError()); AfxMessageBox(ConvertString("usercfg error")); } else { if(m_bSuperUser) { m_usernum = 0; m_usersel.SetCurSel(m_usernum); } else { for(int i=0; i<MAX_USERNUM; i++) { ZeroMemory(cTemp, 100); memcpy(cTemp, m_user.struUser[i].sUserName, MAX_NAMELEN); csUserName.Format("%s", cTemp); if(strcmp(csUserName, m_Device->UserNanme) == 0) { break; } } m_usernum = i; m_usersel.SetCurSel(m_usernum); } ZeroMemory(cTemp, 100); memcpy(cTemp, m_user.struUser[m_usernum].sUserName, MAX_NAMELEN); m_username.Format("%s", cTemp); ZeroMemory(cTemp, 100); memcpy(cTemp, m_user.struUser[m_usernum].sPassword, PASSWD_LEN); m_userpsw.Format("%s", cTemp); ZeroMemory(cTemp, 100); memcpy(cTemp, m_user.struUser[m_usernum].sPassword, PASSWD_LEN); m_userpsw2.Format("%s", cTemp); m_userip.Format("%s",m_user.struUser[m_usernum].sUserIP); m_mac1.Format("%02x",m_user.struUser[m_usernum].byMACAddr[0]); m_mac2.Format("%02x",m_user.struUser[m_usernum].byMACAddr[1]); m_mac3.Format("%02x",m_user.struUser[m_usernum].byMACAddr[2]); m_mac4.Format("%02x",m_user.struUser[m_usernum].byMACAddr[3]); m_mac5.Format("%02x",m_user.struUser[m_usernum].byMACAddr[4]); m_mac6.Format("%02x",m_user.struUser[m_usernum].byMACAddr[5]); m_bLright_ptz = m_user.struUser[m_usernum].dwLocalRight[0]; m_bLright_rec = m_user.struUser[m_usernum].dwLocalRight[1]; m_bLright_playback = m_user.struUser[m_usernum].dwLocalRight[2]; m_bLright_cfg = m_user.struUser[m_usernum].dwLocalRight[3]; m_bLright_log = m_user.struUser[m_usernum].dwLocalRight[4]; m_bLright_more = m_user.struUser[m_usernum].dwLocalRight[5]; m_bRright_ptz = m_user.struUser[m_usernum].dwRemoteRight[0]; m_bRright_rec = m_user.struUser[m_usernum].dwRemoteRight[1]; m_bRright_playback = m_user.struUser[m_usernum].dwRemoteRight[2]; m_bRright_cfg = m_user.struUser[m_usernum].dwRemoteRight[3]; m_bRright_log = m_user.struUser[m_usernum].dwRemoteRight[4]; m_bRright_more = m_user.struUser[m_usernum].dwRemoteRight[5]; m_bRright_talk = m_user.struUser[m_usernum].dwRemoteRight[6]; m_bRright_monitor = m_user.struUser[m_usernum].dwRemoteRight[7]; m_bRright_alarm = m_user.struUser[m_usernum].dwRemoteRight[8]; m_bRright_localop = m_user.struUser[m_usernum].dwRemoteRight[9]; m_bRright_serial = m_user.struUser[m_usernum].dwRemoteRight[10]; GetDlgItem(IDC_USERSEL)->EnableWindow(FALSE); GetDlgItem(IDC_USERIP)->EnableWindow(FALSE); GetDlgItem(IDC_MAC1)->EnableWindow(FALSE); GetDlgItem(IDC_MAC2)->EnableWindow(FALSE); GetDlgItem(IDC_MAC3)->EnableWindow(FALSE); GetDlgItem(IDC_MAC4)->EnableWindow(FALSE); GetDlgItem(IDC_MAC5)->EnableWindow(FALSE); GetDlgItem(IDC_MAC6)->EnableWindow(FALSE); GetDlgItem(IDC_USERNAME)->EnableWindow(FALSE); GetDlgItem(IDC_USERPSW)->EnableWindow(FALSE); GetDlgItem(IDC_USERPSW2)->EnableWindow(FALSE); GetDlgItem(IDC_LRIGHT_PTZ)->EnableWindow(FALSE); GetDlgItem(IDC_LRIGHT_REC)->EnableWindow(FALSE); GetDlgItem(IDC_LRIGHT_PLAYBACK)->EnableWindow(FALSE); GetDlgItem(IDC_LRIGHT_CFG)->EnableWindow(FALSE); GetDlgItem(IDC_LRIGHT_LOG)->EnableWindow(FALSE); GetDlgItem(IDC_LRIGHT_MORE)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_PTZ)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_REC)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_PLAYBACK)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_CFG)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_LOG)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_MORE)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_TALK)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_MONITOR)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_ALARM)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_LOCALOP)->EnableWindow(FALSE); GetDlgItem(IDC_RRIGHT_SERIAL)->EnableWindow(FALSE); if(m_bSuperUser) { GetDlgItem(IDC_USERSEL)->EnableWindow(FALSE); GetDlgItem(IDC_USERIP)->EnableWindow(FALSE); GetDlgItem(IDC_MAC1)->EnableWindow(FALSE); GetDlgItem(IDC_MAC2)->EnableWindow(FALSE); GetDlgItem(IDC_MAC3)->EnableWindow(FALSE); GetDlgItem(IDC_MAC4)->EnableWindow(FALSE); GetDlgItem(IDC_MAC5)->EnableWindow(FALSE); GetDlgItem(IDC_MAC6)->EnableWindow(FALSE); GetDlgItem(IDC_USERNAME)->EnableWindow(FALSE); GetDlgItem(IDC_USERPSW)->EnableWindow(FALSE); GetDlgItem(IDC_USERPSW2)->EnableWindow(FALSE); } GetDlgItem(IDC_USERCFG_APPLY)->EnableWindow(TRUE); } // } GetDlgItem(IDC_USERNAME)->EnableWindow(FALSE); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void FStringConverter::ConvertString(const icu::UnicodeString& Source, FString& Destination) { return ConvertString(Source, 0, Source.length(), Destination); }
void CmdFontFamily(int code) /****************************************************************************** purpose: selects the appropriate font family F_FAMILY_ROMAN for \rmfamily F_FAMILY_ROMAN_1 for \rm F_FAMILY_ROMAN_2 for \textrm{...} F_FAMILY_ROMAN_3 for \begin{rmfamily} or \end{rmfamily} ******************************************************************************/ { char *s; int num, true_code; true_code = code & ~ON; diagnostics(6, "CmdFontFamily (before) depth=%d, family=%d, size=%d, shape=%d, series=%d", FontInfoDepth, RtfFontInfo[FontInfoDepth].family, RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape, RtfFontInfo[FontInfoDepth].series); if (!(code & ON) && (true_code == F_FAMILY_CALLIGRAPHIC_3 || true_code == F_FAMILY_TYPEWRITER_3 || true_code == F_FAMILY_SANSSERIF_3 || true_code == F_FAMILY_ROMAN_3 || true_code == F_FAMILY_TYPEWRITER_4 || true_code == F_FAMILY_SANSSERIF_4 || true_code == F_FAMILY_ROMAN_4)) return; switch (true_code) { case F_FAMILY_SANSSERIF: case F_FAMILY_SANSSERIF_1: case F_FAMILY_SANSSERIF_2: case F_FAMILY_SANSSERIF_3: case F_FAMILY_SANSSERIF_4: num = TexFontNumber("Sans Serif"); break; case F_FAMILY_TYPEWRITER: case F_FAMILY_TYPEWRITER_1: case F_FAMILY_TYPEWRITER_2: case F_FAMILY_TYPEWRITER_3: case F_FAMILY_TYPEWRITER_4: num = TexFontNumber("Typewriter"); break; case F_FAMILY_CALLIGRAPHIC: case F_FAMILY_CALLIGRAPHIC_1: case F_FAMILY_CALLIGRAPHIC_2: case F_FAMILY_CALLIGRAPHIC_3: num = TexFontNumber("Calligraphic"); break; case F_FAMILY_ROMAN: case F_FAMILY_ROMAN_1: case F_FAMILY_ROMAN_2: case F_FAMILY_ROMAN_3: case F_FAMILY_ROMAN_4: default: num = TexFontNumber("Roman"); break; } switch (true_code) { case F_FAMILY_ROMAN: case F_FAMILY_SANSSERIF: case F_FAMILY_TYPEWRITER: case F_FAMILY_CALLIGRAPHIC: case F_FAMILY_ROMAN_3: case F_FAMILY_SANSSERIF_3: case F_FAMILY_TYPEWRITER_3: case F_FAMILY_CALLIGRAPHIC_3: fprintRTF("\\f%d ", num); break; case F_FAMILY_ROMAN_1: case F_FAMILY_SANSSERIF_1: case F_FAMILY_TYPEWRITER_1: case F_FAMILY_ROMAN_4: case F_FAMILY_SANSSERIF_4: case F_FAMILY_TYPEWRITER_4: fprintRTF("\\i0\\scaps0\\b0\\f%d ", num); break; case F_FAMILY_ROMAN_2: case F_FAMILY_SANSSERIF_2: case F_FAMILY_TYPEWRITER_2: case F_FAMILY_CALLIGRAPHIC_2: s = getBraceParam(); if (strlen(s) != 0 && getTexMode() == MODE_VERTICAL) changeTexMode(MODE_HORIZONTAL); fprintRTF("{\\f%d ", num); ConvertString(s); fprintRTF("}"); free(s); break; } diagnostics(6, "CmdFontFamily (after) depth=%d, family=%d, size=%d, shape=%d, series=%d", FontInfoDepth, RtfFontInfo[FontInfoDepth].family, RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape, RtfFontInfo[FontInfoDepth].series); }
DWORD WINAPI BuildThreadPROC(LPVOID lpParameter) { CZogvmDlg *pDlg=(CZogvmDlg *)lpParameter; char tempstr[256]; pDlg->hddList.clear(); //几个硬盘开几个线程 SQLDB.Hdd_Read(pDlg->hddList); list<struct FILETYPE_ST> typeList; typeList.clear(); SQLDB.Type_Read(typeList); list<struct ZIDIAN_ST> zidianList; zidianList.clear(); SQLDB.ZiDian_Read(zidianList); list<struct HDD_ST>::iterator beglist; for(beglist=pDlg->hddList.begin();beglist!=pDlg->hddList.end();beglist++) { if(beglist->insertflag && beglist->enable) { sprintf(tempstr,ConvertString("%s %s :建目录中.."),beglist->serno,beglist->mark); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); //建目录 FindAllFile_NEW(beglist->hdd_nid,beglist->area,typeList,zidianList); //缺少 关联 IDX代码 SQLDB.File_CleanIDX(beglist->hdd_nid); sprintf(tempstr,ConvertString("%s %s :判断文件是否存在.."),beglist->serno,beglist->mark); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); //查看文件是否存在 CheckAllIsFile(beglist->hdd_nid); } } for(beglist=pDlg->hddList.begin();beglist!=pDlg->hddList.end();beglist++) { if(beglist->insertflag && beglist->enable) { sprintf(tempstr,ConvertString("%s %s :判断重复文件.."),beglist->serno,beglist->mark); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); //查看重复文件 CheckAllDoubleFile(beglist->hdd_nid); } } bbbb=GetTickCount()-aaaa; sprintf(tempstr,ConvertString("全部扫描完毕~么么哒 耗时%I64u分钟"),bbbb/60000); pZogvmDlg->GetDlgItem(IDC_STATIC_MSG)->SetWindowText(tempstr); pZogvmDlg->GetDlgItem(IDC_BUTTON_BUILD)->EnableWindow(TRUE); return 0; }
void CmdFontSeries(int code) /**************************************************************************** purpose : sets the font weight to medium or bold F_SERIES_BOLD for \bfseries ... F_SERIES_BOLD_1 for \bf ... F_SERIES_BOLD_2 for \textbf{...} F_SERIES_BOLD_3 for \begin{bfseries} ... \end{bfseries} ****************************************************************************/ { int true_code = code & ~ON; char *s; diagnostics(5, "CmdFontSeries (before) depth=%d, family=%d, size=%d, shape=%d, series=%d", FontInfoDepth, RtfFontInfo[FontInfoDepth].family, RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape, RtfFontInfo[FontInfoDepth].series); /* either \end{bfseries} or \end{mdseries} */ if ((true_code == F_SERIES_MEDIUM_3 || true_code == F_SERIES_BOLD_3 || true_code == F_SERIES_BOLD_4) && !(code & ON)) return; if (true_code == F_SERIES_BOLD_2 || true_code == F_SERIES_MEDIUM_2) { s = getBraceParam(); if (strlen(s) != 0 && getTexMode() == MODE_VERTICAL) changeTexMode(MODE_HORIZONTAL); } switch (code) { case F_SERIES_MEDIUM_3: case F_SERIES_MEDIUM: fprintRTF("\\b0 "); break; case F_SERIES_MEDIUM_1: fprintRTF("\\i0\\scaps0\\b0 "); break; case F_SERIES_MEDIUM_2: fprintRTF("{\\b0 "); break; case F_SERIES_BOLD: case F_SERIES_BOLD_3: fprintRTF("\\b "); break; case F_SERIES_BOLD_1: case F_SERIES_BOLD_4: fprintRTF("\\i0\\scaps0\\b "); break; case F_SERIES_BOLD_2: if (getTexMode() == MODE_VERTICAL) changeTexMode(MODE_HORIZONTAL); fprintRTF("{\\b "); break; } if (true_code == F_SERIES_BOLD_2 || true_code == F_SERIES_MEDIUM_2) { ConvertString(s); fprintRTF("}"); free(s); } diagnostics(5, "CmdFontShape (after) depth=%d, family=%d, size=%d, shape=%d, series=%d", FontInfoDepth, RtfFontInfo[FontInfoDepth].family, RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape, RtfFontInfo[FontInfoDepth].series); }
BOOL CZogvmDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon //设置列表图标 m_SmallIcon.Create(16,16, 1, 10, 4); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_GREEN)); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_RED)); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_VIDEO)); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_AUDIO)); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_SUB)); m_SmallIcon.Add(AfxGetApp()->LoadIcon(IDI_ISO)); m_list.SetImageList(&m_SmallIcon,LVSIL_SMALL); //m_NullIcon.Create(1,1, 1, 10, 4); //m_NullIcon.Add(AfxGetApp()->LoadIcon(IDI_NULL)); //m_list.SetImageList(&m_NullIcon,LVSIL_SMALL); m_list.InsertColumn(0, ConvertString("磁盘序列号") , LVCFMT_LEFT, 90); m_list.InsertColumn(1, ConvertString("标签") , LVCFMT_LEFT, 80); m_list.InsertColumn(2, ConvertString("分区") , LVCFMT_LEFT, 40); m_list.InsertColumn(3, ConvertString("序号") , LVCFMT_LEFT, 50); m_list.InsertColumn(4, ConvertString("路径") , LVCFMT_LEFT, 200); m_list.InsertColumn(5, ConvertString("文件名") , LVCFMT_LEFT, 300); m_list.InsertColumn(6, ConvertString("类型") , LVCFMT_LEFT, 40); m_list.InsertColumn(7, ConvertString("后缀") , LVCFMT_LEFT, 50); m_list.InsertColumn(8, ConvertString("创建时间") , LVCFMT_LEFT, 130); m_list.InsertColumn(9, ConvertString("修改时间") , LVCFMT_LEFT,130); m_list.InsertColumn(10, ConvertString("文件大小") , LVCFMT_LEFT, 60); m_list.InsertColumn(11, ConvertString("分辨率") , LVCFMT_LEFT, 0); m_list.InsertColumn(12, ConvertString("播放长度") , LVCFMT_LEFT, 0); m_list.InsertColumn(13, ConvertString("硬盘接驳") , LVCFMT_LEFT, 60); m_list.InsertColumn(14, ConvertString("3D") , LVCFMT_LEFT,30); m_list.InsertColumn(15, ConvertString("画质") , LVCFMT_LEFT, 50); m_list.InsertColumn(16, ConvertString("分辨率") , LVCFMT_LEFT, 50); m_list.InsertColumn(17, ConvertString("压制组") , LVCFMT_LEFT, 80); m_list.InsertColumn(18, ConvertString("年代") , LVCFMT_LEFT, 40); m_list.InsertColumn(19, ConvertString("效验值") , LVCFMT_LEFT, 0); m_list.InsertColumn(20, ConvertString("重复ID") , LVCFMT_LEFT, 50); //带复选框 LVS_EX_CHECKBOXES 带图标 LVS_EX_SUBITEMIMAGES m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_SUBITEMIMAGES); // char output[1024]=""; // GetEd2kUrl("C:\\paramsettemp.jpg","paramsettemp.jpg",output); // TODO: Add extra initialization here #if OPEN_FFMEPG VideoInit(); #endif char title[512]=""; sprintf(title,"zogna video manager 1.07 Build:%s 更新地址:https://git.oschina.net/zogna/zogvm/attach_files",__DATE__); SetWindowText(title); //初始即最大化 ShowWindow(SW_MAXIMIZE); return TRUE; // return TRUE unless you set the focus to a control }
int CompareVersions(const std::string& VersionA, const std::string& VersionB, bool Strict) { std::string LowCaseA(VersionA), LowCaseB(VersionB); boost::to_lower(LowCaseA); boost::to_lower(LowCaseB); if (LowCaseA == LowCaseB) return 0; std::vector<std::string> SplittedA, SplittedB; SplittedA = SplitString(LowCaseA,".~",false); SplittedB = SplitString(LowCaseB,".~",false); if ( !(SplittedA.size()==3 || SplittedA.size()==4) || !(SplittedB.size()==3 || SplittedB.size()==4)) return -2; unsigned int MajorA, MinorA, PatchA, MajorB, MinorB, PatchB; std::string StatusA(""), StatusB(""); if (SplittedA.size()==4) StatusA = SplittedA[3]; if (SplittedB.size()==4) StatusB = SplittedB[3]; if (ConvertString(SplittedA[0],&MajorA) && ConvertString(SplittedA[1],&MinorA) && ConvertString(SplittedA[2],&PatchA) && ConvertString(SplittedB[0],&MajorB) && ConvertString(SplittedB[1],&MinorB) && ConvertString(SplittedB[2],&PatchB)) { if (MajorA > MajorB) return 1; if (MajorA < MajorB) return -1; if (MajorA == MajorB) { if (MinorA > MinorB) return 1; if (MinorA < MinorB) return -1; if (MinorA == MinorB) { if (PatchA > PatchB) return 1; if (PatchA < PatchB) return -1; if (PatchA == PatchB) { if (!Strict) return 0; else { if (StatusA.empty() && StatusB.empty()) return 0; if (StatusA == StatusB) return 0; if (StatusA.empty() && !StatusB.empty()) return 1; if (!StatusA.empty() && StatusB.empty()) return -1; if (StatusA > StatusB) return 1; if (StatusA < StatusB) return -1; } } } } } return -2; }
void CDlgAlarmState::showInfo(int nCurSel) { m_cmbAlarmInChannel.ResetContent(); m_cmbAlarmOutChannel.ResetContent(); m_cmbAlarmBellChannel.ResetContent(); char szAllarmBellRetCount[10] = {0}, szAllarmInRetCount[10] = {0}, szAllarmOutRetCount[10] ={0}; char szExAllarmInRetCount[10] = {0}, szExAllarmOutRetCount[10] = {0}; int i = 0; int nAlarmCount = 0, nExAlarmCount = 0; if (0 < m_stuAlarmChannelState.nAlarmInRetCount) { nAlarmCount = __min(m_stuAlarmChannelState.nAlarmInRetCount, m_stuAlarmChannelState.nAlarmInCount); m_cmbAlarmInChannel.ResetContent(); for (i = 0; i < nAlarmCount; ++i) { CString csTemp; csTemp.Format("%s %04d", ConvertString("alarmInChannel", DLG_ALARM_CHANNEL_STATE), i + 1); m_cmbAlarmInChannel.InsertString(-1, csTemp); } itoa(m_stuAlarmChannelState.nAlarmInRetCount, szAllarmInRetCount, 10); m_edAlarmInRetCount.SetWindowText(szAllarmInRetCount); m_cmbAlarmInChannel.SetCurSel(nCurSel); m_ckAlarmInState.SetCheck(*(m_stuAlarmChannelState.pbAlarmInState + nCurSel) ? BST_CHECKED : BST_UNCHECKED); } if (0 < m_stuAlarmChannelState.nAlarmOutRetCount) { nAlarmCount = __min(m_stuAlarmChannelState.nAlarmOutCount, m_stuAlarmChannelState.nAlarmOutRetCount); m_cmbAlarmOutChannel.ResetContent(); for (i = 0; i < nAlarmCount; ++i) { CString csTemp; csTemp.Format("%s %04d", ConvertString("alarmOutChannel", DLG_ALARM_CHANNEL_STATE), i + 1); m_cmbAlarmOutChannel.InsertString(-1, csTemp); } itoa(m_stuAlarmChannelState.nAlarmOutRetCount, szAllarmOutRetCount, 10); m_edAlarmOutRetCount.SetWindowText(szAllarmOutRetCount); m_cmbAlarmOutChannel.SetCurSel(nCurSel); m_ckAlarmOutState.SetCheck(*(m_stuAlarmChannelState.pbAlarmOutState + nCurSel) ? BST_CHECKED : BST_UNCHECKED); } if (0 < m_stuAlarmChannelState.nAlarmBellRetCount) { nAlarmCount = __min(m_stuAlarmChannelState.nAlarmBellCount, m_stuAlarmChannelState.nAlarmBellRetCount); m_cmbAlarmBellChannel.ResetContent(); for (i = 0; i < nAlarmCount; ++i) { CString csTemp; csTemp.Format("%s %04d", ConvertString("alarmBellChannel", DLG_ALARM_CHANNEL_STATE), i + 1); m_cmbAlarmBellChannel.InsertString(-1, csTemp); } itoa(m_stuAlarmChannelState.nAlarmBellRetCount, szAllarmBellRetCount, 10); m_edAlarmBellRetCount.SetWindowText(szAllarmBellRetCount); m_cmbAlarmBellChannel.SetCurSel(nCurSel); m_ckAlarmBellState.SetCheck(*(m_stuAlarmChannelState.pbAlarmBellState + nCurSel) ? BST_CHECKED : BST_UNCHECKED); } if (0 < m_stuAlarmChannelState.nExAlarmInRetCount) { nExAlarmCount = __min(m_stuAlarmChannelState.nExAlarmInCount, m_stuAlarmChannelState.nExAlarmInRetCount); m_cmbExAlarmInChannel.ResetContent(); for (i = 0; i < nExAlarmCount; ++i) { CString csTemp; csTemp.Format("%s %04d", ConvertString("exAlarmInChannel", DLG_ALARM_CHANNEL_STATE), *(m_stuAlarmChannelState.pnExAlarmInDestionation + i) + 1); m_cmbExAlarmInChannel.InsertString(-1, csTemp); } itoa(m_stuAlarmChannelState.nExAlarmInRetCount, szExAllarmInRetCount, 10); m_edExAlarmInRetCount.SetWindowText(szExAllarmInRetCount); m_cmbExAlarmInChannel.SetCurSel(nCurSel); m_ckExAlarmInState.SetCheck(*(m_stuAlarmChannelState.pbExAlarmInState + nCurSel) ? BST_CHECKED : BST_UNCHECKED); } if (0 < m_stuAlarmChannelState.nExAlarmOutRetCount) { nExAlarmCount = __min(m_stuAlarmChannelState.nExAlarmOutCount, m_stuAlarmChannelState.nExAlarmOutRetCount); m_cmbExAlarmOutChannel.ResetContent(); for (i = 0; i < nExAlarmCount; ++i) { CString csTemp; csTemp.Format("%s %04d", ConvertString("exAlarmOutChannel", DLG_ALARM_CHANNEL_STATE), *(m_stuAlarmChannelState.pnExAlarmOutDestionation + i) + 1); m_cmbExAlarmOutChannel.InsertString(-1, csTemp); } itoa(m_stuAlarmChannelState.nExAlarmOutRetCount, szExAllarmOutRetCount, 10); m_edExAlarmOutRetCount.SetWindowText(szExAllarmOutRetCount); m_cmbExAlarmOutChannel.SetCurSel(nCurSel); m_ckExAlarmOutState.SetCheck(*(m_stuAlarmChannelState.pbExAlarmOutState + nCurSel) ? BST_CHECKED : BST_UNCHECKED); } }