本文整理汇总了C++中CStringList类的典型用法代码示例。如果您正苦于以下问题:C++ CStringList类的具体用法?C++ CStringList怎么用?C++ CStringList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CStringList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadSettings
bool loadSettings(char* pFile)
{
CStringList settings;
if (!settings.load(pFile))
return false;
for (int i = 0; i < settingList.count(); i++)
{
delete (SettingKey *)settingList[i];
i--;
}
settingList.clear();
for (int i = 0; i < settings.count(); i++)
{
if (settings[i][0] == '#' || settings[i][0] == '\'')
continue;
SettingKey *key = new SettingKey();
key->name = settings[i].copy(0, settings[i].find('=')).trim();
key->value = settings[i].copy(settings[i].find('=') + 1).trim();
}
/* ARRAY Server-Options */
globalGuildList.load(findKey("allowedglobalguilds"), ",");
cheatwindows.load(findKey("cheatwindows"), ",");
jailLevels.load(findKey("jaillevels"), ",");
mapNames.load(findKey("maps"), ",");
profileList.load(findKey("profilevars", "Kills:=playerkills,Deaths:=playerdeaths,Maxpower:=playerfullhearts,Rating:=playerrating,Alignment:=playerap,Gralat:=playerrupees,Swordpower:=playerswordpower,Spin Attack:=canspin"), ",");
staffGuilds.load(findKey("staffguilds", "Server,Manager,Owner,Admin,FAQ,LAT,NAT,GAT,GP,GP Chief,Bugs Admin,NPC Admin,Gani Team,GFX Admin,Events Team,Events Admin,Guild Admin"), ",");
staffList.load(findKey("staff"), ",");
statusList.load(findKey("playerlisticons", "Online,Away,DND"), ",");
/* BOOL Server-Options */
apSystem = CHECK_BOOL(findKey("apsystem", "true"));
baddyDropItems = CHECK_BOOL(findKey("baddyitems", "false"));
bushesDrop = CHECK_BOOL(findKey("bushitems", "true"));
cheatwindowsban = CHECK_BOOL(findKey("cheatwindowsban", "false"));
clientsidePushPull = CHECK_BOOL(findKey("clientsidepushpull", "true"));
defaultweapons = CHECK_BOOL(findKey("defaultweapons", "true"));
detailedconsole = CHECK_BOOL(findKey("detailedconsole", "false"));
dontaddserverflags = CHECK_BOOL(findKey("dontaddserverflags", "false"));
dontchangekills = CHECK_BOOL(findKey("dontchangekills", "false"));
dropItemsDead = CHECK_BOOL(findKey("dropitemsdead", "true"));
globalGuilds = CHECK_BOOL(findKey("globalguilds", "true"));
healswords = CHECK_BOOL(findKey("healswords", "false"));
idleDisconnect = CHECK_BOOL(findKey("disconnectifnotmoved", "true"));
noExplosions = CHECK_BOOL(findKey("noexplosions", "false"));
noFoldersConfig = CHECK_BOOL(findKey("nofoldersconfig", "false"));
putnpcenabled = CHECK_BOOL(findKey("putnpcenabled", "true"));
adminCanChangeGralat = CHECK_BOOL(findKey("normaladminscanchangegralats", "true"));
setbodyallowed = CHECK_BOOL(findKey("setbodyallowed", "true"));
setheadallowed = CHECK_BOOL(findKey("setheadallowed", "true"));
setswordallowed = CHECK_BOOL(findKey("setswordallowed", "true"));
setshieldallowed = CHECK_BOOL(findKey("setshieldallowed", "true"));
showConsolePackets = CHECK_BOOL(findKey("showconsolepackets", "false"));
staffOnly = CHECK_BOOL(findKey("onlystaff", "false"));
underconstruction = CHECK_BOOL(findKey("underconstruction", "false"));
vasesDrop = CHECK_BOOL(findKey("vasesdrop", "true"));
warptoforall = CHECK_BOOL(findKey("warptoforall", "false"));
/* INT Server-Options */
aptime[0] = atoi(findKey("aptime0", "30"));
aptime[1] = atoi(findKey("aptime1", "90"));
aptime[2] = atoi(findKey("aptime2", "300"));
aptime[3] = atoi(findKey("aptime3", "600"));
aptime[4] = atoi(findKey("aptime4", "1200"));
baddyRespawn = atoi(findKey("baddyrespawntime"));
cheatwindowstime = atoi(findKey("cheatwindowstime", "60"));
heartLimit = atoi(findKey("heartlimit", "20"));
horseLife = atoi(findKey("horselifetime"));
listServerFields[3] = toString(GSERVER_BUILD);
listServerPort = atoi(findKey("listport", "14900"));
maxNoMovement = atoi(findKey("maxnomovement", "1200"));
maxPlayers = atoi(findKey("maxplayers", "128"));
mindeathgralats = atoi(findKey("mindeathgralats","1"));
maxdeathgralats = atoi(findKey("maxdeathgralats","50"));
serverPort = atoi(findKey("serverport", "14802"));
shieldLimit = atoi(findKey("shieldlimit", "3"));
swordLimit = CLIP(atoi(findKey("swordlimit", "4")), -25, 25);
tiledroprate = CLIP(atoi(findKey("tiledroprate", "50")), 0, 100);
tileRespawn = atoi(findKey("respawntime"));
unstickmeX = (float)atof(findKey("unstickmex", "30"));
unstickmeY = (float)atof(findKey("unstickmey", "30.5"));
/* TEXT Server-Options */
unstickmeLevel = findKey("unstickmelevel", "onlinestartlocal.nw");
listServerIp = findKey("listip", "listserver.graal.in");
listServerFields[0] = findKey("name", "My Server");
listServerFields[1] = findKey("description", "My Server");
listServerFields[2] = findKey("language", "English");
listServerFields[4] = findKey("url", "http://www.graal.in");
listServerFields[5] = findKey("myip", "AUTO");
shareFolder = findKey("sharefolder");
staffHead = findKey("staffhead", "head25.png");
worldName = findKey("worldname", "main");
// If the server is flagged as under construction, prepend the
// Under Construction value to the name.
if ( underconstruction && !listServerFields[0].match( "U *" ) )
//.........这里部分代码省略.........
示例2: GetNextTags
//tag should be lowercase
BOOL CSimpleSAH::GetNextTags(CStringList& astrTagNames)
{
int i, j, k;
BOOL found = FALSE;
CString tagp;
long len = strHTML.GetLength();
try{
while(!found)
{
if(!strCurTagBuf.IsEmpty())
{
if(m_bUpdate)
file.WriteString(strCurTagBuf);
}
i = strHTML.Find('<', nStartPoint);
if(i<0)
{
//end of file
if(m_bUpdate)
{ file.Write(strHTML.GetBuffer(8) + nStartPoint, len - nStartPoint);
strHTML.ReleaseBuffer();
}
return FALSE;
}
else
{
if(m_bUpdate)
{
file.Write(strHTML.GetBuffer(8) + nStartPoint, i - nStartPoint);
strHTML.ReleaseBuffer();
}
}
if(strHTML.Mid(i+1, 2) == "!-") //is comment
{
j = strHTML.Find("-->", i);
if(j<0)
{
//not a real comment, just some text
if(m_bUpdate)
{
file.Write(strHTML.GetBuffer(8) + i, 3);
strHTML.ReleaseBuffer();
}
nStartPoint = i + 3;
}
else
{
//is comment, output it
if(m_bUpdate)
{
file.Write(strHTML.GetBuffer(8) + i, j - i+3);
strHTML.ReleaseBuffer();
}
nStartPoint = j + 3;
}
strCurTagBuf.Empty();
}
else
{
j = strHTML.Find('>', i);
k = strHTML.Find('<', i);
if(j<0)
{
//end of file
if(m_bUpdate)
{ file.Write(strHTML.GetBuffer(8) + i, len - i);
strHTML.ReleaseBuffer();
}
return FALSE;
}
if(j>k)
{
//output
if(m_bUpdate)
{
file.Write(strHTML.GetBuffer(8) + i, k-i);
strHTML.ReleaseBuffer();
}
i = k;
}
strCurTagBuf = strHTML.Mid(i, j-i+1);
nStartPoint = j+1;
//if is the needed tag
k=strCurTagBuf.FindOneOf(" >\r\n");
if(k>0)
tagp = strCurTagBuf.Mid(1, k-1);
else
tagp = strCurTagBuf.Mid(1, strCurTagBuf.GetLength()-2);
tagp.MakeLower();
if(astrTagNames.Find(tagp))
//.........这里部分代码省略.........
示例3: ASSERT
//*************************************************************************************************
BOOL CBCGPMousePage::OnInitDialog()
{
ASSERT (g_pMouseManager != NULL);
CPropertyPage::OnInitDialog();
CStringList listOfViewNames;
g_pMouseManager->GetViewNames (listOfViewNames);
//-------------------
// Create image list:
//-------------------
if (!m_ViewsImages.Create ( globalData.m_sizeSmallIcon.cx,
globalData.m_sizeSmallIcon.cy,
ILC_COLOR | ILC_MASK,
(int) listOfViewNames.GetCount (), 1))
{
ASSERT (FALSE);
}
m_wndListOfViews.SetImageList (&m_ViewsImages, LVSIL_SMALL);
POSITION pos;
//-----------------
// Fill views list:
//-----------------
CRect rect;
m_wndListOfViews.GetClientRect (&rect);
m_wndListOfViews.InsertColumn (0, _T(""), LVCFMT_LEFT, rect.Width () - 1);
ASSERT (!listOfViewNames.IsEmpty ());
int iMaxWidth = 0;
for (pos = listOfViewNames.GetHeadPosition (); pos != NULL;)
{
CString strViewName = listOfViewNames.GetNext (pos);
int iImageIndex = -1;
//---------------
// Add view icon:
//---------------
UINT uiViewIconId = g_pMouseManager->GetViewIconId (
g_pMouseManager->GetViewIdByName (strViewName));
HICON hViewIcon;
if (uiViewIconId != 0 &&
(hViewIcon = AfxGetApp ()->LoadIcon (uiViewIconId)) != NULL)
{
iImageIndex = m_ViewsImages.Add (hViewIcon);
::DestroyIcon (hViewIcon);
}
int iIndex = m_wndListOfViews.GetItemCount ();
for (int i = 0; i < m_wndListOfViews.GetItemCount (); i ++)
{
CString strText = m_wndListOfViews.GetItemText (i, 0);
if (strText > strViewName)
{
iIndex = i;
break;
}
}
m_wndListOfViews.InsertItem (iIndex, strViewName, iImageIndex);
m_wndListOfViews.SetItemData (iIndex,
(DWORD) g_pMouseManager->GetViewIdByName (strViewName));
int iStrWidth = m_wndListOfViews.GetStringWidth (strViewName);
iMaxWidth = max (iStrWidth, iMaxWidth);
}
//----------------------------------
// Add icon width pluse some pixels:
//----------------------------------
IMAGEINFO info;
m_ViewsImages.GetImageInfo (0, &info);
CRect rectImage = info.rcImage;
iMaxWidth += rectImage.Width () + 10;
m_wndListOfViews.SetColumnWidth (0, iMaxWidth);
//--------------------
// Fill commands list:
//--------------------
CBCGPToolbarCustomize* pWndParent = DYNAMIC_DOWNCAST (CBCGPToolbarCustomize, GetParent ());
ASSERT (pWndParent != NULL);
pWndParent->FillAllCommandsList (m_wndListOfCommands);
//-----------------------
// Select the first view:
//-----------------------
m_wndListOfViews.SetItemState (0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
m_wndListOfViews.EnsureVisible (0, FALSE);
return TRUE; // return TRUE unless you set the focus to a control
//.........这里部分代码省略.........
示例4: GetTableList
BOOL CBCGPODBCGridCtrl::GetTableList (CStringList& lstTable)
{
lstTable.RemoveAll ();
if (m_pDataBase == NULL)
{
ASSERT (FALSE);
return FALSE;
}
ASSERT_VALID (m_pDataBase);
try
{
if (!m_pDataBase->IsOpen ())
{
ASSERT (FALSE);
return FALSE;
}
HSTMT hStmt;
SQLRETURN rc = ::SQLAllocStmt(m_pDataBase->m_hdbc, &hStmt);
if (!m_pDataBase->Check (rc))
{
return FALSE;
}
#if _MSC_VER >= 1300
#ifdef UNICODE
#define __BCGP_SQLCHAR SQLWCHAR
#else
#define __BCGP_SQLCHAR SQLCHAR
#endif
#else
#define __BCGP_SQLCHAR SQLCHAR
#endif
rc = ::SQLTables (hStmt,
NULL,SQL_NTS,
NULL,SQL_NTS,
NULL,SQL_NTS,
(__BCGP_SQLCHAR*) _T("'TABLE'"), SQL_NTS);
if (!m_pDataBase->Check (rc))
{
AfxThrowDBException (rc, m_pDataBase, hStmt);
}
while ((rc = ::SQLFetch (hStmt)) != SQL_NO_DATA_FOUND)
{
if (!m_pDataBase->Check (rc))
{
AfxThrowDBException (rc, m_pDataBase, hStmt);
}
UCHAR szName [256];
#if _MSC_VER < 1300
SDWORD cbName;
#else
SQLLEN cbName;
#endif
rc = ::SQLGetData (hStmt, 3, SQL_C_CHAR, szName, 256, &cbName);
if (!m_pDataBase->Check (rc))
{
AfxThrowDBException (rc, m_pDataBase, hStmt);
}
#ifdef _UNICODE
lstTable.AddTail(CString(szName));
#else
lstTable.AddTail ((LPCTSTR)szName);
#endif
}
::SQLFreeStmt (hStmt, SQL_CLOSE);
}
catch (CDBException* pEx)
{
OnODBCException (pEx);
pEx->Delete ();
return FALSE;
}
return TRUE;
}
示例5: ListServer_Main
void ListServer_Main()
{
static CBuffer packetBuffer;
CStringList lines;
if ( listServerFields[5] == "localhost" ) return;
if (!lsConnected) return;
// Read any new data into the socket.
if ( listServer.getData() == -1 )
{
errorOut( "serverlog.txt", "Disconnected from list server." );
lsConnected = false;
return;
}
// Grab all the data from the socket buffer.
packetBuffer << listServer.getBuffer();
listServer.getBuffer().clear();
// Search for a packet. If none is found, break out of the loop.
while (packetBuffer.length() != 0)
{
CPacket line;
if (!nextIsRaw)
{
int lineEnd = packetBuffer.find( '\n' );
if ( lineEnd == -1 ) return;
// Copy the packet out and remove the \n
line = packetBuffer.copy( 0, lineEnd + 1 );
packetBuffer.remove(0, line.length());
line.remove(line.length() - 1, 1);
}
else
{
if (packetBuffer.length() < rawPacketSize) return;
line.writeBytes(packetBuffer.readChars(rawPacketSize), rawPacketSize);
packetBuffer.remove(0, line.length());
line.remove(line.length() - 1, 1);
nextIsRaw = false;
}
packetBuffer.setRead(0);
int messageId = line.readByte1();
switch (messageId)
{
case GSVOLD:
{
printf("[%s] SERVER VERSION CHECK - Current: %i, Latest: %i - Old version, please upgrade.\n", getTimeStr(1).text(), GSERVER_BUILD, line.readByte2());
break;
}
case GSVCURRENT:
{
printf("[%s] SERVER VERSION CHECK - Current: %i, Latest: %i - You are up to date :)\n", getTimeStr(1).text(), GSERVER_BUILD, GSERVER_BUILD);
break;
}
case GSVACCOUNT:
{
CString accountName = line.readChars(line.readByte1());
CString errorMsg = line.readString("");
for (int i = 0; i < newPlayers.count(); i++)
{
CPlayer *player = (CPlayer *)newPlayers[i];
if (player->accountName.comparei(accountName) == 0)
{
// The serverlist will return case sensitive account names.
// This helps case sensitive file systems open/save the correct
// acount.
player->accountName = accountName;
if (errorMsg == "SUCCESS")
{
player->sendAccount();
}
else
{
player->sendPacket(CPacket() << (char)DISMESSAGE << errorMsg);
player->deleteMe = true;
}
break;
}
}
break;
}
case GSVGUILD:
{
int playerId = line.readByte2();
CPlayer *player = (CPlayer *)playerIds[playerId];
if (player != NULL)
{
CString nick = line.readChars((unsigned char)line.readByte1());
CString guild = nick.copy( nick.findl( '(' ) ).remove( ")" );
//.........这里部分代码省略.........
示例6: GroupRunWithinMultirun
int GroupRunWithinMultirun(const char* groupName, const char* constraintsToApply)
{
CStringList cNames;
bool applyAll = strncmp(constraintsToApply, "applyAll", 8) == 0;
if (!applyAll)
{
char *cons = strdup(constraintsToApply);
char *cName = strtok( cons, ":" );
while(cName)
{
cNames.AddTail( cName );
cName = strtok( NULL, ":" );
}
}
CDynConstraintSet *set = new CDynConstraintSet(0);
set->RemoveAll();
CDynConstraintSetList & setlist = CManager::theInstance->GetConstraintSets();
POSITION sl_pos = setlist.GetHeadPosition();
while (sl_pos)
{
CDynConstraintSet * setlist_i = setlist.GetNext(sl_pos);
CDynConstraintList& list = setlist_i->GetConstraints();
POSITION pos1 = list.GetHeadPosition();
while(pos1)
{
CDynConstraint *cur = list.GetNext(pos1);
const CString& nm = cur->GetName();
if (applyAll || cNames.Find(nm))
{
Info("DesertFinit", "Applying Constraint: %s", nm);
cur->SetApplied();
set->InsertConstraint(cur);
}
}
}
// prune & generate next hierarchy
double dspSize;
long repSize;
long clockTime;
try
{
CManager::theInstance->GetSizeInfo(dspSize, repSize, clockTime, set);
CManager::theInstance->GenerateNextHierarchy();
}
catch(CDesertException *e)
{
set->RemoveAll();
delete set;
delete CManager::theInstance;
CManager::theInstance = NULL;
StopLogging();
throw e;
}
Info("DesertFinit", "Design Space Size Info: %f %d %d", dspSize, repSize, clockTime);
set->RemoveAll();
delete set;
int numCfgs = 0;
try
{
numCfgs = CManager::theInstance->CalcRealNoOfConfigurations();
Info("DesertFinitMultirun", "For constraint group: %s with constraints:\r\n\t%s\r\n\tDesign Space Size Info: %f %d %d", groupName, constraintsToApply, dspSize, repSize, clockTime);
Info("DesertFinitMultirun", "No. of configurations with last set of constraints is %d", numCfgs);
}
catch(CDesertException *e)
{
delete CManager::theInstance;
CManager::theInstance = NULL;
StopLogging();
throw e;
}
return numCfgs;
}
示例7: DesertFinit_Apply
DLL_DECL void
DesertFinit_Apply(const char *applyConstraints)
{
CManager::theInstance->AnalyseConstraints();
CManager::theInstance->GenerateNextHierarchy();
if (CManager::theInstance->HasConstraints())
{
if (applyConstraints)
{
CStringList cNames;
bool applyAll = strncmp(applyConstraints, "applyAll", 8) == 0;
if (!applyAll)
{
char *cons = strdup(applyConstraints);
char *cName = strtok( cons, ":" );
while(cName)
{
cNames.AddTail( cName );
cName = strtok( NULL, ":" );
}
if(cNames.IsEmpty()) return;
}
CDynConstraintSet *set = new CDynConstraintSet(0);
set->RemoveAll();
CDynConstraintSetList & setlist = CManager::theInstance->GetConstraintSets();
POSITION sl_pos = setlist.GetHeadPosition();
while (sl_pos)
{
CDynConstraintSet * setlist_i = setlist.GetNext(sl_pos);
CDynConstraintList& list = setlist_i->GetConstraints();
POSITION pos1 = list.GetHeadPosition();
while(pos1)
{
CDynConstraint *cur = list.GetNext(pos1);
const CString& nm = cur->GetName();
if (applyAll || cNames.Find(nm))
{
Info("DesertFinit", "Applying Constraint: %s", nm);
cur->SetApplied();
set->InsertConstraint(cur);
}
}
}
// prune & generate next hierarchy
double dspSize;
long repSize;
long clockTime;
try{
CManager::theInstance->GetSizeInfo(dspSize, repSize, clockTime, set);
}catch(CDesertException *e)
{
CManager::theInstance->GenerateNextHierarchy();
set->RemoveAll();
delete set;
throw e;
}
// Info("DesertFinit", "Design Space Size Info: %f %d %d", dspSize, repSize, clockTime);
CManager::theInstance->GenerateNextHierarchy();
set->RemoveAll();
delete set;
}
}
}
示例8: WebUpdateOption
CString WebUpdateOption(CString strInput)
{
CString strOutput, strItem, strTemp;
CStringList strList;
POSITION pos1, pos2;
WebGetStringList(strInput, 7, strList);
strOutput = _T("<OPTION");
#ifndef __GNUC__
for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
{
pos2 = pos1;
strItem = strList.GetNext(pos1);
strTemp = strItem.Left(6);
if (!strTemp.CompareNoCase(_T("value=")))
{
strItem = strItem.Right(strItem.GetLength()-6);
strItem = RemoveQuote(strItem);
strOutput += _T(" value=");
strOutput += strItem;
strList.RemoveAt(pos2);
}
else if (!strItem.CompareNoCase(_T("selected")))
{
strList.RemoveAt(pos2);
}
}
#ifndef __GNUC__
for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
{
strOutput += _T(' ');
strItem = strList.GetNext(pos1);
strOutput += strItem;
}
strOutput += _T('>');
return strOutput;
}
示例9: OnWeb2Web
void OnWeb2Web(CString strSrcFile, CString strDstFile, BOOL bForce)
{
CStdioFile in, out;
CString strInput, strOutput;
CString strItem, strNew;
int iBeginPos, iEndPos, iStartIndex;
if (!PromptOverwriteFile(strDstFile, bForce)) return;
if (!in.Open(strSrcFile, CFile::modeRead))
{
#ifndef __GNUC__
wprintf(_T("Can not open source file %s"), strSrcFile);
#else
printf("Can not open source file %s", strSrcFile.c_str());
#endif
return;
}
if (!out.Open(strDstFile, CFile::modeCreate|CFile::modeWrite|CFile::typeText))
{
#ifndef __GNUC__
wprintf(_T("Can not create destination file %s"), strDstFile);
#else
printf("Can not create destination file %s", strDstFile.c_str());
#endif
in.Close();
return;
}
strInput = _T("");
#ifndef __GNUC__
while (in.ReadString(strItem))
{
#else
while (!in.eof())
{
std::getline(in, strItem);
strItem.TrimRight();
#endif
strItem.TrimLeft();
strInput += strItem;
strInput += _T("\n");
}
iStartIndex = 0;
strOutput = _T("");
while (iStartIndex < strInput.GetLength())
{
iBeginPos = find_char((TCHAR *)(LPCTSTR)strInput, '<', iStartIndex);
iEndPos = find_char((TCHAR *)(LPCTSTR)strInput, '>', iStartIndex);
if (iBeginPos == -1 || iEndPos == -1) break;
if (iEndPos - iBeginPos < 6)
{
iStartIndex = iEndPos + 1;
continue;
}
strItem = strInput.Mid(iBeginPos, 7);
strItem.MakeUpper();
if (!memcmp((LPCTSTR)strItem, "<INPUT", 6))
{
strItem = strInput.Mid(iBeginPos, (iEndPos + 1 - iBeginPos));
strNew = WebUpdateInput(strItem);
}
else if (!strItem.Compare(_T("<SELECT")))
{
strItem = strInput.Mid(iBeginPos, (iEndPos + 1 - iBeginPos));
strNew = WebUpdateSelect(strItem);
}
else if (!strItem.Compare(_T("<OPTION")))
{
strItem = strInput.Mid(iBeginPos, (iEndPos + 1 - iBeginPos));
strNew = WebUpdateOption(strItem);
}
else
{
iStartIndex = iEndPos + 1;
continue;
}
strOutput += strInput.Left(iBeginPos);
strOutput += strNew;
strInput = strInput.Right(strInput.GetLength() - iEndPos - 1);
iStartIndex = 0;
}
strOutput += strInput;
out.WriteString(strOutput);
in.Close();
out.Close();
}
void OnWeb2Info(CString strSrcFile, CString strDstFile, BOOL bForce)
{
CStdioFile in, out;
CString strInput, strOutput;
CString strItem, strNew;
CStringList listOptions;
POSITION pos;
//.........这里部分代码省略.........
示例10: getDataFile
bool CLevel::loadNW(CString& pFileName)
{
CStringList levelData;
CString version;
char* dataFile = getDataFile(pFileName.text());
if(!strlen(dataFile))
return false;
if(!levelData.load(dataFile))
return false;
if(levelData.count() < 1)
return false;
version = levelData[0];
modTime = getFileModTime(dataFile);
fileName = pFileName;
if(version == "GLEVNW01" || version == "GSERVL01")
{
for(int i = 1; i < levelData.count(); i ++)
{
CStringList words;
words.load(levelData[i].text(), " ");
if(words.count() <= 0)
continue;
if(words[0] == "BOARD")
{
if(words.count() <= 5)
continue;
int x = atoi(words[1].text());
int y = atoi(words[2].text());
int w = atoi(words[3].text());
CString& data = words[5];
if(x >= 0 && x <= 64 && y >= 0 && y <= 64 && w > 0 && x + w <= 64)
{
if(data.length() >= w*2)
{
for(int ii = x; ii < x + w; ii++)
{
char left = data.readChar();
char top = data.readChar();
short tile = base64.find(left) << 6;
tile += base64.find(top);
tiles[ii + y*64] = tile;
}
}
}
} else if(words[0] == "LINK")
{
if(words.count() <= 7)
continue;
if(strlen(getDataFile(words[1].text())))
{
links.add(new CLink(words[1], atoi(words[2].text()), atoi(words[3].text()),
atoi(words[4].text()), atoi(words[5].text()), words[6], words[7]));
}
} else if(words[0] == "CHEST")
{
if(words.count() <= 4)
continue;
for(int ii = 0; ii < itemcount; ii++)
{
if(words[3] == itemNames[ii])
{
chests.add(new CChest(atoi(words[1].text()), atoi(words[2].text()),
atoi(words[4].text()), ii));
break;
}
}
} else if(words[0] == "NPC")
{
if(words.count() <= 3)
continue;
CString image, code, code2;
float x, y;
if(words[1] != "-")
image = words[1];
x = (float)atof(words[2].text());
y = (float)atof(words[3].text());
for(i++; i < levelData.count() && levelData[i] != "NPCEND"; i++)
code << levelData[i] << "\xa7";
// Create the new NPC. Do this before parsing the join commands.
// The CNpc constructor will remove all comments.
CNpc* jnpc = new CNpc( image, code, x, y, this, true );
// Now filter out the join commands.
CStringList npcData;
npcData.load( jnpc->clientCode.text(), "\xa7" );
for ( int j = 0; j < npcData.count(); ++j )
code2 << processNpcLine( npcData[j] ) << "\xa7";
jnpc->clientCode = code2;
// Now, add all the joined files to the code.
if ( joinList.count() > 0 )
{
CString* file = 0;
//.........这里部分代码省略.........
示例11: WebUpdateInput
CString WebUpdateInput(CString strInput)
{
CString strOutput, strItem, strTemp;
CStringList strList;
POSITION pos1, pos2;
int iType;
WebGetStringList(strInput, 6, strList);
strOutput = _T("<INPUT");
iType = ITEM_TYPE_TEXT;
#ifndef __GNUC__
for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
{
pos2 = pos1;
strItem = strList.GetNext(pos1);
strTemp = strItem.Left(5);
if (!strTemp.CompareNoCase(_T("name=")))
{
strItem = strItem.Right(strItem.GetLength()-5);
strItem = RemoveQuote(strItem);
strOutput += _T(" name=");
strOutput += strItem;
strList.RemoveAt(pos2);
}
else if (!strTemp.CompareNoCase(_T("type=")))
{
strTemp = strItem.Right(strItem.GetLength()-5);
strTemp = RemoveQuote(strTemp);
if (!strTemp.CompareNoCase(_T("checkbox")))
{
iType = ITEM_TYPE_CHECKBOX;
}
else if (!strTemp.CompareNoCase(_T("text")))
{
iType = ITEM_TYPE_TEXT;
}
else if (!strTemp.CompareNoCase(_T("password")))
{
iType = ITEM_TYPE_PASSWORD;
}
else if (!strTemp.CompareNoCase(_T("radio")))
{
iType = ITEM_TYPE_RADIO;
}
else
{
iType = ITEM_TYPE_UNKNOWN;
}
}
else if (!strItem.CompareNoCase(_T("checked")))
{
strList.RemoveAt(pos2);
}
}
#ifndef __GNUC__
for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
{
pos2 = pos1;
strItem = strList.GetNext(pos1);
strTemp = strItem.Left(6);
if (!strTemp.CompareNoCase(_T("value=")))
{
if (iType == ITEM_TYPE_CHECKBOX || iType == ITEM_TYPE_TEXT || iType == ITEM_TYPE_PASSWORD)
{
strList.RemoveAt(pos2);
}
else if (iType == ITEM_TYPE_RADIO)
{
strItem = strItem.Right(strItem.GetLength()-6);
strItem = RemoveQuote(strItem);
strOutput += _T(" value=");
strOutput += strItem;
strList.RemoveAt(pos2);
}
}
}
#ifndef __GNUC__
for (pos1 = strList.GetHeadPosition(); pos1 != NULL;)
#else
for (pos1 = strList.begin(); pos1 != strList.end(); ++pos1)
#endif
{
strOutput += _T(' ');
strItem = strList.GetNext(pos1);
strOutput += strItem;
}
strOutput += _T('>');
return strOutput;
}
示例12: ASSERT
//.........这里部分代码省略.........
iCurrMenu = iIndex;
}
}
}
}
//--------------------------
// Add a default frame menu:
//--------------------------
CString strName;
{
CBCGLocalResource locaRes;
strName.LoadString (IDS_BCGBARRES_DEFUALT_MENU);
}
int iIndex = m_wndMenuesList.AddString (strName);
m_wndMenuesList.SetItemData (iIndex, (DWORD) NULL);
if (iCurrMenu == -1)
{
m_bIsDefaultMDIMenu = TRUE;
iCurrMenu = iIndex;
}
m_hmenuSelected = m_hmenuCurr;
m_wndMenuesList.SetCurSel (iCurrMenu);
UpdateData (FALSE);
OnSelchangeMenuList ();
}
else
{
//-------------------------------------------------
// No menubar found, disable menu selecting engine:
//-------------------------------------------------
m_wndMenuesList.EnableWindow (FALSE);
GetDlgItem(IDC_BCGBARRES_RESET_FRAME_MENU)->EnableWindow(FALSE);
CBCGLocalResource locaRes;
m_strMenuDescr.LoadString (IDS_BCGBARRES_NO_MENUBAR);
UpdateData (FALSE);
}
//--------------------------
// Initialize context menus:
//--------------------------
{
CBCGLocalResource locaRes;
CString strNoContextMenu;
strNoContextMenu.LoadString (IDS_BCGBARRES_NO_CONTEXT);
m_wndContextMenus.AddString (strNoContextMenu);
m_wndContextMenus.SetCurSel (0);
}
if (g_pContextMenuManager != NULL)
{
CStringList listOfNames;
g_pContextMenuManager->GetMenuNames (listOfNames);
for (pos = listOfNames.GetHeadPosition (); pos != NULL;)
{
CString strName = listOfNames.GetNext (pos);
m_wndContextMenus.AddString (strName);
}
m_wndContextMenuCaption.EnableWindow (m_wndContextMenus.GetCount () > 1);
m_wndContextMenus.EnableWindow (m_wndContextMenus.GetCount () > 1);
}
else
{
//-------------------------------
// Hide all context menus fields:
//-------------------------------
m_wndContextMenuCaption.ShowWindow (SW_HIDE);
m_wndContextMenus.ShowWindow (SW_HIDE);
m_wndContextHint.ShowWindow (SW_HIDE);
m_wndContextFrame.ShowWindow (SW_HIDE);
m_wndResetMenuButton.ShowWindow (SW_HIDE);
}
CBCGToolbarCustomize* pWndParent = DYNAMIC_DOWNCAST (CBCGToolbarCustomize, GetParent ());
ASSERT (pWndParent != NULL);
if ((pWndParent->GetFlags () & BCGCUSTOMIZE_MENU_SHADOWS) == 0)
{
m_wndMenuShadows.ShowWindow (SW_HIDE);
}
if ((pWndParent->GetFlags () & BCGCUSTOMIZE_MENU_ANIMATIONS) == 0)
{
m_wndMenuAnimationsLabel.ShowWindow (SW_HIDE);
m_wndMenuAnimations.ShowWindow (SW_HIDE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例13: WebLogic
BOOL WebLogic(const char * strParas, char * szReturn, int& nSize)
//(CStringList ¶mList, char *szReturn)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
//参数解析:
CString
strServIp = _T(""),
strServPort = _T(""),
strUserName = _T(""),
strUserPwd = _T(""),
strTaskType = _T(""),
strTaskParam = _T("");
CString
strProxyServ = _T(""),
strProxyUser = _T("");
int nServerPort = 21;
int nTimeout = 60;
BOOL bRet = FALSE;
// Check Content Change
CStringList paramList;
MakeStringListByChar(paramList,strParas);
POSITION pos = paramList.GetHeadPosition();
while(pos)
{
CString strTemp = paramList.GetNext(pos);
if(strTemp.Find(__USERNAME__, 0) == 0)
{
strUserName = strTemp.Right(strTemp.GetLength() - strlen(__USERNAME__));
}
else if(strTemp.Find(__PASSWORD__, 0) == 0)
{
strUserPwd = strTemp.Right(strTemp.GetLength() - strlen(__PASSWORD__));
}
else if(strTemp.Find(__TIMEOUT__, 0) == 0)
{
nTimeout = atoi(strTemp.Right(strTemp.GetLength() - strlen(__TIMEOUT__)));
}
else if(strTemp.Find(__SERVERIP__, 0) == 0)
{
strServIp = strTemp.Right(strTemp.GetLength() - strlen(__SERVERIP__));
}
else if(strTemp.Find(__SERVERPORT__, 0) == 0)
{
strServPort = strTemp.Right(strTemp.GetLength() - strlen(__SERVERPORT__));
}
else if(strTemp.Find(__TASKTYPE__, 0) == 0)
{
strTaskType = strTemp.Right(strTemp.GetLength() - strlen(__TASKTYPE__));
}
else if(strTemp.Find(__TASKPARAM__, 0) == 0)
{
strTaskParam = strTemp.Right(strTemp.GetLength() - strlen(__TASKPARAM__));
}
else
{
}
}
if(strUserName.IsEmpty())
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_UserName"));//"缺少用户姓名!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
return FALSE;
}
if(strUserPwd.IsEmpty())
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_Password"));//"缺少用户密码!");//<%IDS_Monitor_40%>
return FALSE;
}
if(strServIp.IsEmpty())
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_ServerAddress"));//"缺少服务器地址!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
return FALSE;
}
if(strServPort.IsEmpty())
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_ServerPort"));//"缺少服务器端口地址!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
return FALSE;
}
if(strTaskType.IsEmpty())
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("IDS_Poor_TaskType"));//"缺少任务类型!");//<%IDS_Monitor_40%>"缺少FTP服务器地址"
return FALSE;
}
if(strTaskParam.IsEmpty())
{
//为解决大部分Weblogic监视器不能工作问题,修改代码。修改开始 苏合 2007-09-18
//strTaskParam = "null";
strTaskParam = "";
//.........这里部分代码省略.........
示例14: AFX_MANAGE_STATE
//////////////////////////////////////////////////////////////////////////
//简要描述 : 设置扩展属性配置文件
//输入参数 :
//返 回 值 :
//
//
//修改日志 :
//////////////////////////////////////////////////////////////////////////
STDMETHODIMP CDwgWriter::put_XDataXMLConfigFile(BSTR sXMLFile)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (sXMLFile == NULL) return S_OK;
CString sXml = sXMLFile;
if (sXml.IsEmpty()) return S_OK;
m_XDataCfgs.RemoveAll();
try
{
CXMLFile xmlfile;
xmlfile.load(sXml);
MSXML2::IXMLDOMNodePtr pNode;
MSXML2::IXMLDOMNodePtr pExtAttrNode = NULL;
xmlfile.GetNode("LAYERS", pNode);
if (pNode == NULL)
{
//AfxMessageBox("XML配置文件不正确,请检查。");
m_dwgWriter.WriteLog("XML配置文件不正确,请检查。");
return S_FALSE;
}
pNode = pNode->GetfirstChild();
if (pNode == NULL)
{
//AfxMessageBox("XML配置文件不正确,请检查。");
m_dwgWriter.WriteLog("XML配置文件不正确,请检查。");
return S_FALSE;
}
CComBSTR bsNodeName;
CComBSTR bsExtAttrs;
CString sLayerName;
CString sRegAppName;
CString sExtAttrs;
while (pNode != NULL)
{
//得到图层名
pNode->get_nodeName(&bsNodeName);
sLayerName = bsNodeName;
//去掉前面的_前缀,解决数字开头的节点问题
CString sSign = "";
sSign = sLayerName.Mid(0, 1);
if (sSign.CompareNoCase("_") == 0)
{
sLayerName = sLayerName.Mid(1);
}
XDataAttrLists* pExtAttrs = new XDataAttrLists();
//得到图层下的注册应用名
if (pNode->hasChildNodes())
{
pExtAttrNode = pNode->GetfirstChild();
while (pExtAttrNode != NULL)
{
pExtAttrNode->get_nodeName(&bsNodeName);
sRegAppName = bsNodeName;
//去掉前面的_前缀,解决数字开头的节点问题
sSign = sRegAppName.Mid(0, 1);
if (sSign.CompareNoCase("_") == 0)
{
sRegAppName = sRegAppName.Mid(1);
}
pExtAttrNode->get_text(&bsExtAttrs);
sExtAttrs = bsExtAttrs;
CStringList* pAttrLst = new CStringList();
//解析注册应用名下的属性字段名称
CString sAttr;
int iPos = sExtAttrs.Find(',');
while (iPos > 0)
{
sAttr = sExtAttrs.Mid(0, iPos);
sExtAttrs = sExtAttrs.Mid(iPos + 1);
if (!sAttr.IsEmpty())
{
pAttrLst->AddTail(sAttr);
}
iPos = sExtAttrs.Find(',');
}
if (iPos == -1)
{
if (!sExtAttrs.IsEmpty())
{
pAttrLst->AddTail(sExtAttrs);
}
}
pExtAttrs->SetAt(sRegAppName, pAttrLst);
//得到下一个注册应用名的配置
//.........这里部分代码省略.........
示例15: read_iap
int Ctbg::read_iap(int fhandle, int onlyopen, CStringList &filelist)
{
char *filedata;
char tmpfilename[MAX_PATH];
CString outfilepath, syscommand;
int esize, iapfullsize;
int fhandle2;
int ret;
int hasweidu;
int maxlen;
hasweidu=1;
maxlen=filelength(fhandle);
if(maxlen<sizeof(iapheader) ) return -1; //short file, invalid item
if(read(fhandle,&iapheader,sizeof(iapheader) )!=sizeof(iapheader) )
{
return -2;
}
if(memcmp(iapheader.signature,"IAP",3) ) return -4; // not iap
if(iapheader.totallen!=maxlen) return -1; //iap total length is invalid
actfilecount=0;
iapfullsize=sizeof(iapheader);
KillIapFileHeaders();
iapfileheaders=new iap_file_header[iapheader.tbgcount+iapheader.othercount];
if(!iapfileheaders) return -3;
iapfilecount=iapheader.tbgcount+iapheader.othercount;
esize=iapfilecount*sizeof(iap_file_header);
if(read(fhandle,iapfileheaders,esize)!=esize)
{
return -2;
}
iapfullsize+=esize;
if(onlyopen)
{
AllocateHeaders(iapheader.tbgcount,iapheader.othercount);
}
//handle tbg files, iap files
for(actfilecount=0;actfilecount<iapfilecount;actfilecount++)
{
if(iapfileheaders[actfilecount].nameoffset!=iapfullsize) return -2;
esize=iapfileheaders[actfilecount].namelength;
iapfullsize+=esize;
if(iapfullsize>maxlen) return -2;
if(esize>=MAX_PATH) return -3;
if(read(fhandle,tmpfilename,esize)!=esize) return -2;
outfilepath=bgfolder+CString(tmpfilename,esize);
if(iapfileheaders[actfilecount].fileoffset!=iapfullsize) return -2;
esize=iapfileheaders[actfilecount].filelength;
iapfullsize+=esize;
if(iapfullsize>maxlen) return -2;
if(actfilecount<iapheader.tbgcount)
{ //tbg file
if(onlyopen)
{
m_tbgnames[actfilecount]=outfilepath;
lseek(fhandle,esize,SEEK_CUR);
continue;
}
ret=read_tbg(fhandle,esize);
if(ret<0) return ret;
if(ret==9) return 0; //handled in read_tbg already
ret=ImportFile();
if(ret<0) return ret;
continue;
}
//plain file
if(onlyopen)
{
m_othernames[actfilecount-iapheader.tbgcount]=outfilepath;
lseek(fhandle,esize,SEEK_CUR);
continue;
}
filedata=new char[esize+1];
if(!filedata) return -3;
filedata[esize]=0; //for using it as a string
if(read(fhandle,filedata,esize)!=esize)
{
delete [] filedata;
return -2;
}
fhandle2=creat(outfilepath,S_IWRITE);
if(fhandle2<1) return -2;
if(write(fhandle2,filedata,esize)!=esize) ret=-2;
else ret=0;
close(fhandle2);
if(ret<0)
{
delete [] filedata;
return ret;
}
if((iapfileheaders[actfilecount].launchflag&2) && hasweidu)
{
delete [] filedata;
if(weidupath.IsEmpty())
{
MessageBox(0,"Can't import dialog source without WeiDU installed!","Warning",MB_ICONEXCLAMATION|MB_OK);
hasweidu=0;
//.........这里部分代码省略.........