//--------------------------------------------------------------------------- CustomPlayerTank::CustomPlayerTank(GameManager *mgr, FastBitmap *c, String profileFilename) : PlayerTank(mgr,c) { Defines profile; profile.Load("userdata\\"+profileFilename); delete sprite; SpriteFabric * sf = SpriteFabric::getInstance(); sprite = sf->SFM_CURRENT(profile.Get("sprite"),context); attackCoolDown = StrToInt(profile.Get("as")); speed = StrToInt(profile.Get("speed")); dmgmin = StrToInt(profile.Get("dmgmin")); dmgmax = StrToInt(profile.Get("dmgmax")); bulletSpeed = StrToInt(profile.Get("bulletspeed")); bulletType = StrToInt(profile.Get("bullettype")); maxhp = hp = StrToInt(profile.Get("maxhp")); typeResist = StrToInt(profile.Get("typeresist")); valueResist = StrToInt(profile.Get("valueresist")); pen[0] = StrToInt(profile.Get("concretepen")); pen[1] = StrToInt(profile.Get("brickpen")); pen[2] = StrToInt(profile.Get("tankpen")); }
int QConfig::GetIntValue( LPCWSTR sSection,LPCWSTR sKey ) { return StrToInt(GetValue(sSection, sKey)); }
void __fastcall TfrmMain::txt_mpChange(TObject *Sender) { AutoKey_MP_Value = StrToInt(txt_mp->Text); }
//-------------------------------------------------------------------------- // prepare log files void __fastcall TLog::prepareLogFile() { AnsiString str; try { Form1->LoggingLbl->Visible = false; // hide logging label AnsiString timeStr = DateTimeToStr(Now()); // date & time to a string // Execution logging if (ElogFlag) // if execution log selected { ElogFile = fopen(ELogFileName->Text.c_str(), "r"); // does file exist if (ElogFile) { // if file exists fclose(ElogFile); // close log file LogfileDialog->setMessage("Execution Log File exists!"); switch(LogfileDialog->ShowModal()) // Replace, Append, Cancel? { case mrOk: ElogFile = fopen(ELogFileName->Text.c_str(), "wt"); // open log file break; case mrAll: ElogFile = fopen(ELogFileName->Text.c_str(), "at"); // append to log file break; default: stopLog(); return; } } else { // file does not exist ElogFile = fopen(ELogFileName->Text.c_str(), "wt"); // open log file } if (!ElogFile) { // if file error sprintf(buffer,"Can't open log file. Check log file name., Error number %d\n", ElogFile); Application->MessageBox(buffer, "Error", MB_OK); stopLog(); Log->Show(); // display log form return; } // label file fprintf(ElogFile, "EASyCF execution log file: %s\n\n", timeStr.c_str()); Form1->LoggingLbl->Visible = true; // display logging label Form1->ToolLogStart->Enabled = false; Form1->ToolLogStop->Enabled = true; Form1->LogStart->Enabled = false; Form1->LogStop->Enabled = true; if (ElogFlag == INST_REG_MEM) { // if logging memory str = "0x"; logMemAddr = StrToInt(str + MemFrom->EditText); // get address to log logMemAddr -= logMemAddr%16; // force to $10 boundary logMemBytes = StrToInt(str + MemBytes->EditText); // get byte count logMemBytes += 15; logMemBytes -= logMemBytes%16; // force to increment of $10 } } // Output logging if (OlogFlag) // if output log selected { OlogFile = fopen(OLogFileName->Text.c_str(), "r"); // does file exist if (OlogFile) { // if file exists fclose(OlogFile); // close log file LogfileDialog->setMessage("Output Log File exists!"); switch(LogfileDialog->ShowModal()) // Replace, Append, Cancel? { case mrOk: OlogFile = fopen(OLogFileName->Text.c_str(), "wb"); // open log file break; case mrAll: OlogFile = fopen(OLogFileName->Text.c_str(), "ab"); // append to log file break; default: stopLog(); return; } } else { // file does not exist OlogFile = fopen(OLogFileName->Text.c_str(), "wb"); // open log file } if (!OlogFile) { // if error sprintf(buffer,"Can't open log file, error %d\n", OlogFile); Application->MessageBox(buffer, "Error", MB_OK); stopLog(); return; } // label file fprintf(OlogFile, "EASyCF output log file: %s\r\n\r\n", timeStr.c_str()); Form1->LoggingLbl->Visible = true; // display logging label Form1->ToolLogStart->Enabled = false; Form1->ToolLogStop->Enabled = true; Form1->LogStart->Enabled = false; Form1->LogStop->Enabled = true; } Form1->SaveSettings(); Log->Close(); // close log window } catch( ... ) { sprintf(buffer, "ERROR 999: An exception occurred in routine 'TLog::OKBtnClick'. \n"); Application->MessageBox(buffer, "Error", MB_OK); } }
DWORD WINAPI CommMonitor( LPSTR lpData) { //监控串口接收数据,并完成数据格式分析,将结果放入结果队列 CommData SYSTEMTIME SystemTime; int nItemCount,TrayNum,CupNum;//样本项目号,盘号,杯号 BYTE SampleIDLen ;//数据包功能号,样本ID长度 WORD wSampleNo; bool blogfile; int i,ByteRecieved; bool isdataPacket=FALSE; char DataBuffer[200];// 数据缓冲区! CHAR TempWorkingID[c_MaxWorkingIDLength+1];//样本号,chj char LSampleID[5]; Init() ResetOpPointer() ResetRxPointer() nItemCount =0; FillDevName() SetCommWaitMask(EV_RXCHAR) PurgeComm( hComm, PURGE_RXCLEAR ); blogfile=NewLogFile("Syn_ELISE.txt"); WriteCommChar(XON) while (TRUE) { WaitEvent(EV_RXCHAR) do { ReadFile(hComm, &RxChar, 1, &dwReadLength, NULL); if(RxChar==STX) isdataPacket=TRUE; if(isdataPacket) { DataBuffer[i]=RxChar; i++; } if(RxChar==ENQ||RxChar==EOT) { break; } if(((RxChar==ETX)|(RxChar==ETB))&(isdataPacket)) { //DataBuffer[i]=RxChar; ByteRecieved=i; break; } }while(dwReadLength==1); i=0; if((RxChar==ETX)) { while(DataBuffer[i]!=STX) i++; } lpOpPointer=&DataBuffer[i]; if (blogfile) { WriteLogData(hLogFile,lpOpPointer,ByteRecieved); } switch (RxChar) { case ENQ: // Sleep(300); TransmitCommChar(hComm,ACK); break; case ETB: case ETX: //先进行校验的计算,若为正常接受则进行结果处理! //目前,由于资料校验和的计算方法与结果包中数据不符!尚未加校验计算 /* 需要到仪器上读出数据包进行分析 */ switch(*(lpOpPointer+2)) { case 'H': break; case 'P': break; case 'O': nItemCount=0; TrayNum=(int)StrToInt(lpOpPointer+c_TrayNumEOff,c_TrayNumLen); CupNum=(int)StrToInt(lpOpPointer+c_CupNumEOff,c_CupNumLen); wSampleNo =(int)StrToInt(lpOpPointer+c_SequenceNoOff,c_SequenceNoLen); _itoa(wSampleNo,LSampleID,10); TempWorkingID[0]=lpDevice->DevItemType; memset(&TempWorkingID[1],0x30,5); SampleIDLen=strlen(LSampleID); strncpy(&TempWorkingID[6-SampleIDLen],&LSampleID[0],SampleIDLen); TempWorkingID[6]='\0'; break; //继续接收 case 'R': FillSampleID(nItemCount, wSampleNo) strncpy(OutResult[nItemCount].WorkingID,TempWorkingID,7);//填写工作单号 OutResult[nItemCount].ItemNo=nItemCount+1; FillItemName(nItemCount,lpOpPointer+c_ItemNameOff ,c_ItemNameLen) if (OutResult[nItemCount].ItemID[1]==124)//'|' 如果项目名称长度为1则添加字符串尾标志-ASCII 码值为 0 { OutResult[nItemCount].ItemID[1]='\0'; FillResult(nItemCount,lpOpPointer+c_ResultOff-2,c_ResultLen) } else FillResult(nItemCount,lpOpPointer+c_ResultOff,c_ResultLen) OutResult[nItemCount].ItemNo=nItemCount+1; //填日期 GetSystemTime(&SystemTime); FillDate(nItemCount, SystemTime.wYear, SystemTime.wMonth, SystemTime.wDay, SystemTime.wHour,SystemTime.wMinute,SystemTime.wSecond) nItemCount++; (*lpResultProcessRoutine)(lpDevice->nDevNO, &OutResult[nItemCount-1], 1); lpDevice->dwRecordCount+=1; break; case 'L': break; } // Sleep(300); TransmitCommChar(hComm,ACK); break; case EOT: //结果入队列 default: TransmitCommChar(hComm,ACK); break; }
/** receive_doble天内重复来单不受理; 用户暂定为1天 * params: ics_info * return: int */ int RobRuleValid::ProCheckDobleQuest(Qhelper_Ics_Complaint &ics_info) { map<string,string> theParamIn; theParamIn.clear(); //解析vCommand字符串 std::map<string, string> dst_opData; std::string src_cmd = ics_info.vCommand; string flag = "& = "; SplitToMap(src_cmd, dst_opData, flag, (unsigned int)2); ValidLOG->WriteLog("in Valid Proccess,ProCheckDobleQuest-IcsInfo==|ICSID:%s| dst_opData[area]:%s | dst_opData[role_id]:%s|iParam_Num:%s\n",ics_info.sICSId.c_str(), dst_opData["area"].c_str(), dst_opData["role_id"].c_str(), ics_info.sParaNum.c_str()); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, ics_info.sICSId.c_str(), dst_opData["role_id"].c_str(), TLOG_LEVEL_DEBUG, __FUNCTION__, "in Valid Proccess,ProCheckDobleQuest-IcsInfo\n" ); theParamIn["uin"] = dst_opData["uin"]; theParamIn["apply_day_in"] = CRobConf::getConf()->GetIcsValid()["receve_double"]; //一天内 theParamIn["service_id"] = ics_info.sServiceID; #ifdef dnf2 //调试阶段以role_name代替role_id theParamIn["role_id"] = string(GbkToUtf8((char*)dst_opData["role_name"].c_str())); #endif vector< map<string,string> > base_result; theParamIn["role_id"] = dst_opData["rold_id"]; //ics_log_header header(info.sICSId,info.sUin,info.sServiceID); ics_log_header header(ics_info.sICSId,"",ics_info.sServiceID); if(0 != valid_parse.GetFunction(header,theParamIn,"ics_apply_repeat_uin",base_result)) { ValidLOG->WriteLog("In Valid Proccess, Find Uin 'ics_apply_repeat_uin' happened error,not find info\n"); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, ics_info.sICSId.c_str(), dst_opData["uin"].c_str(), TLOG_LEVEL_ERROR, __FUNCTION__, "In Valid Proccess, Find Uin 'get_ics_info_by_uin' happened error,not find info\n" ); return STEP_FLITER_RUN_STAT_ERROR_INTERFACE; } //////////////////////////////////added by v_zhtang on 2012-11-20//////////////////////////////////////// int check_flag=0; int check_running_flag=0; int check_false_flag=0; int check_result=0; if(base_result.size()>1){ for(int i=0;i<base_result.size();i++){ ValidLOG->WriteLog("[Info]'ProCheckDobleQuest' Proccessing <%d>&iICSAnaylseResult=<%s>\n",base_result.size(),base_result[i]["sDesc"].c_str()); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, ics_info.sICSId.c_str(), dst_opData["uin"].c_str(), TLOG_LEVEL_INFO, __FUNCTION__, "[Info]'ProCheckDobleQuest' Proccessing <%d>&iICSAnaylseResult=<%s>\n",base_result.size(),base_result[i]["sDesc"].c_str() ); //a 如果存在处理成功的---:此单据为异常单据《重复单据》 if(StrToInt(base_result[i]["sDesc"])==STEP_FLITER_RUN_STAT_SUCCESS) { ValidLOG->WriteLog("[Info] [QhelperRuleValid::ProCheckDobleQuest] Get The Fromer icsID Result<%s>, Process Pass Fliter Ok, So Not Pass It\n",base_result[i]["sDesc"].c_str()); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, ics_info.sICSId.c_str(), dst_opData["uin"].c_str(), TLOG_LEVEL_ERROR, __FUNCTION__, "[Info] [QhelperRuleValid::ProCheckDobleQuest] Get The Fromer icsID Result<%s>, Process Pass Fliter Ok, So Not Pass It\n",base_result[i]["sDesc"].c_str() ); return (STEP_FLITER_RUN_STAT_ERROR_APPLY_AGAIN); } //a.1 如果存在在阶段的处理的流程中的单据 if(StrToInt(base_result[i]["sDesc"]) ==STEP_FLITER_RUNNING_STAT) { ValidLOG->WriteLog("[Info] [QhelperRuleValid::ProCheckDobleQuest] Runing AND False=[%s]\n",base_result[i]["sDesc"].c_str()); { check_result++; ValidLOG->WriteLog("[Info] [QhelperRuleValid::ProCheckDobleQuest] Running=%s&check_result=%d\n",base_result[i]["sDesc"].c_str(),check_result); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, ics_info.sICSId.c_str(), dst_opData["uin"].c_str(), TLOG_LEVEL_WARNING, __FUNCTION__, "[Info] [QhelperRuleValid::ProCheckDobleQuest] Running=%s&check_result=%d\n",base_result[i]["sDesc"].c_str(),check_result ); } } //a.2 如果存在在一次处理多的单据 if(StrToInt(base_result[i]["sICSAnaylseStatus"])==STEP_FLITER_RUNNING_STAT) { check_running_flag++; ValidLOG->WriteLog("[Info] [QhelperRuleValid::ProCheckDobleQuest] LOT APPLY=%d",check_running_flag); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, ics_info.sICSId.c_str(), dst_opData["uin"].c_str(), TLOG_LEVEL_WARNING, __FUNCTION__, "[Info] [QhelperRuleValid::ProCheckDobleQuest] LOT APPLY=%d",check_running_flag ); } } //如果存在各阶段处理中的单据 if(check_result>0){ return STEP_FLITER_RUN_STAT_ERROR_INTERFACE; } //如果所有的单据的都是在第一个阶段的单据 if(check_running_flag>1){ ValidLOG->WriteLog("[Info] [QhelperRuleValid::ProCheckDobleQuest] STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT,So Pass Last It ,check_flag=<%d>\n",check_running_flag); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, ics_info.sICSId.c_str(), dst_opData["uin"].c_str(), TLOG_LEVEL_WARNING, __FUNCTION__, "[Info] [QhelperRuleValid::ProCheckDobleQuest] STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT,So Pass Last It ,check_flag=<%d>\n",check_running_flag ); return STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT; }else if(check_running_flag==1){ ValidLOG->WriteLog("[Info] [QhelperRuleValid::ProCheckDobleQuest] STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT,So I am The Last One ,check_flag=<%d>\n",check_running_flag); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, ics_info.sICSId.c_str(), dst_opData["uin"].c_str(), TLOG_LEVEL_INFO, __FUNCTION__, "[Info] [QhelperRuleValid::ProCheckDobleQuest] STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT,So I am The Last One ,check_flag=<%d>\n",check_running_flag ); return 0; } return 0;//其它情况 返回正常 }else if(base_result.size()==1){ ValidLOG->WriteLog("[Info] [QhelperRuleValid::ProCheckDobleQuest] The Fisrt Processing Only One, So Pass It\n"); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, ics_info.sICSId.c_str(), dst_opData["uin"].c_str(), TLOG_LEVEL_INFO, __FUNCTION__, "[Info] [QhelperRuleValid::ProCheckDobleQuest] The Fisrt Processing Only One, So Pass It\n" ); return 0; }else{ ValidLOG->WriteLog("[QhelperRuleValid::ProCheckDobleQuest] The <ics_apply_repeat_uin> Processing Interface Error\n"); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, ics_info.sICSId.c_str(), dst_opData["uin"].c_str(), TLOG_LEVEL_ERROR, __FUNCTION__, "[QhelperRuleValid::ProCheckDobleQuest] The <ics_apply_repeat_uin> Processing Interface Error" ); return STEP_FLITER_RUN_STAT_ERROR_INTERFACE; } }
/*********************************************************************************** * 返回BLOCK的ics的check过滤函数 * params: ics_info * return: int */ int RobRuleValid::ProCheckBlockTime(Rob_Ics_Complaint& info) { return StrToInt(info.siRobedRoleBan)==0?0:1; }
extern size_t OpenCOBOL_UnPackValue(CONVOPT *opt, unsigned char *p, ValueStruct *value) { int32_t i; char buff[SIZE_NUMBUF + 1]; unsigned char *q; ValueStruct *child; q = p; if (value != NULL) { ValueIsNonNil(value); switch (ValueType(value)) { case GL_TYPE_INT: i = *(int32_t*)p; IntegerCobol2C(opt, &i); SetValueInteger(value, (int64_t)i); p += sizeof(int32_t); break; case GL_TYPE_FLOAT: ValueFloat(value) = *(double *)p; p += sizeof(double); break; case GL_TYPE_BOOL: SetValueBool(value,(*(char *)p == 'T') ? TRUE : FALSE); p++; break; case GL_TYPE_OBJECT: StringCobol2C(p, SIZE_UUID); memcpy(ValueBody(value), p, SIZE_UUID); p += SIZE_UUID; break; case GL_TYPE_BYTE: memcpy(ValueByte(value), p, ValueByteLength(value)); p += ValueByteLength(value); break; case GL_TYPE_BINARY: SetValueBinary(value, p, opt->textsize); p += opt->textsize; break; case GL_TYPE_TEXT: case GL_TYPE_SYMBOL: StringCobol2C(p, opt->textsize); SetValueStringWithLength(value, p, opt->textsize, ConvCodeset(opt)); p += opt->textsize; break; case GL_TYPE_CHAR: case GL_TYPE_VARCHAR: case GL_TYPE_DBCODE: StringCobol2C(p, ValueStringLength(value)); SetValueStringWithLength(value, p, ValueStringLength(value), ConvCodeset(opt)); p += ValueStringLength(value); break; case GL_TYPE_NUMBER: memcpy(buff, p, ValueFixedLength(value)); FixedCobol2C(buff, ValueFixedLength(value)); strcpy(ValueFixedBody(value), buff); p += ValueFixedLength(value); break; case GL_TYPE_TIMESTAMP: ValueDateTimeYear(value) = StrToInt(p, 4); p += 4; ValueDateTimeMon(value) = StrToInt(p, 2) - 1; p += 2; ValueDateTimeMDay(value) = StrToInt(p, 2); p += 2; ValueDateTimeHour(value) = StrToInt(p, 2); p += 2; ValueDateTimeMin(value) = StrToInt(p, 2); p += 2; ValueDateTimeSec(value) = StrToInt(p, 2); p += 2; mktime(ValueDateTime(value)); break; case GL_TYPE_TIME: ValueDateTimeYear(value) = 0; ValueDateTimeMon(value) = 0; ValueDateTimeMDay(value) = 0; ValueDateTimeHour(value) = StrToInt(p, 2); p += 2; ValueDateTimeMin(value) = StrToInt(p, 2); p += 2; ValueDateTimeSec(value) = StrToInt(p, 2); p += 2; break; case GL_TYPE_DATE: ValueDateTimeYear(value) = StrToInt(p, 4); p += 4; ValueDateTimeMon(value) = StrToInt(p, 2) - 1; p += 2; ValueDateTimeMDay(value) = StrToInt(p, 2); p += 2; ValueDateTimeHour(value) = 0; ValueDateTimeMin(value) = 0; ValueDateTimeSec(value) = 0; mktime(ValueDateTime(value)); break; case GL_TYPE_ARRAY: for (i = 0; i < ValueArraySize(value); i++) { child = ValueArrayItem(value, i); if (child != NULL) { p += OpenCOBOL_UnPackValue(opt, p, child); ValueParent(child) = value; } } break; case GL_TYPE_ROOT_RECORD: case GL_TYPE_RECORD: for (i = 0; i < ValueRecordSize(value); i++) { child = ValueRecordItem(value, i); if (child != NULL) { p += OpenCOBOL_UnPackValue(opt, p, child); ValueParent(child) = value; } } break; default: ValueIsNil(value); break; } } return (p - q); }
void __fastcall Ttandr::gaslightClick(TObject *Sender) { motorreadytoread=false;//現在就是下載狀態,就是可以不可以接收的情形; comto8051->setParity(3); // Sleep(10);//設定送站名的parity,一開始就送的志因是因為下面四個都需要 Memo1->Clear(); switch(stationno->ItemIndex+5) { case 5:comto8051->Writebyte((Byte)11);Sleep(10);break; case 6: { Byte sb[8];//總共有8筆資料,但是給大一點 //在測試的時候注意是否需要重置51 int i,j,index; long x_value,y_value; String x_valuecontent,y_valuecontent; comto8051->Writebyte((Byte)5); Sleep(10); //Send StationNO 5 //ShowMessage(stationno->ItemIndex+1); String xyvalue=data->Text; //抓取data上的角度資料 xyvalue=xyvalue.Trim(); //把所有前後的空白都去除掉 if((index=xyvalue.Pos(','))==0) //確定data裡面有','這個東西。 { ShowMessage("你的迴轉量好像怪怪的,確定這個數值可以執行嗎?"); data->SetFocus(); return; } x_valuecontent=xyvalue.SubString(1,index-1);// ShowMessage(x_valuecontent); y_valuecontent=xyvalue.SubString(index+1,xyvalue.Length());//ShowMessage(y_valuecontent); for(int i=1;i<=x_valuecontent.Length();++i) //X值的的檢測 { //這邊是做避免有一些亂七八遭的英文字,或是一些奇怪的符號 if(x_valuecontent.SubString(i,1)<'-' || x_valuecontent.SubString(i,1)=='.' || x_valuecontent.SubString(i,1)=='/' || x_valuecontent.SubString(i,1)>'9') { ShowMessage("你的水平迴轉量好像怪怪的,確定這個數值可以執行嗎?"); data->SetFocus(); return; } } for(int i=1;i<=y_valuecontent.Length();++i) //Y值的檢測 { //這邊是做避免有一些亂七八遭的英文字,或是一些奇怪的符號 if(y_valuecontent.SubString(i,1)<'-' || y_valuecontent.SubString(i,1)=='.' || y_valuecontent.SubString(i,1)=='/' || y_valuecontent.SubString(i,1)>'9') { ShowMessage("你的垂直迴轉量好像怪怪的,確定這個數值可以執行嗎?"); data->SetFocus(); return; } } x_value=StrToInt(x_valuecontent)*25/9;y_value=StrToInt(y_valuecontent)*225/9; //是使之乘100/9變為我們原要的資料 // ShowMessage(x_value);ShowMessage(y_value); /* if((x_value>=-111 && x_value<=111)==false || (y_value>=-389 && y_value<=389)==false) { if((x_value>=-111 && x_value<=111)==false) ShowMessage("感謝您如此看重本系統,但是垂直迴轉度似乎不太對喔!請將數值調為-20至20之間。"); if((y_value>=-389 && y_value<=389)==false) ShowMessage("感謝您如此看重本系統,但是水平迴轉度似乎不太對喔!請將數值調為-35至35之間。"); data->SetFocus(); return; }*/ //ShowMessage(x_value);ShowMessage(y_value); for(int k=0;k<8;++k) sb[k]=0; for(i=3,j=7;i>=0;--i,--j) { sb[i]=x_value%256; //X軸佔4組Byte,先取最位數的餘數, x_value/=256; //把原值作256分割後的值,作為下次的餘數取得。 if(x_valuecontent.ToInt()<0)//這一種情形只有發生在負的值,正的值不需要如此處理。 x_value=x_value-1; sb[j]=y_value%256; //Y軸佔4組Byte y_value/=256; if(y_valuecontent.ToInt()<0) y_value=y_value-1; } for(int i=0;i<=7;++i) { int textptr=Memo1->Lines->Count-1; Memo1->Lines->Strings[textptr]=Memo1->Lines->Strings[textptr]+AnsiString(sb[i])+AnsiString(","); comto8051->Writebyte((Byte)sb[i]);Sleep(10); // ShowMessage(sb[i]); } break; } case 7:comto8051->Writebyte((Byte)6);Sleep(10);break; case 8:comto8051->Writebyte((Byte)8);Sleep(10);break; } data->SetFocus(); motorreadytoread=true;//現在就是執行狀態,就是可以接收的情形; }
//--------------------------------------------------------------------------- AnsiString __fastcall TRawPrint::ProcessarComandos(AnsiString Linha) { AnsiString Comando; AnsiString NovoComando; TStringList *Comandos; int CharComandos = 0; bool TemTexto = true; AnsiString NovaLinha = (String)char(10) + (String)char(13); AnsiString BackSpace = (String)char(8); AnsiString Acento; AnsiString Imp; Comandos = new TStringList; try { for(int i = 1; i < Linha.Length(); i++) { if(Linha[i] == '#') //Caso localizar Caracter indicando Comando { if(Linha[i + 4] == '#') //Caso for um Comando com um Parâmetro { if(ValidaComando(Linha.SubString(i + 1, 3))) { Comandos->Add(Linha.SubString(i, 5)); //Armazena o Comando na Lista de Comandos i = i + 4; CharComandos += 5; } } else if(Linha[i + 7] == '#') //Caso for um Comando com dois Parâmetros { if(ValidaComando(Linha.SubString(i + 1, 6))) { Comandos->Add(Linha.SubString(i, 8)); i = i + 7; CharComandos += 8; } } else if (Linha[i + 10] == '#') //Caso for um Comando com três Parâmetros { if(ValidaComando(Linha.SubString(i + 1, 9))) Comandos->Add(Linha.SubString(i, 11)); i = i + 10; CharComandos += 11; } } Linha = StringReplace(Linha, Linha[i], TiraAcento(Linha[i]), TReplaceFlags()); } if (CharComandos == Linha.Length() && Trim(Linha) != "") TemTexto = false; for (int i = 0; i < Comandos->Count; i++) { Comando = Comandos->Strings[i]; if(Comando.Length() == 5)//Substitui Comando com um Parâmetro NovoComando = (String)char(StrToInt(Comando.SubString(2, 3))); else if(Comando.Length() == 8)//Substitui Comando com dois Parâmetros NovoComando = (String)char(StrToInt(Comando.SubString(2, 3))) + (String)char(StrToInt(Comando.SubString(5, 3))); else//Substitui Comando com três Parâmetros NovoComando = (String)char(StrToInt(Comando.SubString(2, 3))) + (String)char(StrToInt(Comando.SubString(5, 3))) + (String)char(StrToInt(Comando.SubString(8, 3))); Linha = StringReplace(Linha, Comando, NovoComando, TReplaceFlags() << rfReplaceAll << rfIgnoreCase); } if (TemTexto) Linha += NovaLinha; } catch(Exception & E) { Erro("Erro ao processar Comandos informados no Texto.\r\n\r\n" + E.Message + "\r\n"); } return Linha; };
DWORD WINAPI CommMonitor( LPSTR lpData) { CommData SYSTEMTIME SystemTime; int i,nItemCount,nPackLen=0; BYTE PackFun ; BOOL OddFlag=FALSE; LPSTR lpPointer,lptemp1,lptemp2,hRXBuffer=(LPSTR)RxBuffer; char *p_ACK1="\x10\x31"; char *p_ACK0="\x10\x30"; Init() ResetOpPointer() ResetRxPointer() nItemCount =0; FillDevName() SetCommWaitMask(EV_RXFLAG) PurgeComm( hComm, PURGE_RXCLEAR ); while (TRUE) { WaitEvent(EV_RXFLAG) GetInQueueLength(dwReadLength) ReadCommBlock(dwReadLength) lptemp1=strbchrnb(lpRxPointer,'[',1,(int)dwReadLength+5); PackFun= *(lptemp1+c_FuncNumOff); { case '0': case 'D': ResetRxPointer() ResetOpPointer() continue; case '1': if (lptemp1!=lpOpPointer) { for (i=0;*hRXBuffer!='[';hRXBuffer++,i++); memmove(lpOpPointer ,hRXBuffer , (int)(lpRxPointer-hRXBuffer)); lpRxPointer=lpRxPointer-i; hRXBuffer=(LPSTR)RxBuffer; } continue; case '5': if ((*lpOpPointer)!='[') { for (i=0;*hRXBuffer!='[';hRXBuffer++,i++); memmove(lpOpPointer ,hRXBuffer , (int)(lpRxPointer-hRXBuffer)); lpRxPointer=lpRxPointer-i; hRXBuffer=(LPSTR)RxBuffer; continue; case '9': break; default : continue; } wSampleID =(int)StrToInt(lpOpPointer+7,5); GetLocalTime(&SystemTime); lpPointer=strchrnb(lpOpPointer+1,'[',2,70); while(*(lpPointer+2)=='2') { FillSampleID(nItemCount, wSampleID) lptemp1=strchrnb(lpPointer,',',1,4)+1; lptemp2=strchrnb(lptemp1,',',1,5); FillItemName(nItemCount, lptemp1,(lptemp2-lptemp1)) lptemp1=strchrnb(lptemp2+1,',',2,20)+1; for (;*lptemp1==' ';lptemp1++); lptemp2=strchrnb(lptemp1,',',1,10); FillResult(nItemCount,lptemp1,(int)(lptemp2-lptemp1)) FillDate(nItemCount, SystemTime.wYear, SystemTime.wMonth, SystemTime.wDay, SystemTime.wHour) lpPointer=strchrnb(lptemp2+1,'[',1,40); nItemCount++; } if(nItemCount>0) { (*lpResultProcessRoutine)(lpDevice->nDevNO, OutResult, nItemCount); lpDevice->dwRecordCount+=nItemCount; } nItemCount=0; // nPackLen=0; ResetRxPointer() ResetOpPointer() hRXBuffer=(LPSTR)RxBuffer; } return TRUE; } // end of CommWatchProc() void WINAPI BeforeSetCommState(DCB *pComDcb) { pComDcb->EvtChar ='['; }
void __fastcall TfrmMain::txt_key4Change(TObject *Sender) { AutoKey_Skill_Time[3] = StrToInt(txt_key4->Text); }
void __fastcall TfrmMain::txt_pickChange(TObject *Sender) { AutoKey_Pick_Time = StrToInt(txt_pick->Text); }
void __fastcall TfrmMain::txt_attChange(TObject *Sender) { AutoKey_Att_Time = StrToInt(txt_att->Text); }
DWORD WINAPI CommMonitor( LPSTR lpData) { //监控串口接收数据,并完成数据格式分析,将结果放入结果队列 int nItemCount,SampleIDLen,nDataOff,nResultLen,iSampleID; bool bLogFile; char TempWorkingID[7]; LPSTR lpPointer; //应答包 char * p_Ack="\x2\x6\x3"; char * p_Nak="\x2\x16\x3"; char * p_IntSessionTXT="\x2I\x20\x3"; char * p_ReleaseMaster="\x2M\x20\x20\x20\x20\x20\x3"; char PackageType; char SampleID[10]; SYSTEMTIME SystemTime; CommData //通信类型1'、1''、2、3、4、5 Init() ResetOpPointer() FillDevName() SetCommWaitMask(EV_RXFLAG) PurgeComm( hComm, PURGE_RXCLEAR ); memset(lpOpPointer , 0, c_RxBufferLength ); if(NewLogFile("AEROSET.txt")) { bLogFile=TRUE; } while (TRUE) { WaitEvent(EV_RXFLAG)//等待接受数据包 GetInQueueLength(dwReadLength)//分析数据 ReadCommBlock(dwReadLength) PackageType=*(lpOpPointer+1);//数据包的类型 if(bLogFile) { WriteLogData(hLogFile,lpOpPointer,dwReadLength); } //校验接收到的数据,若正确,则处理,否则给否定应答。 /* checksum calculation */ /*结果的数据块中可能包含病人信息、ID信息、结果数据等组。*/ PackageType=*(lpOpPointer+1); switch(PackageType) { case 'Q': WriteCommBlock(p_Ack,3)//肯定应答 //WriteCommChar(ACK) break; case 'R': //结果处理 WriteCommBlock(p_Ack,3)//肯定应答 iSampleID=StrToInt(lpOpPointer+c_SampleIDOff,c_SamlpeIDLen); itoa(iSampleID,&SampleID[0],10); SampleIDLen=strlen(SampleID); TempWorkingID[0]=lpDevice->DevItemType; if(SampleIDLen>=6) { strncpy(&TempWorkingID[1],&SampleID[SampleIDLen-5],5); } else strncpy(&TempWorkingID[6-SampleIDLen],SampleID,SampleIDLen); TempWorkingID[6]='\0'; GetLocalTime(&SystemTime); nItemCount=0; for(nDataOff =c_DataOff; *(lpOpPointer+nDataOff)!=ETB ;) { strncpy(OutResult[nItemCount].WorkingID,TempWorkingID,7); OutResult[nItemCount].ItemNo=nItemCount+1; lpPointer=lpOpPointer+nDataOff; DeleSpace(4) strncpy(OutResult[nItemCount].ItemID,lpPointer,nResultLen); OutResult[nItemCount].ItemID[nResultLen]='\0'; lpPointer=lpOpPointer+nDataOff+c_ResultOff; DeleSpace(c_ResultLen ) FillResult(nItemCount, lpPointer ,nResultLen ) FillDate(nItemCount, SystemTime.wYear, SystemTime.wMonth, SystemTime.wDay, SystemTime.wHour,SystemTime.wMinute,SystemTime.wSecond) nDataOff = nDataOff + c_OneDataLen; nItemCount++; } if(nItemCount>0) { (*lpResultProcessRoutine)(lpDevice->nDevNO, OutResult, nItemCount); lpDevice->dwRecordCount+=nItemCount; } //WriteCommChar(ACK) /// WriteCommBlock(p_Ack,3)//肯定应答 break; case ACK: case NAK: break; } ResetRxPointer() } if(bLogFile) { CloseLogFile(hLogFile); } return TRUE; } // end of CommWatchProc()
//--------------------------------------------------------------------------- bool TContrastEnhanceForm1::Load_CEini(String Fpath) { long lSize; char *Buffer; FILE *fptr; if ((fptr = fopen(Fpath.c_str(), "r")) == NULL) return 0; // obtain file size: fseek(fptr, 0, SEEK_END); lSize = ftell(fptr); rewind(fptr); // allocate memory to contain the whole file: Buffer = (char *) malloc(sizeof(char) * lSize); if (Buffer == NULL) return 0; // copy the file into the buffer: fread(Buffer, 1, lSize, fptr); fclose(fptr); //------------Load CE value to interface----------------------------- AnsiString Str[29]; //CheckBox Str[0] = "SPRS_BLK1"; Str[1] = "SPRS_BLK0"; Str[2] = "PURITYWT_EN"; Str[3] = "GRAD_EN"; Str[4] = "FASTCHG_EN"; Str[5] = "MLC_EN"; //ComboBox Str[6] = "MAXLIMT_SEL"; Str[7] = "PIXHIST_SEL"; Str[8] = "LOWST_SEL"; Str[9] = "JND_SEL"; Str[10] = "ST_SEL"; //ScrollBar Str[11] = "GRAD_GMA_STEP"; Str[12] = "GRAD_FRM_STEP"; Str[13] = "GRAD_PIXDIFF_THR"; Str[14] = "STRENGTH_K"; Str[15] = "MIN_EDGE"; Str[16] = "PIX_DIFF_THR"; Str[17] = "EDG_DIFF_THR"; Str[18] = "MLC_THR"; Str[19] = "PATDET_FRM_NUM"; Str[20] = "PATDET_LINE_NUM"; Str[21] = "JND_MAX"; Str[22] = "JND_MIN"; Str[23] = "ST_MAX"; Str[24] = "ST_MIN"; //Table Str[25] = "JND_LUT"; Str[26] = "ST_LUT"; Str[27] = "MAX_LUT"; Str[28] = "MIN_LUT"; char *buffer; char *pch; bool match = false; //CheckBox for (int i = 0; i < 25; i++) { match = false; buffer = (char *) malloc(sizeof(char) * lSize); strncpy(buffer, Buffer, lSize); pch = strtok(buffer, "\n\t"); while (!SameText((AnsiString) pch, Str[i])) { if (pch == NULL) { ShowMessage("Can't Find" + Str[i]); return 0; //資料中沒有 } pch = strtok(NULL, "\n\t"); } pch = strtok(NULL, "\n\t"); for (int j = 0; j < OCE->CEChkBox_Nbr; j++) { if (SameText(Str[i], ChkB[j]->Addr.Name())) { ChkB[j]->Chkb->Checked = (StrToInt(pch) == 1 ? 1 : 0); match = true; break; } } if (!match) { for (int j = 0; j < OCE->CECboBox_Nbr; j++) { if (SameText(Str[i], CboB[j]->Addr.Name())) { CboB[j]->Cbob->ItemIndex = StrToInt(pch); match = true; break; } } } if (!match) { for (int j = 0; j < OCE->CEScrollBar_Nbr; j++) { if (SameText(Str[i], ScrlB[j]->Addr.Name())) { ScrlB[j]->ScrlB->Position = StrToInt(pch); break; } } } delete[]buffer; } //-----------------LUT------------------------------ for (int i = 0; i < 16; i++) { JND_lut[i] = 0; ST_lut[i] = 0; MAX_lut[i] = 0; MIN_lut[i] = 0; } char *str[4]; str[0] = "JND_LUT"; str[1] = "ST__LUT"; str[2] = "MAX_LUT"; str[3] = "MIN_LUT"; for (int i = 0; i < 4; i++) { buffer = (char *) malloc(sizeof(char) * lSize); strncpy(buffer, Buffer, lSize); pch = strtok(buffer, "\n\t"); while (SameText((AnsiString) pch, str[i]) != 1) { if (pch == NULL) return 0; pch = strtok(NULL, "\n\t"); } int c = 0; pch = strtok(NULL, "\n\t"); while (c < 16 && pch != NULL) { if (pch == NULL) return 0; //資料中的data缺少 if (i == 0) JND_lut[c] = StrToInt((AnsiString) pch); else if (i == 1) ST_lut[c] = StrToInt((AnsiString) pch); else if (i == 2) MAX_lut[c] = StrToInt((AnsiString) pch); else MIN_lut[c] = StrToInt((AnsiString) pch); pch = strtok(NULL, "\n\t"); c++; } delete[]buffer; } delete[]Buffer; for (int i = 0; i < 16; i++) { sg_JND_LUT->Cells[i][0] = JND_lut[i]; sg_ST_LUT->Cells[i][0] = ST_lut[i]; sg_MAX_LUT->Cells[i][0] = MAX_lut[i]; sg_MIN_LUT->Cells[i][0] = MIN_lut[i]; } return 1; }
void COptionsDialog::OnOK() { if (!UpdateData(TRUE)) { TRACE0("UpdateData failed during dialog termination.\n"); // the UpdateData routine will set focus to correct item return; } CGeneralManager * m = ((CReportAsistentApp *) AfxGetApp())->m_pGeneralManager; CString Pom; int iPom; CUT_Hint oHint; CReportAsistentApp * App = ((CReportAsistentApp *) AfxGetApp()); //dedek: WordTemplate m->WordManager.setWordTemplate(m_strWordTemplate); //Get Language radio buttons if (GetCheckedRadioButton(IDC_CZECH_RADIO, IDC_ENGLISH_RADIO) == IDC_ENGLISH_RADIO) m->setLanguage("en"); else m->setLanguage("cz"); //Get Tree Items //Height Edit m_HeightEdit.GetWindowText(Pom); iPom = StrToInt((LPCTSTR)Pom); if ((iPom > 15) && (iPom<= 50)) App->m_iTreeItemHeight = iPom; //Indent Edit m_IndentEdit.GetWindowText(Pom); iPom =StrToInt((LPCTSTR)Pom); if ((iPom > 15) && (iPom<= 50)) App->m_iTreeItemIndent = iPom; App->m_bTreeHasLines = m_LinesCheckBox.GetCheck(); App->m_bIdInItemName = m_IdInTreeCheckBox.GetCheck(); App->m_bTreeHasButtons = m_ButtonsCheckBox.GetCheck(); //Name Length Edit m_NameLengthEdit.GetWindowText(Pom); iPom =StrToInt((LPCTSTR)Pom); if ((iPom > 5) && (iPom<= 999)) App->m_iTreeItemNameLength = iPom; //TextEdit size Edit m_TextEditSize.GetWindowText(Pom); iPom =StrToInt((LPCTSTR)Pom); if ((iPom > 80) && (iPom<= 300)) App->m_iTextEditSize = iPom; //Get orphans radio buttons: CString OrphSol = App->FirstDocumentInFirstTemplate()->GetReportSettings("orphans_solution"); switch (GetCheckedRadioButton(IDC_IGNORE_RADIO, IDC_SET_DEFAULT_RADIO)) { case IDC_IGNORE_RADIO: App->FirstDocumentInFirstTemplate()->SetReportSettings("orphans_solution","ignore"); break; case IDC_DELETE_RADIO: App->FirstDocumentInFirstTemplate()->SetReportSettings("orphans_solution","delete"); break; case IDC_SET_DEFAULT_RADIO: App->FirstDocumentInFirstTemplate()->SetReportSettings("orphans_solution","set_default"); break; } //get mark orphans BOOL bChecked = App->m_bMarkOrphans; App->m_bMarkOrphans = m_MarkOrphansCheckBox.GetCheck(); if (bChecked ==App->m_bMarkOrphans) oHint.iMarkOrphans = 0; else if (bChecked == 0) oHint.iMarkOrphans = ORP_SIGN; else oHint.iMarkOrphans = ORP_UNSIGN; //dedek: jazyk App->FirstDocumentInFirstTemplate()->SetReportSettings("language", m->getLanguage()); //Apply changes App->FirstDocumentInFirstTemplate()->SetModifiedFlag(); App->FirstDocumentInFirstTemplate()->UpdateAllViews(NULL, UT_SETTINGS, &oHint); EndDialog(IDOK); }
void __fastcall TForm1::Button6Click(TObject *Sender) { ServerSocket1->Port=StrToInt(Edit1->Text); }
/********************************************************************************** * 返回LEVEL的ics的check过滤函数 * params: ics_info * return: int */ int RobRuleValid::ProCheckRoleLevel(Rob_Ics_Complaint& info) { return (StrToInt(info.sRoleLevel) < StrToInt(CRobConf::getConf()->GetIcsValid()["role_level"]))?1:0; }
void AddAttr(string const & attribute, string const & value) { if (m_ready) { if (attribute == "id") m_id = StrToInt(value); else if (attribute == "x") m_x = static_cast<uint16_t>(StrToInt(value)); else if (attribute == "y") m_y = static_cast<uint16_t>(StrToInt(value)); else if (attribute == "width") m_width = static_cast<uint16_t>(StrToInt(value)); else if (attribute == "height") m_height = static_cast<uint16_t>(StrToInt(value)); else if (attribute == "xoffset") m_xOffset = static_cast<int8_t>(StrToInt(value)); else if (attribute == "yoffset") m_yOffset = static_cast<int8_t>(StrToInt(value)); else if (attribute == "xadvance") m_xAdvance = static_cast<int8_t>(StrToInt(value)); } else { if (attribute == "base") m_baseline = StrToInt(value); else if (attribute == "scaleW") m_scaleW = StrToInt(value); else if (attribute == "scaleH") m_scaleH = StrToInt(value); } }
/** receive_doble天内重复来单不受理; 普通用户暂定为180天,VIP为90天 * params: ics_info * return: int */ int RobRuleValid::ProCheckDobleQuest(Rob_Ics_Complaint &info) { //此处需要详细的规划下,暂时不处理 //select count(*) as applyValueCount from tbICSComplaint where TO_DAYS(now())-TO_DAYS(dtBookTime)<=60 // and iUin='732945415' and iRoleID='12306'; // map<string,string> theParamIn; theParamIn.clear(); theParamIn["uin"] = info.sUin; theParamIn["role_id"] = info.sRoleID; theParamIn["apply_day_in"] = CRobConf::getConf()->GetIcsValid()["receve_double"]; theParamIn["service_id"] = info.sServiceID; theParamIn["role_id"] = info.sRoleID; vector< map<string,string> > base_result; if(0 != valid_parse.GetFunction(ics_log_header(info.sICSId,info.sUin,info.sServiceID),\ theParamIn,"ics_apply_repeat_uin",base_result)) { ValidLOG->WriteLog("In Valid Proccess, Find Uin 'get_ics_info_by_uin' happened error,not find info\n"); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, info.sICSId.c_str(), info.sUin.c_str(), TLOG_LEVEL_ERROR, __FUNCTION__, "In Valid Proccess, Find Uin 'get_ics_info_by_uin' happened error,not find info\n" ); return STEP_FLITER_RUN_STAT_ERROR_INTERFACE; } int check_flag=0; int check_running_flag=0; int check_false_flag=0; int check_result=0; if(base_result.size()>1) { for(int i=0;i<base_result.size();i++) { ValidLOG->WriteLog("[Info]'ProCheckDobleQuest' Proccessing <%d>&iICSAnaylseResult=<%s>\n",base_result.size(),base_result[i]["iICSAnaylseResult"].c_str()); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, info.sICSId.c_str(), info.sUin.c_str(), TLOG_LEVEL_INFO, __FUNCTION__, "[Info]'ProCheckDobleQuest' Proccessing <%d>&iICSAnaylseResult=<%s>\n",base_result.size(),base_result[i]["iICSAnaylseResult"].c_str() ); //a 如果存在处理成功的---:此单据为异常单据《重复单据》 if(StrToInt(base_result[i]["iICSAnaylseResult"])>=STEP_ITEMFSEND_RUN_RESULT_TURE) { ValidLOG->WriteLog("[Info] [RobRuleValid::ProCheckDobleQuest] Get The Fromer icsID Result<%s>, Process Pass Fliter Ok, So Not Pass It\n",base_result[i]["iICSAnaylseResult"].c_str()); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, info.sICSId.c_str(), info.sUin.c_str(), TLOG_LEVEL_INFO, __FUNCTION__, "[Info] [RobRuleValid::ProCheckDobleQuest] Get The Fromer icsID Result<%s>, Process Pass Fliter Ok, So Not Pass It\n",base_result[i]["iICSAnaylseResult"].c_str() ); return STEP_FLITER_RUN_STAT_ERROR_APPLY_AGAIN; } //a.1 如果存在在阶段的处理的流程中的单据 if(StrToInt(base_result[i]["iICSAnaylseResult"])>=STEP_FLITER_RUN_RESULT_TURE&&StrToInt(base_result[i]["iICSAnaylseResult"])<STEP_ITEMFSEND_RUN_RESULT_TURE) { ValidLOG->WriteLog("[Info] [RobRuleValid::ProCheckDobleQuest] Runing AND False=[%s]\n",base_result[i]["iICSAnaylseResult"].c_str()); if(StrToInt(base_result[i]["iICSAnaylseResult"])==STEP_ROBSLOT_RUN_RESULT_FALSE||\ StrToInt(base_result[i]["iICSAnaylseResult"])==STEP_ITEMFLOW_RUN_RESULT_FALSE||\ StrToInt(base_result[i]["iICSAnaylseResult"])==STEP_ITEMFTRACE_RUN_RESULT_FALSE||\ StrToInt(base_result[i]["iICSAnaylseResult"])==STEP_ITEMFSEND_RUN_RESULT_FALSE){ check_false_flag++; ValidLOG->WriteLog("[Info] [RobRuleValid::ProCheckDobleQuest] False=%s&check_false_flag=%d\n",base_result[i]["iICSAnaylseResult"].c_str(),check_false_flag); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, info.sICSId.c_str(), info.sUin.c_str(), TLOG_LEVEL_INFO, __FUNCTION__, "[Info] [RobRuleValid::ProCheckDobleQuest] False=%s&check_false_flag=%d\n",base_result[i]["iICSAnaylseResult"].c_str(),check_false_flag ); } else { check_result++; ValidLOG->WriteLog("[Info] [RobRuleValid::ProCheckDobleQuest] Running=%s&check_result=%d\n",base_result[i]["iICSAnaylseResult"].c_str(),check_result); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, info.sICSId.c_str(), info.sUin.c_str(), TLOG_LEVEL_INFO, __FUNCTION__, "[Info] [RobRuleValid::ProCheckDobleQuest] Running=%s&check_result=%d\n",base_result[i]["iICSAnaylseResult"].c_str(),check_result ); } } //a.2 如果存在在一次处理多的单据 if(StrToInt(base_result[i]["iICSAnaylseStat"])==STEP_FLITER_RUNNING_STAT) { check_running_flag++; ValidLOG->WriteLog("[Info] [RobRuleValid::ProCheckDobleQuest] LOT APPLY=%d",check_running_flag); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, info.sICSId.c_str(), info.sUin.c_str(), TLOG_LEVEL_INFO, __FUNCTION__, "[Info] [RobRuleValid::ProCheckDobleQuest] LOT APPLY=%d",check_running_flag ); } } //如果存在各阶段处理中的单据 if(check_result>0) { return STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT; } //如果所有的单据的都是在第一个阶段的单据 if(check_running_flag>1) { ValidLOG->WriteLog("[Info] [RobRuleValid::ProCheckDobleQuest] STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT,So Pass Last It ,check_flag=<%d>\n",check_running_flag); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, info.sICSId.c_str(), info.sUin.c_str(), TLOG_LEVEL_WARNING, __FUNCTION__, "[Info] [RobRuleValid::ProCheckDobleQuest] STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT,So Pass Last It ,check_flag=<%d>\n",check_running_flag ); return STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT; } else if(check_running_flag==1) { ValidLOG->WriteLog("[Info] [RobRuleValid::ProCheckDobleQuest] STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT,So I am The Last One ,check_flag=<%d>\n",check_running_flag); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, info.sICSId.c_str(), info.sUin.c_str(), TLOG_LEVEL_INFO, __FUNCTION__, "[Info] [RobRuleValid::ProCheckDobleQuest] STEP_FLITER_RUN_STAT_ERROR_APPLY_LOT,So I am The Last One ,check_flag=<%d>\n",check_running_flag ); return 0; } return 0;//其它情况 返回正常 } else if(base_result.size()==1) { ValidLOG->WriteLog("[Info] [RobRuleValid::ProCheckDobleQuest] The Fisrt Processing Only One, So Pass It\n"); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, info.sICSId.c_str(), info.sUin.c_str(), TLOG_LEVEL_INFO, __FUNCTION__, "[Info] [RobRuleValid::ProCheckDobleQuest] The Fisrt Processing Only One, So Pass It\n" ); return 0; } else { ValidLOG->WriteLog("[Info] [RobRuleValid::ProCheckDobleQuest] The <ics_apply_repeat_uin> Processing Interface Error\n"); WriteLogsRUN(TLOG_TYPE_ROBANLYSVALID, info.sICSId.c_str(), info.sUin.c_str(), TLOG_LEVEL_ERROR, __FUNCTION__, "[RobRuleValid::ProCheckDobleQuest] The <ics_apply_repeat_uin> Processing Interface Error" ); return STEP_FLITER_RUN_STAT_ERROR_INTERFACE; } }
unsigned int NH_IRC::HandleMessage(unsigned int handler_id, char *buffer, long int buf_size){ if (!buffer) return handler_id; char message[256]; std::string AllMessages; std::string OutString; if (buffer) buffer[buf_size]='\0'; AllMessages=cut_buffer+buffer; std::string Message; int pos=0; //главный цикл std::string Nick=""; std::string User=""; std::string Host=""; std::string Action=""; std::string Other=""; std::vector<std::string> Params; //std::string Sender=""; //std::string Params=""; //std::string Params2=""; bool automated = true; // надо ли вызывать Custom-обработчик или обошлись своими силами while (pos!=-1) { pos=AllMessages.find_first_of("\n"); if (pos!=-1) { Message = AllMessages.substr(0,pos-1); AllMessages=AllMessages.substr(pos+1,AllMessages.length()-pos+1); } else Message=""; if (Message.length()==0) continue; // ((CEventLog *)MegaBase->GetVoidParam("EventLog"))->ExtLogMsg(ExtLogName,"---Message---"); // ((CEventLog *)MegaBase->GetVoidParam("EventLog"))->ExtLogMsg(ExtLogName,(char*)(">"+Message+"<").c_str()); // ((CEventLog *)MegaBase->GetVoidParam("EventLog"))->ExtLogMsg(ExtLogName,"---End Message---"); printf("---Message---\n"); printf("%s\n",Message.c_str()); printf("---End Message---\n"); // первоначальная стадия if (handler_id==0) { //SendMessage(";","NICK "+LoginName+"\nUSER AmberNetVR Amber server :"+GetParam("UserName")+"\n"); std::string send="NICK "+std::string(GetParam("NickName"))+"\nUSER "+std::string(GetParam("UserName"))+" "+std::string(GetParam("HostName"))+" "+GetParam("ServerName")+" :"+GetParam("RealName")+"\n"; //SendMessage(";",send); Send("NICK","server", std::string(GetParam("NickName")).c_str() ); Send("USER","server", ASN_Str( std::string(GetParam("UserName"))+" "+std::string(GetParam("HostName"))+" "+GetParam("ServerName")+" :"+GetParam("RealName")).c_str() ); handler_id=1; //continue; }; if (Message.substr(0,4) == "PING"){ // получили ПИНГ Send("PONG","server",Message.substr(6,Message.length()-6).c_str()); //SendMessage(";","PONG "+Message.substr(6,Message.length()-6)+"\n"); std::string OutText="NH_IRC: PING-PONG..."; //LOGGER->ExtLogMsg(ExtLogName, IntToStr( Message.length()) + OutText ); automated=false; continue; }; if (Message.at(0)==':'){ // (nick!user@host) int tmp_pos=Message.find_first_of(" !",1); if (tmp_pos==-1) {continue;} else { Nick=Message.substr(1,tmp_pos-1); Message=Message.substr(tmp_pos); // printf("Nick: >%s<\n",Nick.c_str()); Params.push_back( Nick ); // Params[0] - Nick if(Message.at(0)=='!') { //только если это не просто ник, а nick!user@host - имеет смысл разбирать дальше int tmp_pos=Message.find_first_of(" @",1); if (tmp_pos==-1) {} else { User=Message.substr(1,tmp_pos-1); Message=Message.substr(tmp_pos); // printf("User: >%s<\n",User.c_str()); if(Message.at(0)=='@') { //только если это не просто ник, а nick!user@host - имеет смысл разбирать дальше int tmp_pos=Message.find_first_of(" ",1); if (tmp_pos==-1) {} else { Host=Message.substr(1,tmp_pos-1); Message=Message.substr(tmp_pos); // printf("Host: >%s<\n",Host.c_str()); }; }; }; }; //if(Message.at(0)=="!") }; }; //if (Message.at(0)==':'){ Message=Message.substr(1); int tmp_pos=Message.find_first_of(" ",1); if (tmp_pos!=-1){ Action=Message.substr(0,tmp_pos); if (irc_cd.find(Action)!=irc_cd.end()) Action=irc_cd[Action]; Message=Message.substr(tmp_pos+1); //printf("Action: >%s<\n",Action.c_str()); Params.push_back( Action ); // Params[1] - Action } Other=Message; while (Message.size()>0){ if (Message.at(0)==':'){ Params.push_back( Message.substr(1) ); // printf("Params >%s<\n",Params.c_str()); Message="";//Message.substr(tmp_pos+1); break; } else { int tmp_pos=Message.find_first_of(" ",1); if (tmp_pos==-1) { Params.push_back( Message ); Message=""; break; }; Params.push_back( Message.substr(0,tmp_pos) ); Message=Message.substr(tmp_pos+1); }; //printf("Params >%s<\n",Params.c_str()); }; //while (Message.size>0) // если уже зашли под таким ником - приделываем палочки к нику, // а если и это не помогло - прибавляем к нику цифру if (Action=="ERR_NICKNAMEINUSE"){ NumTryConnect++; std::string NickName=GetParam("NickName"); if (NumTryConnect==1) { NickName=NickName+"_"; } else if (NumTryConnect==2) { NickName="_"+NickName; } else { NickName=NickName+IntToStr( NumTryConnect ); }; SetParam("NickName", NickName.c_str() ); Send("NICK","server", NickName.c_str() ); } else // проверка на CTCP if ( Params[1]=="PRIVMSG" ) { std::string par1=Params[3]; printf("{%s}\n",par1.c_str()); if (par1.at(0)=='\001') { /// это ж у нас CTCP ! par1=par1.substr(1); // отделяем признак CTCP в начале int tmp_pos=par1.find_first_of('\001',1); if (tmp_pos==-1) break; par1=par1.substr(0,tmp_pos); // отделяем признак CTCP в конце std::string CTCP_type=par1; tmp_pos=par1.find_first_of(' ',1); std::string par2=par1.substr(tmp_pos+1); if (tmp_pos!=-1) CTCP_type=par1.substr(0,tmp_pos); // если это например PING, отделяем всё остальное printf("{CTCP: %s}\n",CTCP_type.c_str()); Params.pop_back(); Params.push_back( CTCP_type ); Params.push_back( par2 ); // if (CTCP_type=="ACTION") { // printf("AC-Ti-i-i-iooonn!!!!\n"); // Send("NOTICE","server",Nick+" :\001ACTION внимательно наблюдает \001"); // automated=false; // } // else if (CTCP_type=="USERINFO") { // SendMessage(";","NOTICE "+Nick+" :\001USERINFO "+GetParam("USERINFO")+"\001"); Send("NOTICE","server",ASN_Str(Nick+" :\001USERINFO "+GetParam("USERINFO")+"\001").c_str()); automated=false; } else if (CTCP_type=="VERSION") { // SendMessage(";","NOTICE "+Nick+" :\001VERSION "+GetParam("VERSION")+"\001"); Send("NOTICE","server",ASN_Str( Nick+" :\001VERSION "+GetParam("VERSION")+"\001" ).c_str() ); automated=false; } else if (CTCP_type=="PING") { // хотя в документации написано, что ответ должен быть PONG !!!! :/ // <marker> PONG <space> <arg> <marker> tmp_pos=par1.find_first_of(' ',1); // SendMessage(";","NOTICE "+Nick+" :\001PING "+par1.substr(tmp_pos+1,Message.length()-tmp_pos-1)+"\001"); Send("NOTICE","server",ASN_Str(Nick+" :\001PING "+par1.substr(tmp_pos+1,Message.length()-tmp_pos-1)+"\001").c_str() ); automated=false; } else if (CTCP_type=="TIME") { static char time_buffer[ 1024 ]; time_t time_of_day=time(NULL); strftime( time_buffer, 80, "%d %H:%M:%S %Z %Y", localtime( &time_of_day ) ); // SendMessage(";","NOTICE "+Nick+" :\001TIME "+std::string(time_buffer)+"\001"); Send("NOTICE","server",ASN_Str(Nick+" :\001TIME "+std::string(time_buffer)+"\001").c_str()); automated=false; } else if (CTCP_type=="DCC") { std::string DCC_type; tmp_pos=par1.find_first_of(' ',1); par1=par1.substr(tmp_pos+1); // отрезаем команду DCC tmp_pos=par1.find_first_of(' ',1); if (tmp_pos!=-1) DCC_type=par1.substr(0,tmp_pos); par1=par1.substr(tmp_pos+1); printf("DCC type: {%s}\n",DCC_type.c_str()); if (DCC_type=="CHAT") { tmp_pos=par1.find_first_of(' ',1); std::string dcc_Protocol=par1.substr(0,tmp_pos); par1=par1.substr(tmp_pos+1); printf("chat protocol: {%s}\n",dcc_Protocol.c_str()); if (dcc_Protocol=="chat") { // обычный dcc чат-протокол tmp_pos=par1.find_first_of(' ',1); std::string rawIP=par1.substr(0,tmp_pos); // printf( "Raw IP: %s\n",rawIP.c_str() ); unsigned int t; sscanf(rawIP.c_str(),"%u",&t); // printf( "Start IP: %u\n", t); std::string inetIP = IntToIP ( t /*StrToInt(rawIP)*/ ); par1=par1.substr(tmp_pos+1); tmp_pos=par1.find_first_of(' ',1); std::string Port=par1.substr(0,tmp_pos); printf("{%s}:{%d}\n", inetIP.c_str() , StrToInt(Port) ); // INetProtocolHandler *tmp=NETTER->OpenClientListener( std::string(GetParam("ServerName"))+"_"+Nick+"_DCC","IRC_DCC_CHAT",inetIP,StrToInt(Port),"",""); INetProtocolHandler *tmp = new NH_IRC_DCC_CHAT( Engine ); // NETTER->AddCustomListener( tmp, inetIP.c_str() , StrToInt(Port) ); tmp->SetPtrParam("Handler",CustomHandler); tmp->SetParam("UserName",Nick.c_str()); // printf("dcc: %s", std::string( std::string(GetParam("ServerName"))+"_"+Nick+"_DCC" ).c_str() ); // SetPtrParam("); }; }; // if (DCC_type=="CHAT") if (DCC_type=="SEND") { std::string SendFile; // printf("par1=%s\n",par1.c_str() ); if (par1[0]=='"') { tmp_pos=par1.find_first_of('"',1); SendFile=par1.substr(1,tmp_pos-1); } else { tmp_pos=par1.find_first_of(' ',1); SendFile=par1.substr(0,tmp_pos); }; printf("SendFile: %s\n",SendFile.c_str()); par1=par1.substr(tmp_pos+1); tmp_pos=par1.find_first_of(' ',1); std::string rawIP=par1.substr(0,tmp_pos); printf("rawIP: %s\n",rawIP.c_str()); unsigned int t; sscanf(rawIP.c_str(),"%u",&t); std::string inetIP = IntToIP ( t ); par1=par1.substr(tmp_pos+1); tmp_pos=par1.find_first_of(' ',1); std::string Port=par1.substr(0,tmp_pos); par1=par1.substr(tmp_pos+1); tmp_pos=par1.find_first_of(' ',1); std::string FileSize=par1.substr(0,tmp_pos); printf("%s try send file {%s} with size %s from %s port: %s\n", Nick.c_str(), SendFile.c_str(), FileSize.c_str(), inetIP.c_str() , Port.c_str() ); INetProtocolHandler *tmp= new NH_IRC_DCC_GETFILE( Engine ); NETTER->AddCustomListener( tmp, inetIP.c_str() , StrToInt(Port) ); tmp->SetPtrParam("Handler",CustomHandler); tmp->SetParam("UserName",Nick.c_str()); tmp->SetParam("FileName",SendFile.c_str()); tmp->SetParam("FileSize",FileSize.c_str()); tmp->SetParam("Port",Port.c_str()); tmp->SetParam("LoadSize","0"); }; // if (DCC_type=="SEND") // std::vector<std::string>::iterator _it=Params.begin(); // while(_it!=Params.end()){ // printf("Param:{%s}\n",(*_it).c_str()); // _it++; // }; automated=false; }; }; }; if (automated) if (CustomHandler) { //SetParam("Nick",Nick.c_str()); //SetParam("Action",Action.c_str()); CALLBACK_PROTOCOL_HANDLER myCustomHandler = (CALLBACK_PROTOCOL_HANDLER)CustomHandler; myCustomHandler(this, &Params); } Params.clear(); }; // while (pos!=-1) cut_buffer=AllMessages.substr(0,AllMessages.length()-1); return handler_id; };
bool keyHistory::testCombo(String c) const { String combo = StringReplace( StringReplace(c," ","",TReplaceFlags()<<rfReplaceAll<<rfIgnoreCase), ".","*",TReplaceFlags()<<rfReplaceAll<<rfIgnoreCase); int _keys [16]; memset(_keys,0,16); int lastkey = 0; TStringList * dcomp = new TStringList(); dcomp->Delimiter = '-'; dcomp->DelimitedText = combo; uint maxLen = StrToInt(dcomp->Strings[0]); combo = dcomp->Strings[1]; bool mode = 0; if (index>8) { int a=2; a = 2+2+a; } for (int i=0; i<combo.Length(); i++) { if (combo.c_str()[i] == '!') { mode = 1; continue; } else if (i!=0) if (combo.c_str()[i-1] != '!') mode = 0; _keys[lastkey] = mode?KEY_UP:KEY_DOWN; if (combo.c_str()[i] == '>') _keys[lastkey] += VK_RIGHT; else if (combo.c_str()[i] == '<') _keys[lastkey] += VK_LEFT; else if (combo.c_str()[i] == '^') _keys[lastkey] += VK_UP; else if (combo.c_str()[i] == '*') _keys[lastkey] += VK_DOWN; else _keys[lastkey] += combo.c_str()[i]; lastkey++; } bool comboFound = false; for (int ki = 0; ki<KH_BUFFER_SIZE+1-lastkey; ki++) { if (getSKey(ki) == 0) break; for (int ci=0; ci<lastkey;ci++) { if (getSKey(ki+ci) != _keys[ci]) { comboFound = false; break; } else if ((ci == lastkey-1) && (getSKey(ki+ci) == _keys[ci])) { if ((keyTime[ki+ci] - keyTime[ki]) < maxLen) if (::GetTickCount()-keyTime[ki+ci] < 1000) { comboFound = true; break; } } } if (comboFound) { int a=2+1; a = a+2; break; } } return comboFound; }
void TFrmMain::SaveToFile(const char * pszFileName) { char szFileName[255]; FILE *stream; fnsplit(pszFileName, 0, 0, szFileName, 0); strcat(szFileName, "_new.dbc"); AnsiString NewFileName=ExtractFilePath(Application->ExeName)+szFileName;//=pszFileName; int iFileHandle; //文件句柄 AnsiString iniSetFile=ExtractFilePath(Application->ExeName)+"BcdEditer.ini"; AnsiString SectionName=ExtractFileName(CurrentOpenFile); DWORD w; CopyFileTo(pszFileName,NewFileName); iFileHandle = FileOpen(NewFileName, fmOpenRead|fmOpenWrite);//打开文件 if ((stream = fopen(CurrentOpenFile.c_str(), "r+")) == NULL) { ShowMessage("打开文件出错"); return; } int iVal; float fVal; bool isFloat; int ColType; FileSeek(iFileHandle,0x14,0); TIniFile *ini; ini = new TIniFile( iniSetFile ); for(int i=1; i<sgEdit->RowCount; i++) { for(int j=1; j<sgEdit->ColCount; j++) { if(j==1){ //ID iVal=StrToInt(sgEdit->Cells[j][i]); FileWrite(iFileHandle, &iVal, 4); }else{ //ColType= ini->ReadInteger(SectionName,"ColType"+IntToStr(j-1),0); //thOpen->ColType[10000]; switch (thOpen->ColType[j]) { case 0: //整型 iVal=StrToFloat(sgEdit->Cells[j][i]); FileWrite(iFileHandle, &iVal, 4); break; case 1: //浮点 fVal=StrToFloat(sgEdit->Cells[j][i]); FileWrite(iFileHandle, &fVal, 4); break; case 2: //文本 fseek(stream, 0x14+(i*(sgEdit->ColCount-1)+(j-1))*4, 0); fread(&iVal, 4, 1, stream); FileWrite(iFileHandle, &iVal, 4); break; default: //整型 iVal=StrToFloat(sgEdit->Cells[j][i]); FileWrite(iFileHandle, &iVal, 4); } } } } FileClose(iFileHandle); fclose(stream); delete ini; ShowMessage("Save To File:"+NewFileName); }
static ssize_t sysfsfuse_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { unsigned int size = 0; NvDdkFuseDataType FuseType; NvError Err; char WriteFuseBuf[BUF_SIZE]; #if SYSFS_FUSE_DEBUG_PRINTS unsigned char i = 0; #endif unsigned char OdmProdFuseVal = 0; OdmProdFuseVal = OdmProductionFuseVal(); if(OdmProdFuseVal == 1) { PRINT_FUSE(("\r\n ODM production fuse is already blown\n")); return -EINVAL; } FuseType = GetFuseType(attr->attr.name, &size); // As count includes data bytes followed by 0xA (line feed character) // and two chars can be stored in a fuse byte if ((count - 1) > (2 * size)) { PRINT_FUSE(("\r\n Requested data size[%d] > fuse size [%d]\n",count/2,size)); return -EINVAL; } if (buf != NULL) { StrToInt(buf, WriteFuseBuf, (count - 1), size); } else printk("\r\n buf is NULL"); PRINT_FUSE(("\r\n Input string: %s", buf)); PRINT_FUSE(("\n Fuse data of size [%d] to write\n", size)); #if SYSFS_FUSE_DEBUG_PRINTS for (i = 0; i < size; i++) PRINT_FUSE(("0x%x\n",WriteFuseBuf[i])); #endif NvDdkFuseClear(); Err = NvDdkFuseSet(FuseType, WriteFuseBuf, &size); if (Err == NvSuccess) { NvDdkFuseProgram(); NvDdkFuseSense(); NvDdkFuseVerify(); } else { PRINT_FUSE(("\r\n Fuse programming failed with error 0x%x",Err)); } if (Err == NvSuccess) { // if ODM production fuse is blown, change file permissions to 0440 if (FuseType == NvDdkFuseDataType_OdmProduction) { sysfs_chmod_file(kobj, &attr->attr, 0440); sysfs_chmod_file(kobj, &nvfuse_DeviceKey_attr.attr, 0440); sysfs_chmod_file(kobj, &nvfuse_JtagDisable_attr.attr, 0440); sysfs_chmod_file(kobj, &nvfuse_OdmProduction_attr.attr, 0440); sysfs_chmod_file(kobj, &nvfuse_SecBootDeviceConfig_attr.attr, 0440); sysfs_chmod_file(kobj, &nvfuse_SecBootDeviceSelect_attr.attr, 0440); sysfs_chmod_file(kobj, &nvfuse_SecureBootKey_attr.attr, 0440); sysfs_chmod_file(kobj, &nvfuse_SwReserved_attr.attr, 0440); sysfs_chmod_file(kobj, &nvfuse_SkipDevSelStraps_attr.attr, 0440); sysfs_chmod_file(kobj, &nvfuse_SecBootDeviceSelectRaw_attr.attr, 0440); sysfs_chmod_file(kobj, &nvfuse_ReservedOdm_attr.attr, 0440); } PRINT_FUSE(("\r\n fuse set success \n")); } else { PRINT_FUSE(("\r\n fuse set failed Err: 0x%x\n", Err)); return -EFAULT; } return count; }
void __fastcall TFrmMain::btColSaveClick(TObject *Sender) { if(OpenOk==false) return; int iFileHandle; //文件句柄 char Txtbuf[255]; int iVal; char buf[4]; float fVal; FILE *stream; long curpos, length; DWORD dwRows, dwCols, dwRowLen, dwTextLen; DWORD dwTextStartPos; char* pTextPtr ; iFileHandle = FileOpen(CurrentOpenFile, fmOpenRead|fmOpenWrite);//打开文件 //if ((stream = fopen(CurrentOpenFile.c_str(), "r+")) // == NULL) //{ // ShowMessage("打开文件出错"); // return; //} //curpos = ftell(stream); //fseek(stream, 0L, SEEK_END); //length = ftell(stream); switch (thOpen->ColType[sgEdit->Col]) { case 0: //整型值 for(int i=0;i<sgEdit->RowCount-1;i++){ //fseek(stream, 0x14+(i*(sgEdit->ColCount-1)+(sgEdit->Col-1))*4, 0); //iVal=StrToInt(sgEdit->Cells[sgEdit->Col][i+1]); //fwrite(&iVal, 4, 1, stream); iVal=StrToInt(sgEdit->Cells[sgEdit->Col][i+1]); memcpy(buf, &iVal, 4); FileSeek(iFileHandle,0x14+(i*(sgEdit->ColCount-1)+(sgEdit->Col-1))*4,0); FileWrite(iFileHandle,buf,4); } break; case 1: //浮点值 for(int i=0;i<sgEdit->RowCount-1;i++){ //fseek(stream, 0x14+(i*(sgEdit->ColCount-1)+(sgEdit->Col-1))*4, 0); //fVal=StrToFloat(sgEdit->Cells[sgEdit->Col][i+1]); //fwrite(&fVal, 4, 1, stream); fVal=StrToFloat(sgEdit->Cells[sgEdit->Col][i+1]); memcpy(buf, &fVal, 4); FileSeek(iFileHandle,0x14+(i*(sgEdit->ColCount-1)+(sgEdit->Col-1))*4,0); FileWrite(iFileHandle,buf,4); } break; case 2: //文本 不存 break; } //fclose(stream); FileClose(iFileHandle); ShowMessage("The "+IntToStr(sgEdit->Col)+"Col Write Ok!"); }
void __fastcall TCZYJSQFrm::QueryBTNClick(TObject *Sender) { if(JSBeginDateEdit->Text.IsEmpty()||JSEndDateEdit->Text.IsEmpty()) { ShowMessage("必须完整填写查询信息!"); return; } QSSJstr = JSBeginDateEdit->Text + " 00:00:00"; JZSJstr = JSEndDateEdit->Text + " 23:59:59"; QCZYstr = USERComboBox->Text; // String sqlstr = "select SUM(case when SFLX='K' then SF_YE else 0 end) as KZE,SUM(case when SFLX='W' then SF_YE else 0 end) as KCB,SUM(case when SFLX='K' then 1 else 0 end) as KZCS,SUM(case when SFLX='a' then SFJE else 0 end) as AZE,SUM(case when SFLX='a' then 1 else 0 end) as AZCS,SUM(case when SFLX='I' then SFJE else 0 end) as IZE,SUM(case when SFLX='I' then 1 else 0 end) as IZCS,SUM(case when SFLX='F' then SF_YE else 0 end) as GZE,SUM(case when SFLX='G' then SFJE else 0 end) as GCB,SUM(case when SFLX='G' then 1 else 0 end) as GZCS,SUM(case when SFLX='D' then SFJE else 0 end) as DZE,SUM(case when SFLX='D' then 1 else 0 end) as DZCS from MXBAK where SFRQ>='"; String sqlstr = "select SUM(case when SFLX='K' then MXBAK.SF_YE else 0 end) as KZE,SUM(case when SFLX='W' then MXBAK.SF_YE else 0 end) as KCB,SUM(case when SFLX='K' then 1 else 0 end) as KZCS,SUM(case when SFLX='a' then MXBAK.SFJE else 0 end) as AZE,SUM(case when SFLX='a' then 1 else 0 end) as AZCS,SUM(case when SFLX='I' then MXBAK.SFJE else 0 end) as IZE,SUM(case when SFLX='I' then 1 else 0 end) as IZCS,SUM(case when SFLX='F' then MXBAK.SF_YE else 0 end) as GZE,SUM(case when SFLX='G' then MXBAK.SFJE else 0 end) as GCB,SUM(case when SFLX='G' then 1 else 0 end) as GZCS,SUM(case when SFLX='D' then -MXBAK.SFJE else 0 end) as DZE,SUM(case when SFLX='D' then 1 else 0 end) as DZCS from MXBAK join CARD_F on MXBAK.BH=CARD_F.BH and MXBAK.KH=CARD_F.KH where SFRQ>='"; sqlstr += QSSJstr; sqlstr += "' and SFRQ<='"; sqlstr += JZSJstr; sqlstr += "'"; // String TKsqlstr = "select SUM(case when YW=1 then 1 else 0 end) as TZCS,SUM(case when YW=1 then TKJE else 0 end) as TZE,SUM(case when YW=1 then TKCB else 0 end) as RZE,SUM(case when YW=0 then 1 else 0 end) as QZCS,SUM(case when YW=0 then TKJE else 0 end) as QZE from CARD_T where TKRQ>='"; String TKsqlstr = "select SUM(case when YW=1 then 1 else 0 end) as TZCS,SUM(case when YW=1 then -TKJE else 0 end) as TZE,SUM(case when YW=1 then -TKCB else 0 end) as RZE,SUM(case when YW=0 then 1 else 0 end) as QZCS,SUM(case when YW=0 then -TKJE else 0 end) as QZE from CARD_T join OperationList on CARD_T.KH=OperationList.KH where (OperationList.LX='退卡' or OperationList.LX='无卡退卡' or OperationList.LX='补发卡') and CARD_T.TKRQ>='"; TKsqlstr += QSSJstr; TKsqlstr += "' and CARD_T.TKRQ<='"; TKsqlstr += JZSJstr; TKsqlstr += "'"; if(QCZYstr != "所有系统用户"&&!QCZYstr.IsEmpty()) { sqlstr += " and CZY='"; sqlstr += QCZYstr; sqlstr += "'"; TKsqlstr += " and CARD_T.TKOperator='"; TKsqlstr += QCZYstr; TKsqlstr += "'"; } JSADOQuery->Close(); JSADOQuery->SQL->Clear(); JSADOQuery->SQL->Add(sqlstr); JSADOQuery->Open(); KZCSstr = JSADOQuery->FieldByName("KZCS")->AsInteger; KCBstr = JSADOQuery->FieldByName("KCB")->AsFloat; KZEstr = JSADOQuery->FieldByName("KZE")->AsFloat; AZCSstr = JSADOQuery->FieldByName("AZCS")->AsInteger; AZEstr = JSADOQuery->FieldByName("AZE")->AsFloat; IZCSstr = JSADOQuery->FieldByName("IZCS")->AsInteger; IZEstr = JSADOQuery->FieldByName("IZE")->AsFloat; GZCSstr = JSADOQuery->FieldByName("GZCS")->AsInteger; GCBstr = JSADOQuery->FieldByName("GCB")->AsFloat; GZEstr = "0";//JSADOQuery->FieldByName("GZE")->AsFloat; DZCSstr = JSADOQuery->FieldByName("DZCS")->AsInteger; DZEstr = JSADOQuery->FieldByName("DZE")->AsFloat; JSADOQuery->Close(); JSADOQuery->SQL->Clear(); JSADOQuery->SQL->Add(TKsqlstr); JSADOQuery->Open(); TZCSstr = JSADOQuery->FieldByName("TZCS")->AsInteger; TCBstr = JSADOQuery->FieldByName("RZE")->AsFloat; TZEstr = JSADOQuery->FieldByName("TZE")->AsFloat; QZCSstr = JSADOQuery->FieldByName("QZCS")->AsInteger; QZEstr = JSADOQuery->FieldByName("QZE")->AsFloat; JSADOQuery->Close(); cxTextEdit1->Text = KZCSstr; cxTextEdit2->Text = KCBstr; cxTextEdit3->Text = KZEstr; cxTextEdit4->Text = AZCSstr; cxTextEdit5->Text = ACBstr; cxTextEdit6->Text = AZEstr; cxTextEdit7->Text = IZCSstr; cxTextEdit8->Text = ICBstr; cxTextEdit9->Text = IZEstr; cxTextEdit10->Text = GZCSstr; cxTextEdit11->Text = GCBstr; cxTextEdit12->Text = GZEstr; cxTextEdit13->Text = DZCSstr; cxTextEdit14->Text = DCBstr; cxTextEdit15->Text = DZEstr; cxTextEdit16->Text = CZCSstr; cxTextEdit17->Text = CCBstr; cxTextEdit18->Text = CZEstr; cxTextEdit19->Text = TZCSstr; cxTextEdit20->Text = TCBstr; cxTextEdit21->Text = TZEstr; cxTextEdit22->Text = QZCSstr; cxTextEdit23->Text = QCBstr; cxTextEdit24->Text = QZEstr; JSZCSstr = IntToStr(StrToInt(KZCSstr)+StrToInt(AZCSstr)+StrToInt(IZCSstr)+ StrToInt(GZCSstr)+StrToInt(DZCSstr)+StrToInt(CZCSstr)+ StrToInt(TZCSstr)+StrToInt(QZCSstr)); JSZCBstr = FloatToStr(StrToFloat(KCBstr)+StrToFloat(ACBstr)+StrToFloat(ICBstr)+ StrToFloat(GCBstr)+StrToFloat(DCBstr)+StrToFloat(CCBstr)+ StrToFloat(TCBstr)+StrToFloat(QCBstr)); JSZJEstr = FloatToStr(StrToFloat(KZEstr)+StrToFloat(AZEstr)+StrToFloat(IZEstr)+ StrToFloat(GZEstr)+StrToFloat(DZEstr)+StrToFloat(CZEstr)+ StrToFloat(TZEstr)+StrToFloat(QZEstr)); cxTextEdit25->Text = JSZCSstr; cxTextEdit26->Text = JSZCBstr; cxTextEdit27->Text = JSZJEstr; ZCZJEstr = FloatToStr(StrToFloat(DZEstr)+StrToFloat(TZEstr)+StrToFloat(QZEstr)+StrToFloat(TCBstr)); SRZJEstr = FloatToStr(StrToFloat(AZEstr)+StrToFloat(IZEstr)+StrToFloat(KZEstr)+StrToFloat(GCBstr)); ZJSstr = FloatToStr(StrToFloat(SRZJEstr)+StrToFloat(ZCZJEstr)); cxTextEdit28->Text = ZCZJEstr; cxTextEdit29->Text = SRZJEstr; cxTextEdit30->Text = ZJSstr; ExportBTN->Enabled = true; PreviewBTN->Enabled = true; }
//--------------------------------------------------------------------------- //--------------------------------------------------------------------------- void __fastcall TfrmMain::LoadSetting() { if (strcmp(LoginerPath,"")!=0) { if( FileExists( String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Setting.ini" )) { TIniFile* ini = new TIniFile( String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Setting.ini"); AutoGuagi_X = ini->ReadInteger("AutoGuagi","X",0); AutoGuagi_Y = ini->ReadInteger("AutoGuagi","Y",0); AutoGuagi_MapId = ini->ReadInteger("AutoGuagi","MapId",0); this->ck_func_godmode->IsChecked = ini->ReadBool("Setting","godmode",true); this->ck_func_dingua->IsChecked=ini->ReadBool("Setting","dingua",this->ck_func_dingua->IsChecked); ck_func_csx->IsChecked =ini->ReadBool("Setting","csx",this->ck_func_csx->IsChecked); //ck_func_autolr->IsChecked =ini->ReadBool("Setting","autolr",this->ck_func_autolr->IsChecked); this->ck_func_chardir->IsChecked =ini->ReadBool("Setting","chardir",this->ck_func_chardir->IsChecked); this->sw_func_chardir->IsChecked =ini->ReadBool("Setting","chardir_v",this->sw_func_chardir->IsChecked); this->ck_func_dingwei->IsChecked =ini->ReadBool("Setting","dingwei",this->ck_func_dingwei->IsChecked); this->ck_func_hidebk->IsChecked =ini->ReadBool("Setting","hidebk",this->ck_func_hidebk->IsChecked); this->ck_func_hidedmg->IsChecked =ini->ReadBool("Setting","hidedmg",this->ck_func_hidedmg->IsChecked); this->ck_func_hideskill->IsChecked =ini->ReadBool("Setting","hideskill",this->ck_func_hideskill->IsChecked); this->ck_func_itemvac->IsChecked =ini->ReadBool("Setting","itemvac",this->ck_func_itemvac->IsChecked); this->ck_func_jmp->IsChecked =ini->ReadBool("Setting","jmp",this->ck_func_jmp->IsChecked); this->ck_func_stupid->IsChecked =ini->ReadBool("Setting","stupid",this->ck_func_stupid->IsChecked); this->ck_hp->IsChecked =ini->ReadBool("Protect","hp",this->ck_hp->IsChecked); this->ck_mp->IsChecked =ini->ReadBool("Protect","mp",this->ck_mp->IsChecked); this->ck_att->IsChecked =ini->ReadBool("Protect","att",this->ck_att->IsChecked); this->ck_pick->IsChecked =ini->ReadBool("Protect","pick",this->ck_pick->IsChecked); this->ck_key1->IsChecked =ini->ReadBool("Protect","key1",this->ck_key1->IsChecked); this->ck_key2->IsChecked =ini->ReadBool("Protect","key2",this->ck_key2->IsChecked); this->ck_key3->IsChecked =ini->ReadBool("Protect","key3",this->ck_key3->IsChecked); this->ck_key4->IsChecked =ini->ReadBool("Protect","key4",this->ck_key4->IsChecked); this->txt_hp->Text =ini->ReadString("Protect","hp_v",this->txt_hp->Text); this->txt_mp->Text =ini->ReadString("Protect","mp_v",this->txt_mp->Text); this->txt_att->Text =ini->ReadString("Protect","att_v",this->txt_att->Text); this->txt_pick->Text =ini->ReadString("Protect","pick_v",this->txt_pick->Text); this->txt_key1->Text =ini->ReadString("Protect","key1_v",this->txt_key1->Text); this->txt_key2->Text =ini->ReadString("Protect","key2_v",this->txt_key2->Text); this->txt_key3->Text =ini->ReadString("Protect","key4_v",this->txt_key3->Text); this->txt_key4->Text =ini->ReadString("Protect","key3_v",this->txt_key4->Text); this->cb_att->Selected->Text =ini->ReadString("Protect","att_k",this->cb_att->Selected->Text); this->cb_att->ItemIndex = ini->ReadInteger("Protect","att_k",this->cb_att->ItemIndex); this->cb_pick->ItemIndex = ini->ReadInteger("Protect","pick_k",this->cb_pick->ItemIndex); this->cb_key1->ItemIndex=ini->ReadInteger("Protect","key1_k",this->cb_key1->ItemIndex); this->cb_key2->ItemIndex= ini->ReadInteger("Protect","key2_k",this->cb_key2->ItemIndex); this->cb_key3->ItemIndex=ini->ReadInteger("Protect","key4_k",this->cb_key3->ItemIndex); this->cb_key4->ItemIndex=ini->ReadInteger("Protect","key3_k",this->cb_key4->ItemIndex); AutoKey_HP_Value = StrToInt(txt_hp->Text); AutoKey_MP_Value = StrToInt(txt_mp->Text); AutoKey_Att_Time = StrToInt(txt_att->Text); AutoKey_Pick_Time = StrToInt(txt_pick->Text); AutoKey_Skill_Time[0] = StrToInt(txt_key1->Text); AutoKey_Skill_Time[1] = StrToInt(txt_key2->Text); AutoKey_Skill_Time[2] = StrToInt(txt_key3->Text); AutoKey_Skill_Time[3] = StrToInt(txt_key4->Text); AutoKey_Att_Key = GetVirtualKeyCodeByName(AnsiString(cb_att->Selected->Text).c_str()); AutoKey_Pick_Key = GetVirtualKeyCodeByName(AnsiString(cb_pick->Selected->Text).c_str()); AutoKey_Skill_Key[0] = GetVirtualKeyCodeByName(AnsiString(cb_key1->Selected->Text).c_str()); AutoKey_Skill_Key[1] = GetVirtualKeyCodeByName(AnsiString(cb_key2->Selected->Text).c_str()); AutoKey_Skill_Key[2] = GetVirtualKeyCodeByName(AnsiString(cb_key3->Selected->Text).c_str()); AutoKey_Skill_Key[3] = GetVirtualKeyCodeByName(AnsiString(cb_key4->Selected->Text).c_str()); } } }