//--------------------------------------------------------------------------- void StringToTokiensA( AnsiString Words, AnsiString Dlmtr, TStrings *Making ) { AnsiString Work = Words.Trim(); int spos; while ((spos = Work.AnsiPos(Dlmtr)) != 0) { Making->Add(Work.SubString( 1, spos-1)); Work = Work.SubString( spos+1, Work.Length() - spos); Work = Work.Trim(); } // while if (Work != "") Making->Add(Work); }
//--------------------------------------------------------------------------- bool GetProbalityValue(AnsiString S, double &dRet, AnsiString &strErr) { try { AnsiString strComa(0.1); for(int i=0; i< S.Length(); i++) { if(S[i+1] == ',' || S[i+1] == '.') S[i+1] = strComa[1+1]; } S = S.Trim(); dRet = S.ToDouble(); if( dRet < 0) { strErr = "«начение не должно быть отрицательным '" + S + "'"; return false; } } catch(EConvertError *EC) { strErr = "¬ведено неправильное чиcловое значение '" + S + "'"; return false; } return true; }
//--------------------------------------------------------------------------- TStringList* StringToTok2( AnsiString Words, AnsiString Dlmtr1, AnsiString Dlmtr2 ) { AnsiString Work = Words.Trim(); int spos; TStringList *Making = new TStringList; int spos1 = Work.AnsiPos(Dlmtr1); int spos2 = Work.AnsiPos(Dlmtr2); while (spos1 || spos2) { // int spos = 0; if (!spos1 && spos2) spos = spos2; else if (!spos2 && spos1) spos = spos1; else spos = (spos1 < spos2) ? spos1 : spos2; Making->Add(Work.SubString( 1, spos-1)); Work = Work.SubString( spos+1, Work.Length() - spos); Work = Work.Trim(); spos1 = Work.AnsiPos(Dlmtr1); spos2 = Work.AnsiPos(Dlmtr2); } // while if (Work != "") Making->Add(Work); return Making; }
//--------------------------------------------------------------------------- void SetDisplayLabels(TIBQuery * query, TcxGridDBDataController * DataController, AnsiString str) { if(!IsConnected()) return; int last_index = 1; int count = 0; AnsiString item; int length = str.Length(); for(int i = 1;i<=length; i++) { if(str[i] == ',' || i == length ) { int len = i-last_index; if(i == length) len = i-last_index+1; item = str.SubString(last_index, len); last_index = i+1; if(count <= query->FieldList->Count-1) query->FieldList->Fields[count]->DisplayLabel = item; item = item.Trim(); if(item == "false") query->FieldList->Fields[count]->Visible = false; count ++; } } if(query->Active && DataController->ItemCount == 0) DataController->CreateAllItems(); }
LPCSTR _GetItem(LPCSTR src, int index, AnsiString& dst, char separator, LPCSTR def, bool trim) { LPCSTR ptr; ptr = _SetPos(src, index, separator); if (ptr) _CopyVal(ptr, dst, separator); else dst = def; if (trim) dst = dst.Trim(); return dst.c_str(); }
//--------------------------------------------------------------------------- AnsiString TRsyncConfigAdapter::FetchModuleLine(AnsiString oneLine){ oneLine = oneLine.Trim(); if(oneLine.Length() < 3){ return ""; } if(oneLine[1] == '[' && oneLine[oneLine.Length()] == ']'){ return oneLine.SubString(2, oneLine.Length() - 2); } return ""; }
AnsiString RelaxedCanonicalization::CanonicalizeHeaderName(AnsiString name) { /* Unfold all header field continuation lines as described in [RFC2822]; in particular, lines with terminators embedded in continued header field values (that is, CRLF sequences followed by WSP) MUST be interpreted without the CRLF. Implementations MUST NOT remove the CRLF at the end of the header field value. */ name.ToLower(); name.Trim(); return name; }
//--------------------------------------------------------------------------- TStringList* StringToTokiens( AnsiString Words, AnsiString Dlmtr ) { AnsiString Work = Words.Trim(); int spos; TStringList *Making = new TStringList; while ((spos = Work.AnsiPos(Dlmtr)) != 0) { Making->Add(Work.SubString( 1, spos-1)); Work = Work.SubString( spos+1, Work.Length() - spos); Work = Work.Trim(); } // while if (Work != "") Making->Add(Work); return Making; }
//--------------------------------------------------------------------------- bool TRsyncConfigAdapter::ParseNameValue(AnsiString input, AnsiString& name, AnsiString& value){ input = input.Trim(); if(input == "") return false; if(input[1] == '#') return false; int pos = input.Pos("="); if(pos == 0) return false; name = input.SubString(1, pos - 1).Trim(); value = input.SubString(pos + 1, input.Length()).Trim(); return true; }
AnsiString RelaxedCanonicalization::CanonicalizeHeaderValue(AnsiString value) { /* Unfold all header field continuation lines as described in [RFC2822]; in particular, lines with terminators embedded in continued header field values (that is, CRLF sequences followed by WSP) MUST be interpreted without the CRLF. Implementations MUST NOT remove the CRLF at the end of the header field value. */ value.Replace("\r\n ", " "); value.Replace("\r\n\t", " "); /* Convert all sequences of one or more WSP characters to a single SP character. WSP characters here include those before and after a line folding boundary. */ value.Replace("\t ", " "); value.Replace(" \t", " "); while (value.Find(" ") >= 0) value.Replace(" ", " "); /* Delete all WSP characters at the end of each unfolded header field value. */ while (value.EndsWith(" ") || value.EndsWith("\t")) value = value.Mid(0, value.GetLength() -1); /* Delete any WSP characters remaining before and after the colon separating the header field name from the header field value. The colon separator MUST be retained. */ value.Trim(); return value; }
//--------------------------------------------------------------------------- // //--------------------------------------------------------------------------- int TBLServiceImpl::ExeCommands(AnsiString asEnterpriseCode,AnsiString asPath, AnsiString asParams,AnsiString &asResults,AnsiString &asMessage) { AnsiString lsResult=""; int lResult = 1; bool lCompress = !asMessage.IsEmpty(); try { AnsiString lsParams; if(asEnterpriseCode.Trim() =="") { asResults = ASWSMarket->AvailableEnterprises; return 1; } if(lCompress) lsParams = PCTools::DeCompressStrForWS(asParams); else lsParams = asParams; BLInvoker *lInvoker = ASWSMarket->Enterprises[asEnterpriseCode]->Invoker[ttWS][asPath]; if(lInvoker) { lInvoker->ExecuteCommands(lsParams,lsResult); }else throw Exception("无法找到调用对象"); if(lCompress) asResults = PCTools::CompressStrForWS(lsResult); else asResults = lsResult; } catch(Exception &E) { lResult = -1; asMessage = E.Message; if(lCompress) asResults = PCTools::CompressStrForWS(lsResult); else asResults = lsResult; } return lResult; }
//--------------------------------------------------------------------------- void TRsyncConfigAdapter::AddANewModule(AnsiString moduleName){ AnsiString fixedName; moduleName = moduleName.Trim(); for(int i = 1; i <= moduleName.Length(); i++){ if( isalnum(moduleName[i]) ){ fixedName += moduleName[i]; } } TModuleHolder* currentModule = new TModuleHolder(); currentModule->moduleName = fixedName; currentModule->nvp->Add(""); currentModule->nvp->Add(" path = "); currentModule->nvp->Add(" comment = "); currentModule->nvp->Add(" read only = false"); currentModule->nvp->Add(" auth users = "); currentModule->nvp->Add(" secrets file = "); currentModule->nvp->Add(""); modules->Add(currentModule); }
int AuthClientUser::ClientProcessThread(SingleThread * self) { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); int timeout = SOCKET_TIMEOUT; setsockopt(m_ClientSocket, SOL_SOCKET, SO_RCVTIMEO,(char*)&timeout, sizeof(timeout)); vector<BYTE> output; //1. Auth if(!this->SocketReadBuff(sizeof(tagCClientAuth), &output)) { SocketReadError("tagCClientAuth SocketReadBuff Error"); return -1; } tagCClientAuth *clietAuth = (tagCClientAuth *)&output[0]; clietAuth->UserName[sizeof(clietAuth->UserName)-1] = '\0'; m_UserName = clietAuth->UserName; m_UserName = m_UserName.LowerCase(); m_UserName = m_UserName.Trim(); string input_username = clietAuth->UserName; SendLogMessage(FormatStr(GBText("用户[%s]开始验证..."), m_UserName)); m_Build = clietAuth->Build; BigNumber A, s, B, K, M2; A.SetBinary(clietAuth->A, sizeof(clietAuth->A)); m_IsChargeProcess = clietAuth->IsChargeProcess; if(!m_SRP6Server.CalcKey(input_username, input_username, A, &s, &B, &K)) { SendLogMessage("错误(1)"); SocketReadError("CalcKey Error"); return -1; } tagSClientAuth sendAuth; memcpy(sendAuth.s, s.AsByteArray(), sizeof(sendAuth.s)); memcpy(sendAuth.B, B.AsByteArray(), sizeof(sendAuth.B)); if(!this->SendAuthMessage((BYTE *)&sendAuth, sizeof(sendAuth))) { SocketReadError("tagSClientAuth SocketSend Error"); return -1; } //2. Auth Check if(!this->SocketReadBuff(sizeof(tagCAuthCheck), &output)) { SocketReadError("tagCAuthCheck SocketReadBuff Error"); return -1; } tagCAuthCheck *clientAuthCheck = (tagCAuthCheck *)&output[0]; if(!m_SRP6Server.CheckClientAuth(input_username, clientAuthCheck->M, &M2)) { SendLogMessage("错误(2)"); SocketReadError("Auth Check Error"); return -1; } tagSAuthCheck sendAuthCheck; memcpy(sendAuthCheck.M2, M2.AsByteArray(), sizeof(sendAuthCheck.M2)); if(!this->SendAuthMessage((BYTE *)&sendAuthCheck, sizeof(sendAuthCheck))) { SocketReadError("tagSAuthCheck SocketSend Error"); return -1; } m_AuthCrypt.Init(&K, WOWWGUserServerEncryptionKey, WOWWGUserServerDecryptionKey); vector<String> outputMsg; if(!CheckUserCanLogin(&outputMsg)) { for(DWORD i=0; i<outputMsg.size(); i++) { SendLogMessage(outputMsg[i]); } SocketReadError(FormatStr("[RefuseLogin]:%s", m_RefuseLoginReason)); return -1; } for(DWORD i=0; i<outputMsg.size(); i++) { SendLogMessage(outputMsg[i]); } // SendLogMessage(FormatStr(GBText("用户[%s]验证成功!"), m_UserName)); TDateTime expTime; if(m_IsChargeProcess) { //充值 BYTE len = 0; if(!this->SocketReadBYTE(&len)) { SendLogMessage("错误(17)"); SocketReadError("Charge CardNo Read Len Error"); return -1; } if(!this->SocketReadBuff(len, &output)) { SendLogMessage("错误(14)"); SocketReadError("Charge CardNo Read Error"); return -1; } AnsiString cardNo = AnsiString((char *)&output[0], len); cardNo = cardNo.Trim(); cardNo = cardNo.UpperCase(); outputMsg.clear(); if(!Charge(m_ADOQuery, m_UserName, cardNo, &outputMsg)) { for(DWORD i=0; i<outputMsg.size(); i++) { SendLogMessage(outputMsg[i]); } SocketReadError("Charge Fail!"); return -1; } for(DWORD i=0; i<outputMsg.size(); i++) { SendLogMessage(outputMsg[i]); } outputMsg.clear(); if(!GetExpireTime(m_ADOQuery, m_UserName, &outputMsg, &expTime)) { for(DWORD i=0; i<outputMsg.size(); i++) { SendLogMessage(outputMsg[i]); } SocketReadError("Charge GetExpireTime Fail!"); return -1; } for(DWORD i=0; i<outputMsg.size(); i++) { SendLogMessage(outputMsg[i]); } SendLogMessage(GBText("充值成功!")); } else { //验证 tagWOWAddrInfo addrInfo; if(!FindAddrInfo(m_Build, &addrInfo)) { SendLogMessage("错误(3)"); GetLog()->Error("No Build Msg. Build = %d", m_Build); SocketReadError("We Don't Have This Build!"); return -1; } outputMsg.clear(); if(!GetExpireTime(m_ADOQuery, m_UserName, &outputMsg, &expTime)) { for(DWORD i=0; i<outputMsg.size(); i++) { SendLogMessage(outputMsg[i]); } SocketReadError("GetExpireTime Fail!"); return -1; } for(DWORD i=0; i<outputMsg.size(); i++) { SendLogMessage(outputMsg[i]); } tagClientAddrInfo info; info.Address = addrInfo.Addr; info.Offset = addrInfo.Offset; info.ExpireTime = expTime; if(!this->SendAuthMessage((BYTE *)&info, sizeof(tagClientAddrInfo))) { SocketReadError("tagClientAddrInfo SocketSend Error"); return -1; } m_ADOQuery->SQL->Text = FormatStr("SELECT * FROM wow_msg where msg_key = '%s'", L"login"); if(OpenSQL(m_ADOQuery)) { if(m_ADOQuery->RecordCount) { m_ADOQuery->First(); String text = m_ADOQuery->FieldByName("msg")->AsString; SendLogMessage(text); } } SendLogMessage(GBText("验证成功!")); } SendLogMessage(GBText(FormatStr("你的帐号[%s]到期时间为:%s", m_UserName, DateTimeToStr(expTime)))); OnLoginSuccess(); Sleep(1000); this->SetIsClosed(1); return -1; }
//--------------------------------------------------------------------------- void __fastcall TDM::ListaExterna(PHDataSource *DS, PHTable *Tabela, AnsiString CampoOrig, short Elemento, AnsiString CampoConsul, short Sistema) { AnsiString Codigo = ""; AnsiString Chave; AnsiString Diretorio; AnsiString NomeSistema; if(Sistema) { Diretorio = DadosEmpresa(EMPRESAS_LOCALSCPH,vg.EmpresaAtual,0); NomeSistema = "SCPH"; } else { Diretorio = DadosEmpresa(EMPRESAS_LOCALEFPH,vg.EmpresaAtual,0); NomeSistema = "EFPH"; } Diretorio = IncludeTrailingBackslash(Diretorio); if(Diretorio != "") { PHDataSource *_PHDS1; try { _PHDS1 = new PHDataSource(NULL); _PHDS1->Name = "DSListaExterna"; _PHDS1->Tabela = Tabela; if(_PHDS1->Tabela->DiretorioTipo == tdPrincipal) { Diretorio = DiretorioPrincipal(Diretorio); } _PHDS1->DiretorioTipo = tdsExplicito; _PHDS1->Diretorio = Diretorio; TLista *L1 = new TLista(this); try { L1->Caption = "Lista: " + _PHDS1->Tabela->NomeOpcao; L1->PHDS->Tabela = _PHDS1->Tabela; L1->PHDS->DiretorioTipo = _PHDS1->DiretorioTipo; L1->PHDS->Diretorio = _PHDS1->Diretorio; L1->PHDS->IndiceNome = _PHDS1->Tabela->IndiceConsulta; L1->PHDS->FiltrVis = true; L1->PHDS->FiltroExpr = _PHDS1->FiltroExpr; L1->PHDS->Filtrado = _PHDS1->Filtrado; L1->PHDS->FiltrVis = true; L1->PHDS->DestaqueExpr = _PHDS1->DestaqueExpr; L1->PHDS->Destacado = _PHDS1->Destacado; L1->PHDS->DiaNomeArq = _PHDS1->DiaNomeArq; L1->PHDS->MesNomeArq = _PHDS1->MesNomeArq; L1->PHDS->AnoNomeArq = _PHDS1->AnoNomeArq; if(_PHDS1->OnFiltro) { L1->PHDS->OnFiltro = _PHDS1->OnFiltro; } L1->PHDS->Open(true); int CR = L1->PHDS->CountReg() + 1; if(CR >= 2) { L1->PHGrid1->RowCount = CR; } else { throw Exception("Não foi possível montar Lista para Consulta. Verifique o 'Local " + NomeSistema + "' no Cadastro de Empresas."); } L1->PHGrid1->AjustaColunas(0); L1->PHGrid1->Row = 1; Chave = DS->GT(CampoOrig,Elemento); if(Chave.Trim() != "") { L1->PHDS->BuscaKeyBD(CampoConsul,Chave,true,true); L1->PHGrid1->Row = L1->PHDS->Ponteiro + 1; } L1->ShowModal(); if(L1->Retorno) { Codigo = L1->PHDS->GV(CampoConsul); if(Codigo.Trim() != "") { DS->Edit(); DS->SV(CampoOrig,Elemento,Codigo); } } } __finally { L1->PHDS->Close(); if(L1) { delete L1; } L1 = NULL; } } __finally { _PHDS1->Close(); delete _PHDS1; } }
//--------------------------------------------------------------------------- //表现端事件响应 //--------------------------------------------------------------------------- void __fastcall ASScriptSvr::ExeCommand() { AnsiString lsERI = fCommand->ERI; AnsiString lsAction = fCommand->Action; AnsiString lsVerb = fCommand->Params["VERB"]; AnsiString lsID = fCommand->IDList->Strings[0],lsSubID=""; if(lsID.Pos(".") > 0 ) { lsID = lsID.SubString(1,lsID.Pos(".") -1); lsSubID = lsID.SubString(lsID.Pos(".") +1 ,lsID.Length() - lsID.Pos(".") ); } PCAttributeDef *lAttDef = Enterprise->AttDefs[lsERI]; PCActionDef *lActionDef = NULL; if(lsAction.Trim() != "") lActionDef = lAttDef->ActionDef[lsAction]; PCPtr<PCScripts> lScripts; _di_IXMLNode lScriptNode; if(fCommand->isSameVerb("BeforePrCMD")) { lScriptNode = lAttDef->GetPSBefScripts(lsVerb); if(lScriptNode) { lScripts = DBConnection->CreateScript(lsERI,lScriptNode); lScripts->Params->Values["EntityID"] = lsID; lScripts->Params->Values["SubEntityID"] = lsSubID; if(lScripts->Run()<0) throw Exception("条件不满足:" + lScripts->Message); } if(lActionDef) { lScriptNode = lActionDef->GetPSBefScripts(lsVerb); if(lScriptNode) { lScripts = DBConnection->CreateScript(lsERI,lScriptNode); lScripts->Params->Values["EntityID"] = lsID; lScripts->Params->Values["SubEntityID"] = lsSubID; if(lScripts->Run()<0) throw Exception("条件不满足:" + lScripts->Message); } } } else if(fCommand->isSameVerb("AfterPrCMD")) { lScriptNode = lAttDef->GetPSAftScripts(lsVerb); if(lScriptNode) { lScripts = DBConnection->CreateScript(lsERI,lScriptNode); lScripts->Params->Values["EntityID"] = lsID; lScripts->Params->Values["SubEntityID"] = lsSubID; if(lScripts->Run()<0) throw Exception("无法完成操作:" + lScripts->Message); } if(lActionDef) { lScriptNode = lActionDef->GetPSAftScripts(lsVerb); if(lScriptNode) { lScripts = DBConnection->CreateScript(lsERI,lScriptNode); lScripts->Params->Values["EntityID"] = lsID; lScripts->Params->Values["SubEntityID"] = lsSubID; if(lScripts->Run()<0) throw Exception("无法完成操作:" + lScripts->Message); } } } else throw Exception("错误服务命令,脚本对象"); }
//--------------------------------------------------------------------------- bool TGJVEditFrame::dlgForced() { std::auto_ptr <TForceLogDlg> ForceDlg( new TForceLogDlg( this ) ); getScreenEntry(); valid( cmCheckValid ); // This adds errors to the MAIN dialog error list, not our own ErrorList &errs = MinosParameters::getMinosParameters() ->getErrorList(); for ( ErrorIterator i = errs.begin(); i != errs.end(); i++ ) { ForceDlg->ErrList->Items->Add( ( *i ) ->errStr.c_str() ); } ForceDlg->ErrList->ItemIndex = 0; int s = screenContact.contactScore; if ( s < 0 ) s = 0; AnsiString temp; temp.printf( "%d", s ); ForceDlg->ScoreIl->Text = temp; ForceDlg->CheckBox1->Checked = screenContact.contactFlags & TO_BE_ENTERED; ForceDlg->CheckBox2->Checked = screenContact.contactFlags & VALID_DUPLICATE; ForceDlg->CheckBox3->Checked = screenContact.contactFlags & MANUAL_SCORE; ForceDlg->CheckBox4->Checked = screenContact.contactFlags & NON_SCORING; ForceDlg->CheckBox5->Checked = screenContact.contactFlags & DONT_PRINT; ForceDlg->CheckBox6->Checked = screenContact.contactFlags & COUNTRY_FORCED; ForceDlg->CheckBox7->Checked = screenContact.contactFlags & VALID_DISTRICT; ForceDlg->CheckBox8->Checked = screenContact.contactFlags & XBAND; if ( MinosParameters::getMinosParameters() ->isErrSet( ERR_12 ) || ( screenContact.contactFlags & ( NON_SCORING | MANUAL_SCORE | DONT_PRINT | VALID_DUPLICATE | TO_BE_ENTERED | XBAND ) ) ) { // set nothing! DUPs are dealt with! } else if ( errs.size() != 0 ) // no errors -> OK ForceDlg->CheckBox4->Checked = screenContact.contactFlags | NON_SCORING; if ( screenContact.contactFlags & COUNTRY_FORCED ) { ForceDlg->CtryMultIl->Text = screenContact.forcedMult.c_str(); } else if ( contest->countryMult.getValue() && screenContact.ctryMult ) { ForceDlg->CtryMultIl->Text = screenContact.ctryMult->basePrefix.c_str(); } bool tryagain = true; int res = mrCancel; while ( tryagain && ( res = ForceDlg->ShowModal() ) == mrOk ) { if ( contest->countryMult.getValue() ) { temp = ForceDlg->CtryMultIl->Text; } else break; if ( !ForceDlg->CheckBox6->Checked ) { tryagain = false; screenContact.contactFlags &= ~ COUNTRY_FORCED; screenContact.ctryMult = 0; screenContact.forcedMult = ""; break; } temp = temp.Trim(); CountryEntry *ctryMult = MultLists::getMultLists() ->getCtryForPrefix( temp.c_str() ); if ( ctryMult ) { tryagain = false; if ( screenContact.ctryMult != ctryMult ) { screenContact.ctryMult = ctryMult; screenContact.contactFlags |= COUNTRY_FORCED; screenContact.forcedMult = temp.c_str(); } } else { if ( MessageBox( Handle, "Country not in CTY.DAT. Leave for now?", "Force log contact", MB_ICONQUESTION | MB_OKCANCEL ) == mbOK ) { tryagain = false; screenContact.contactFlags &= ~COUNTRY_FORCED; screenContact.forcedMult = ""; } } } if ( res == mrOk ) { // save contact... screenContact.contactFlags |= FORCE_LOG; // here read it all off the dialog screenContact.contactFlags &= ~( NON_SCORING | MANUAL_SCORE | DONT_PRINT | VALID_DUPLICATE | TO_BE_ENTERED | VALID_DISTRICT | XBAND ); if ( ForceDlg->CheckBox1->Checked ) { screenContact.contactFlags |= TO_BE_ENTERED; } if ( ForceDlg->CheckBox2->Checked ) { screenContact.contactFlags |= VALID_DUPLICATE; } if ( ForceDlg->CheckBox3->Checked ) { screenContact.contactFlags |= MANUAL_SCORE; temp = ForceDlg->ScoreIl->Text.Trim(); screenContact.contactScore = atoi( temp.c_str() ); } if ( screenContact.contactFlags & ( TO_BE_ENTERED | VALID_DUPLICATE | MANUAL_SCORE ) ) ForceDlg->CheckBox4->Checked = false; if ( ForceDlg->CheckBox4->Checked ) screenContact.contactFlags |= NON_SCORING; if ( ForceDlg->CheckBox5->Checked ) { screenContact.contactFlags |= ( DONT_PRINT | NON_SCORING ); } if ( ForceDlg->CheckBox7->Checked ) screenContact.contactFlags |= VALID_DISTRICT; if ( ForceDlg->CheckBox8->Checked ) screenContact.contactFlags |= XBAND; // make sure marked on main screen NonScoreCheckBox->Checked = screenContact.contactFlags & NON_SCORING; DeletedCheckBox->Checked = screenContact.contactFlags & DONT_PRINT; if ( screenContact.contactFlags & NON_SCORING ) screenContact.multCount = 0; // if no dtg then autofill dtg if ( !contest->isPostEntry() && !( screenContact.contactFlags & TO_BE_ENTERED ) ) { int tne = screenContact.time.notEntered(); // partial dtg will give fe // full dtg gives -ve, none gives 0 if ( tne == 0 ) { screenContact.time = dtg( true ); DateEdit->Text = screenContact.time.getDate( DTGDISP ).c_str(); TimeEdit->Text = screenContact.time.getTime( DTGDISP ).c_str(); } } logCurrentContact( true ); return true; } return false; }
//--------------------------------------------------------------------------- void TfrmMainFormServer::FillModuleValues(){ if(lstModules->ItemIndex < 1){ txtPath->Text = ""; txtComment->Text = ""; chkReadonly->Checked = false; txtPath->Enabled = false; txtComment->Enabled = false; lblPath->Enabled = false; lblComment->Enabled = false; btnBrowse->Enabled = false; chkReadonly->Enabled = false; chkUseAuth->Checked = false; chkUseAuth->Enabled = false; txtUID->Enabled = false; lblUID->Enabled = false; lblTIP->Enabled = false; txtPWD->Enabled = false; lblPWD->Enabled = false; return; } txtPath->Enabled = true; txtComment->Enabled = true; lblPath->Enabled = true; lblComment->Enabled = true; btnBrowse->Enabled = true; chkReadonly->Enabled = true; chkUseAuth->Enabled = true; AnsiString selectedModule = lstModules->Items->Strings[lstModules->ItemIndex]; txtPath->Text = GenericUtils::ConvertPathCygwinToWindows(adapter.GetParamValue(selectedModule, "path")); txtComment->Text = adapter.GetParamValue(selectedModule, "comment"); txtUID->Text = adapter.GetParamValue(selectedModule, "auth users"); txtPWD->Text = ""; if(txtUID->Text.Trim().Length() > 0){ //The value for secrets file is actually a file, not the password. Therefore, I have to read the //value from that file. AnsiString secretFile = adapter.GetParamValue(selectedModule, "secrets file"); if(secretFile.Trim().Length() == 0){ txtPWD->Text = ""; }else{ txtPWD->Text = ""; //Assume there was an error reading the password. secretFile = GenericUtils::ConvertPathCygwinToWindows(secretFile); if(FileExists(secretFile)){ TStringList* sList = new TStringList(); sList->LoadFromFile(secretFile); for(int i = 0; i < sList->Count; i++){ AnsiString userName = txtUID->Text + ":"; if(sList->Strings[i].Trim().Pos(userName) == 1){ //Found the appropriate user name. txtPWD->Text = sList->Strings[i].Trim().SubString(userName.Length() + 1, 100); } } delete sList; } } chkUseAuth->Checked = true; txtUID->Enabled = true; lblUID->Enabled = true; lblTIP->Enabled = true; txtPWD->Enabled = true; lblPWD->Enabled = true; }else{ //If User Name is blank, I assume no authentication is used. chkUseAuth->Checked = false; txtUID->Enabled = false; lblUID->Enabled = false; lblTIP->Enabled = false; txtPWD->Enabled = false; lblPWD->Enabled = false; } chkReadonly->Checked = adapter.GetParamValue(selectedModule, "read only").LowerCase() == "true"; txtComment->Modified = false; }