Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
RoleNameFilter.cpp
Package: SwordOnline.rar [view]
Upload User: dzyhzl
Upload Date: 2019-04-29
Package Size: 56270k
Code Size: 2k
Category:
Game Server Simulator
Development Platform:
C/C++
- // RoleNameFilter.cpp: implementation of the CRoleNameFilter class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "RoleNameFilter.h"
- //////////////////////////////////////////////////////////////////////
- const char file_rolenameflt[] = "goddess_rolename.flt";
- //////////////////////////////////////////////////////////////////////
- const size_t EXP_MAXLEN = 1024;
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CRoleNameFilter::CRoleNameFilter()
- : m_pTextFilter(NULL)
- {
- }
- CRoleNameFilter::~CRoleNameFilter()
- {
- }
- BOOL CRoleNameFilter::Initialize()
- {
- if (m_pTextFilter)
- return FALSE;
- FILE* pFileRoleNameFlt = fopen(file_rolenameflt, "rt");
- if (pFileRoleNameFlt == NULL)
- return FALSE;
- extern CFilterTextLib g_libFilterText;
- if (SUCCEEDED(g_libFilterText.CreateTextFilter(&m_pTextFilter)))
- {
- while (!feof(pFileRoleNameFlt))
- {
- char exp[EXP_MAXLEN];
- if (!fgets(exp, EXP_MAXLEN, pFileRoleNameFlt))
- break;
- if (!exp[0])
- continue;
- //cut the 'rn' of tail
- size_t explen = strlen(exp);
- while (explen > 0 && (exp[explen - 1] == 'r' || exp[explen - 1] == 'n'))
- exp[--explen] = 0;
- if (explen <= 0)
- continue;
- m_pTextFilter->AddExpression(exp);
- }
- }
- fclose(pFileRoleNameFlt);
- return m_pTextFilter != NULL;
- }
- BOOL CRoleNameFilter::Uninitialize()
- {
- if (m_pTextFilter)
- {
- m_pTextFilter->Release();
- m_pTextFilter = NULL;
- }
- return TRUE;
- }
- BOOL CRoleNameFilter::IsTextPass(LPCTSTR text)
- {
- if (!m_pTextFilter)
- return FALSE;
- return m_pTextFilter->IsTextPass(text);
- }