LosaDev source snapshot 2019

This commit is contained in:
LosaDev committed 2026-11-07 13:30:45 +07:00
commit c198676e97
20588 files changed
+8812878

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtest", "libtest\libtest.vcxproj", "{201A7015-1664-4C02-BC30-8B99D2403B42}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{201A7015-1664-4C02-BC30-8B99D2403B42}.Debug|Win32.ActiveCfg = Debug|Win32
{201A7015-1664-4C02-BC30-8B99D2403B42}.Debug|Win32.Build.0 = Debug|Win32
{201A7015-1664-4C02-BC30-8B99D2403B42}.Release|Win32.ActiveCfg = Release|Win32
{201A7015-1664-4C02-BC30-8B99D2403B42}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,214 @@
#include "stdafx.h"
#include "ioDataChunk.h"
ioDataChunk::ioDataChunk()
{
m_pData = NULL;
m_pPos = NULL;
m_pEnd = NULL;
m_iSize = 0;
}
ioDataChunk::~ioDataChunk()
{
SAFEDELETEARRAY(m_pData);
}
BYTE* ioDataChunk::Allocate( int iSize, const BYTE *pPtr )
{
assert( iSize > 0 );
SAFEDELETEARRAY( m_pData );
m_pPos = NULL;
m_pEnd = NULL;
m_iSize = 0;
m_pData = new BYTE[ iSize + 1 ]; // +1 is for null
if( m_pData )
{
m_pData[iSize] = '\0';
m_pPos = m_pData;
m_pEnd = m_pData + iSize;
m_iSize = iSize;
if( pPtr )
{
memcpy( m_pData, pPtr, iSize );
}
}
return m_pData;
}
bool ioDataChunk::AllocateFromFile( const char *szName )
{
Clear();
HANDLE hFile = CreateFile( szName,
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
NULL );
if( INVALID_HANDLE_VALUE == hFile )
return false;
DWORD dwFileSize = GetFileSize(hFile, NULL);
if( INVALID_FILE_SIZE == dwFileSize )
{
CloseHandle( hFile );
return false;
}
m_pData = new BYTE[ dwFileSize + 1 ]; // +1 is for null
m_pData[dwFileSize] = '\0';
DWORD dwReadedSize = 0;
BOOL bRet = ReadFile( hFile,
m_pData,
dwFileSize,
&dwReadedSize,
NULL );
if( FALSE == bRet )
{
SAFEDELETEARRAY(m_pData);
CloseHandle( hFile );
return false;
}
m_iSize = dwFileSize;
m_pPos = m_pData;
m_pEnd = m_pData + dwFileSize;
CloseHandle( hFile );
return true;
}
void ioDataChunk::Clear()
{
SAFEDELETEARRAY( m_pData );
m_iSize = 0;
}
int ioDataChunk::Read( void *pBuf, int iSize )
{
int iCnt = iSize;
if( m_pPos + iSize > m_pEnd )
iCnt = m_pEnd - m_pPos;
if( iCnt > 0 )
{
memcpy( pBuf, (const void*)m_pPos, iCnt );
m_pPos += iCnt;
}
return iCnt;
}
void ioDataChunk::Seek( int iPos )
{
if( iPos <= m_iSize )
{
m_pPos = m_pData + iPos;
}
}
bool ioDataChunk::IsEOF() const
{
if( m_pPos >= m_pEnd )
return true;
return false;
}
int ioDataChunk::ReadUpTo( void *pBuf, int iSize, const char* pDelim )
{
int iPos = strcspn( (const char*)m_pPos, pDelim );
if( iPos > iSize )
iPos = iSize;
if( m_pPos + iPos > m_pEnd )
iPos = m_pEnd - m_pPos;
if( iPos > 0 )
{
memcpy( pBuf, (const void*)m_pPos, iPos );
}
m_pPos += iPos + 1;
return iPos;
}
int ioDataChunk::SkipUpTo( const char *pDelim )
{
int iPos = strcspn( (const char*)m_pPos, pDelim );
if( m_pPos + iPos > m_pEnd )
iPos = m_pEnd - m_pPos;
m_pPos += iPos + 1;
return iPos;
}
void ioDataChunk::GetLine( std::string &line, bool bTrim )
{
char pBuf[512];
int iCount = ReadUpTo( pBuf, 511 );
pBuf[iCount] = '\0';
line = pBuf;
if( bTrim )
{
int iLen = line.length();
int lSpace, rSpace;
lSpace = rSpace = 0;
int i=0;
for(int i=0 ;
i<iLen && ( line.at(i) == ' ' || line.at(i) == '\t' || line.at(i) == '\r' ) ;
++lSpace, i++ );
if( lSpace < iLen )
{
for(int i= iLen-1 ;
i>=0 && ( line.at(i) == ' ' || line.at(i) == '\t' || line.at(i) == '\r' ) ;
rSpace++, i-- );
}
line = line.substr( lSpace, iLen - lSpace - rSpace );
}
}
void ioDataChunk::SkipToNextOpenBrace()
{
std::string line = "";
while( !IsEOF() && line !="{" )
{
GetLine( line );
}
}
void ioDataChunk::SkipToNextCloseBrace()
{
std::string line = "";
while( !IsEOF() && line.substr(0,1) != "}" )
{
GetLine( line );
}
}
@@ -0,0 +1,44 @@
#ifndef _ioDataChunk_h_
#define _ioDataChunk_h_
class ioDataChunk
{
private:
BYTE *m_pData;
BYTE *m_pPos;
BYTE *m_pEnd;
int m_iSize;
public:
BYTE* Allocate( int iSize, const BYTE *pPtr = NULL );
bool AllocateFromFile( const char *szName );
int Read( void *pBuf, int iSize );
void Seek( int iPos );
void Clear();
public:
int ReadUpTo( void *pBuf, int iSize, const char* pDelim = "\n" );
int SkipUpTo( const char* pDelim = "\n" );
void SkipToNextOpenBrace();
void SkipToNextCloseBrace();
public:
void GetLine( std::string &line, bool bTrim = true );
bool IsEOF() const;
public:
inline const BYTE* GetPtr() const { return m_pData; }
inline BYTE* GetPtr() { return m_pData; }
inline int GetSize() const { return m_iSize; }
public:
ioDataChunk();
~ioDataChunk();
};
#endif
@@ -0,0 +1,298 @@
#include "stdafx.h"
#include "ioINIParser.h"
#include "ioINILoader.h"
#include <strsafe.h>
ioINILoader::ioINILoader()
{
ZeroMemory( m_szFileName, MAX_PATH );
ZeroMemory( m_szTitle, MAX_PATH );
m_pParser = NULL;
}
ioINILoader::ioINILoader( const char *szFileName , bool bMemoryParsing )
{
ZeroMemory( m_szFileName, MAX_PATH );
ZeroMemory( m_szTitle, MAX_PATH );
GetCurrentDirectory( MAX_PATH, m_szFileName );
StringCbCat( m_szFileName, sizeof( m_szFileName ), "\\" );
StringCbCat( m_szFileName, sizeof( m_szFileName ), szFileName );
m_pParser = NULL;
if(bMemoryParsing)
{
DoMemoryParsing();
}
}
ioINILoader::ioINILoader( const char *szPath, const char *szFileName , bool bMemoryParsing )
{
ZeroMemory( m_szFileName, MAX_PATH );
ZeroMemory( m_szTitle, MAX_PATH );
StringCbPrintf( m_szFileName, sizeof( m_szFileName ), "%s/%s", szPath, szFileName );
m_pParser = NULL;
if(bMemoryParsing)
{
DoMemoryParsing();
}
}
ioINILoader::~ioINILoader()
{
SAFEDELETE( m_pParser );
}
void ioINILoader::SetFileName( const char *szFileName , bool bMemoryParsing )
{
StringCbCopy( m_szFileName, sizeof( m_szFileName ), szFileName );
SAFEDELETE( m_pParser );
if(bMemoryParsing)
{
DoMemoryParsing();
}
}
void ioINILoader::SetTitle( const char *szTitle )
{
StringCbCopy( m_szTitle, sizeof( m_szTitle ), szTitle );
}
bool ioINILoader::DoMemoryParsing()
{
SAFEDELETE( m_pParser );
m_pParser = new ioINIParser;
if( m_pParser->ParsingFile( m_szFileName ) )
return true;
SAFEDELETE( m_pParser );
return false;
}
bool ioINILoader::DoMemoryParsingFromMemory( ioTextStream &rkStream )
{
SAFEDELETE( m_pParser );
m_pParser = new ioINIParser;
m_pParser->ParseINI( rkStream );
return true;
}
bool ioINILoader::LoadBool( const char *szTitle, const char *szKeyName, bool bDefault )
{
int iValue = 0;
if( bDefault )
{
iValue = 1;
}
if( m_pParser )
{
const char *szValue = m_pParser->GetValue( szTitle, szKeyName );
if( szValue )
{
iValue = atoi( szValue );
}
}
else
{
iValue = GetPrivateProfileInt( szTitle, szKeyName, iValue, m_szFileName );
}
if( iValue != 0 )
return true;
return false;
}
int ioINILoader::LoadInt( const char *szTitle, const char *szKeyName, int iDefault )
{
int iValue = iDefault;
if( m_pParser )
{
const char *szValue = m_pParser->GetValue( szTitle, szKeyName );
if( szValue )
{
iValue = atoi( szValue );
}
}
else
{
iValue = GetPrivateProfileInt( szTitle, szKeyName, iDefault, m_szFileName );
}
return iValue;
}
float ioINILoader::LoadFloat( const char *szTitle, const char *szKeyName, float fDefault )
{
float fValue = fDefault;
if( m_pParser )
{
const char *szValue = m_pParser->GetValue( szTitle, szKeyName );
if( szValue )
fValue = atof( szValue );
else
fValue = fDefault;
}
else
{
char szBuf[MAX_PATH];
GetPrivateProfileString( szTitle, szKeyName, "", szBuf, MAX_PATH, m_szFileName );
if( strcmp( szBuf, "" ) )
fValue = (float)atof( szBuf );
else
fValue = fDefault;
}
return fValue;
}
void ioINILoader::LoadVector( const char *szTitle, Vector3 &vVec )
{
vVec.x = LoadFloat( szTitle, "X", 0.0f );
vVec.y = LoadFloat( szTitle, "Y", 0.0f );
vVec.z = LoadFloat( szTitle, "Z", 0.0f );
}
void ioINILoader::LoadString( const char *szTitle,
const char *szKeyName,
const char *szDefault,
char *szBuf,
int iBufLen )
{
if( m_pParser )
{
const char *szValue = m_pParser->GetValue( szTitle, szKeyName );
if( szValue )
{
StringCbCopyN( szBuf, iBufLen, szValue, iBufLen - 1 );
}
else
{
StringCbCopyN( szBuf, iBufLen, szDefault, iBufLen - 1 );
}
}
else
{
GetPrivateProfileString( szTitle, szKeyName, szDefault, szBuf, iBufLen, m_szFileName );
}
}
bool ioINILoader::LoadBool( const char *szKeyName, bool bDefault )
{
return LoadBool( m_szTitle, szKeyName, bDefault );
}
int ioINILoader::LoadInt( const char *szKeyName, int iDefault )
{
return LoadInt( m_szTitle, szKeyName, iDefault );
}
float ioINILoader::LoadFloat( const char *szKeyName, float fDefault )
{
return LoadFloat( m_szTitle, szKeyName, fDefault );
}
void ioINILoader::LoadVector( Vector3 &vVec )
{
LoadVector( m_szTitle, vVec );
}
void ioINILoader::LoadString( const char *szKeyName,
const char *szDefault,
char *szBuf,
int iBufLen )
{
LoadString( m_szTitle, szKeyName, szDefault, szBuf, iBufLen );
}
void ioINILoader::SaveString( const char *szTitle, const char *szKeyName, const char *szBuf )
{
WritePrivateProfileString( szTitle, szKeyName, szBuf, m_szFileName );
}
void ioINILoader::SaveInt( const char *szTitle, const char *szKeyName, int iValue )
{
char szBuf[MAX_PATH]="";
StringCbPrintf( szBuf, sizeof( szBuf ), "%d", iValue );
WritePrivateProfileString( szTitle, szKeyName, szBuf, m_szFileName );
}
void ioINILoader::SaveFloat( const char *szTitle, const char *szKeyName, float fValue, bool bNoLimit )
{
char szBuf[MAX_PATH]="";
if( bNoLimit )
{
StringCbPrintf( szBuf, sizeof( szBuf ), "%f", fValue );
}
else
{
StringCbPrintf( szBuf, sizeof( szBuf ), "%.2f", fValue );
}
WritePrivateProfileString( szTitle, szKeyName, szBuf, m_szFileName );
}
void ioINILoader::SaveBool( const char *szTitle, const char *szKeyName, bool bValue )
{
if( bValue )
{
WritePrivateProfileString( szTitle, szKeyName, "1", m_szFileName );
}
else
{
WritePrivateProfileString( szTitle, szKeyName, "0", m_szFileName );
}
}
void ioINILoader::SaveVector( const char *szTitle, const Vector3 &vVec )
{
char szBuf[MAX_PATH]="";
StringCbPrintf( szBuf, sizeof( szBuf ), "%.2f", vVec.x );
WritePrivateProfileString( szTitle, "X", szBuf, m_szFileName );
StringCbPrintf( szBuf, sizeof( szBuf ), "%.2f", vVec.y );
WritePrivateProfileString( szTitle, "Y", szBuf, m_szFileName );
StringCbPrintf( szBuf, sizeof( szBuf ), "%.2f", vVec.z );
WritePrivateProfileString( szTitle, "Z", szBuf, m_szFileName );
}
void ioINILoader::SaveString( const char *szKeyName, const char *szBuf )
{
SaveString( m_szTitle, szKeyName, szBuf );
}
void ioINILoader::SaveInt( const char *szKeyName, int iValue )
{
SaveInt( m_szTitle, szKeyName, iValue );
}
void ioINILoader::SaveFloat( const char *szKeyName, float fValue, bool bNoLimit )
{
SaveFloat( m_szTitle, szKeyName, fValue, bNoLimit );
}
void ioINILoader::SaveBool( const char *szKeyName, bool bValue )
{
SaveBool( m_szTitle, szKeyName, bValue );
}
void ioINILoader::SaveVector( const Vector3 &vVec )
{
SaveVector( m_szTitle, vVec );
}
@@ -0,0 +1,69 @@
#ifndef _ioINILoader_h_
#define _ioINILoader_h_
class ioINIParser;
class ioTextStream;
class ioINILoader
{
private:
char m_szFileName[MAX_PATH];
char m_szTitle[MAX_PATH];
ioINIParser *m_pParser;
public:
void SetFileName( const char *szFileName , bool bMemoryParsing = true);
void SetTitle( const char *szTitle );
bool DoMemoryParsing();
bool DoMemoryParsingFromMemory( ioTextStream &rkStream );
const char* GetFileName() const { return m_szFileName; }
const char* GetTitle() const { return m_szTitle; }
public:
bool LoadBool( const char *szTitle, const char *szKeyName, bool bDefault );
int LoadInt( const char *szTitle, const char *szKeyName, int iDefault );
float LoadFloat( const char *szTitle, const char *szKeyName, float fDefault );
void LoadVector( const char *szTitle, Vector3 &vVec );
void LoadString( const char *szTitle,
const char *szKeyName,
const char *szDefault,
char *szBuf,
int iBufLen );
public:
bool LoadBool( const char *szKeyName, bool bDefault );
int LoadInt( const char *szKeyName, int iDefault );
float LoadFloat( const char *szKeyName, float fDefault );
void LoadVector( Vector3 &vVec );
void LoadString( const char *szKeyName,
const char *szDefault,
char *szBuf,
int iBufLen );
public:
void SaveString( const char *szTitle, const char *szKeyName, const char *szBuf );
void SaveInt( const char *szTitle, const char *szKeyName, int iValue );
void SaveFloat( const char *szTitle, const char *szKeyName, float fValue, bool bNoLimit = false );
void SaveBool( const char *szTitle, const char *szKeyName, bool bValue );
void SaveVector( const char *szTitle, const Vector3 &vVec );
public:
void SaveString( const char *szKeyName, const char *szBuf );
void SaveInt( const char *szKeyName, int iValue );
void SaveFloat( const char *szKeyName, float fValue, bool bNoLimit = false );
void SaveBool( const char *szKeyName, bool bValue );
void SaveVector( const Vector3 &vVec );
public:
ioINILoader();
ioINILoader( const char *szFileName , bool bMemoryParsing = true );
ioINILoader( const char *szPath, const char *szFileName , bool bMemoryParsing = true );
~ioINILoader();
};
#endif
@@ -0,0 +1,245 @@
#include "stdafx.h"
#include "ioINIParser.h"
#include "ioStream.h"
//#include "../Window.h"
//#include "../MainProcess.h"
using namespace std;
ioINIParser::ioINIParser()
{
m_pPreList = NULL;
}
ioINIParser::~ioINIParser()
{
Clear();
}
bool ioINIParser::ParsingFile( const char *szFileName )
{
Clear();
ioTextStream kStream;
if( !kStream.OpenFile( szFileName ) )
{
//LOG.PrintTimeAndLog( LOG_DEBUG_LEVEL, "ioINIParser::Parsing - %s Load Failed", szFileName );
return false;
}
ParseINI( kStream );
return true;
}
void ioINIParser::ParseINI( ioTextStream &rkStream )
{
std::string line, lastline;
while( !rkStream.IsEOF() )
{
if( lastline.empty() || lastline.at(0) != '[' )
{
rkStream.GetLine( line );
}
else
{
line = lastline;
lastline.at(0) = '\0';
}
if( line.length() == 0 || line.at(0) != '[' )
continue;
lastline = ParseTitle( line, rkStream );
}
}
std::string ioINIParser::ParseTitle( const std::string &szTitle, ioTextStream &rkStream )
{
string line;
KeyList *pKeyList = new KeyList;
if( !pKeyList )
return line;
while( !rkStream.IsEOF() )
{
rkStream.GetLine( line );
if( line.length() == 0 || line.at(0) == ';' )
continue;
if( line.at(0) == '[' ) // New Title
break;
ParseKey( line, pKeyList );
}
if( !pKeyList->empty() )
{
string szTitleText = szTitle.substr( 1, szTitle.length() - 2 );
ioStringConverter::toLowerCase( szTitleText );
m_TitleList.insert( TitleList::value_type( ioHashString(szTitleText.c_str()), pKeyList ) );
}
else
{
delete pKeyList;
}
return line;
}
void ioINIParser::ParseKey( const std::string &line, KeyList *pKeyList )
{
const StringVector &vecparams = ioStringConverter::Split( line, "=", 1 );
if( vecparams.size() != 2 || vecparams[0].empty() )
return;
string szKeyName, szValue;
string::size_type i, tSize;
tSize = vecparams[0].length();
for(i=tSize-1 ; i>=0 ; i-- )
{
if( vecparams[0].at(i) != ' ' &&
vecparams[0].at(i) != '\t' &&
vecparams[0].at(i) != '\r' )
{
szKeyName = vecparams[0].substr( 0, i+1 );
break;
}
}
tSize = vecparams[1].length();
for(i=0 ; i<tSize ; i++ )
{
if( vecparams[1].at(i) != ' ' &&
vecparams[1].at(i) != '\t' &&
vecparams[1].at(i) != '\r' )
{
szValue = vecparams[1].substr( i );
break;
}
}
if( !szKeyName.empty() && !szValue.empty() )
{
ioStringConverter::toLowerCase( szKeyName );
pKeyList->insert( KeyList::value_type( ioHashString(szKeyName.c_str()), szValue ) );
}
}
void ioINIParser::Clear()
{
TitleList::iterator iter;
for( iter=m_TitleList.begin() ; iter!=m_TitleList.end() ; ++iter )
{
delete iter->second;
}
m_TitleList.clear();
m_PreTitle.Clear();
m_pPreList = NULL;
}
int ioINIParser::GetNumTotalTitle() const
{
return m_TitleList.size();
}
int ioINIParser::GetNumTotalKey( int iTitleIdx ) const
{
if( COMPARE( iTitleIdx, 0, GetNumTotalTitle() ) )
{
TitleList::const_iterator iter = m_TitleList.begin();
std::advance( iter, iTitleIdx );
return iter->second->size();
}
return 0;
}
const char* ioINIParser::GetTitle( int iIdx ) const
{
if( COMPARE( iIdx, 0, GetNumTotalTitle() ) )
{
TitleList::const_iterator iter = m_TitleList.begin();
std::advance( iter, iIdx );
return iter->first.c_str();
}
return "";
}
const char* ioINIParser::GetKey( int iTitle, int iKey ) const
{
if( COMPARE( iTitle, 0, GetNumTotalTitle() ) )
{
TitleList::const_iterator iter = m_TitleList.begin();
std::advance( iter, iTitle );
int iNumKey = iter->second->size();
if( COMPARE( iKey, 0, iNumKey ) )
{
KeyList::const_iterator iKeyIter = iter->second->begin();
std::advance( iKeyIter, iKey );
return iKeyIter->first.c_str();
}
}
return "";
}
const char* ioINIParser::GetValue( int iTitle, int iKey ) const
{
const char *pTitle = GetTitle( iTitle );
const char *pKey = GetKey( iTitle, iKey );
return GetValue( pTitle, pKey );
}
const char* ioINIParser::GetValue( const char *szTitle, const char *szKeyName ) const
{
char szLowTitle[MAX_PATH];
strcpy_s( szLowTitle, szTitle );
_strlwr_s( szLowTitle, sizeof(szLowTitle) );
m_szTitleBuf = szLowTitle;
KeyList *pCurList = NULL;
if( m_pPreList && m_PreTitle == m_szTitleBuf )
{
pCurList = m_pPreList;
}
else
{
TitleList::const_iterator iter = m_TitleList.find( m_szTitleBuf );
if( iter != m_TitleList.end() )
{
pCurList = iter->second;
m_PreTitle = m_szTitleBuf;
m_pPreList = pCurList;
}
}
if( pCurList )
{
char szLowKey[MAX_PATH];
strcpy_s( szLowKey, szKeyName );
_strlwr_s( szLowKey, sizeof(szLowKey) );
m_szKeyNameBuf = szLowKey;
KeyList::const_iterator iKey = pCurList->find( m_szKeyNameBuf );
if( iKey != pCurList->end() )
return iKey->second.c_str();
}
return NULL;
}
@@ -0,0 +1,49 @@
#ifndef _ioINIParser_h_
#define _ioINIParser_h_
class ioTextStream;
class ioINIParser
{
private:
typedef std::map< ioHashString, std::string > KeyList;
typedef std::map< ioHashString, KeyList* > TitleList;
TitleList m_TitleList;
mutable ioHashString m_PreTitle; // 이전에 사용한 타이틀 캐시용도
mutable KeyList *m_pPreList;
mutable ioHashString m_szTitleBuf;
mutable ioHashString m_szKeyNameBuf;
public:
bool ParsingFile( const char *szFileName );
void ParseINI( ioTextStream &rkStream );
void Clear();
private:
std::string ParseTitle( const std::string &szTitle, ioTextStream &rkStream );
void ParseKey( const std::string &line, KeyList *pKeyList );
public:
int GetNumTotalTitle() const;
int GetNumTotalKey( int iTitle ) const;
public: // 없으면 ""
const char* GetTitle( int iIdx ) const;
const char* GetKey( int iTitle, int iKey ) const;
public: // 없으면 NULL
const char* GetValue( int iTitle, int iKey ) const;
const char* GetValue( const char *szTitle, const char *szKeyName ) const;
public:
ioINIParser();
~ioINIParser();
};
#endif
@@ -0,0 +1,74 @@
#include "stdafx.h"
#include "ioStream.h"
ioTextStream::ioTextStream()
{
}
ioTextStream::~ioTextStream()
{
Clear();
}
bool ioTextStream::OpenFile( const char *szFileName )
{
return m_DataChunk.AllocateFromFile( szFileName );
}
BYTE* ioTextStream::OpenMemory( int iSize, BYTE *pBuf )
{
return m_DataChunk.Allocate( iSize, pBuf );
}
void ioTextStream::Clear()
{
m_DataChunk.Clear();
}
const BYTE* ioTextStream::GetPtr() const
{
return m_DataChunk.GetPtr();
}
BYTE* ioTextStream::GetPtr()
{
return m_DataChunk.GetPtr();
}
int ioTextStream::GetSize() const
{
return m_DataChunk.GetSize();
}
int ioTextStream::ReadUpTo( void *pBuf, int iSize, const char* pDelim )
{
return m_DataChunk.ReadUpTo( pBuf, iSize, pDelim );
}
int ioTextStream::SkipUpTo( const char* pDelim )
{
return m_DataChunk.SkipUpTo( pDelim );
}
void ioTextStream::SkipToNextOpenBrace()
{
m_DataChunk.SkipToNextOpenBrace();
}
void ioTextStream::SkipToNextCloseBrace()
{
m_DataChunk.SkipToNextCloseBrace();
}
void ioTextStream::GetLine( std::string &line, bool bTrim )
{
m_DataChunk.GetLine( line, bTrim );
}
bool ioTextStream::IsEOF() const
{
return m_DataChunk.IsEOF();
}
@@ -0,0 +1,77 @@
#ifndef _ioStream_h_
#define _ioStream_h_
#include "ioDataChunk.h"
class ioStream
{
public:
virtual bool OpenFile( const char *szFileName ) = 0;
virtual BYTE* OpenMemory( int iSize, BYTE *pBuf = NULL ) = 0;
virtual void Clear() = 0;
public:
virtual const BYTE* GetPtr() const = 0;
virtual BYTE* GetPtr() = 0;
virtual int GetSize() const = 0;
public:
ioStream(){}
virtual ~ioStream(){}
};
class ioTextStream : public ioStream
{
protected:
ioDataChunk m_DataChunk;
public:
virtual bool OpenFile( const char *szFileName );
virtual BYTE* OpenMemory( int iSize, BYTE *pBuf = NULL );
virtual void Clear();
public:
virtual const BYTE* GetPtr() const;
virtual BYTE* GetPtr();
virtual int GetSize() const;
public:
int ReadUpTo( void *pBuf, int iSize, const char* pDelim = "\n" );
int SkipUpTo( const char* pDelim = "\n" );
void SkipToNextOpenBrace();
void SkipToNextCloseBrace();
public:
void GetLine( std::string &line, bool bTrim = true );
bool IsEOF() const;
public:
ioTextStream();
virtual ~ioTextStream();
};
#endif
+38
View File
@@ -0,0 +1,38 @@
========================================================================
콘솔 응용 프로그램 : libtest 프로젝트 개요
========================================================================
응용 프로그램 마법사에서 이 libtest 응용 프로그램을 만들었습니다.
libtest 응용 프로그램을 구성하는 각 파일에 대한
요약 설명이 포함되어 있습니다.
libtest.vcxproj
응용 프로그램 마법사를 사용하여 생성한 VC++ 프로젝트의 기본 프로젝트 파일입니다.
파일을 생성한 Visual C++ 버전에 대한 정보와 응용 프로그램 마법사를 사용하여 선택한 플랫폼,
구성 및 프로젝트 기능에 대한 정보가 포함되어 있습니다.
libtest.vcxproj.filters
응용 프로그램 마법사를 사용하여 생성된 VC++ 프로젝트의 필터 파일입니다.
이 파일에는 프로젝트의 파일과 필터 간의 연결 정보가 들어 있습니다.
이러한 연결은 특정 노드에서 유사한 확장명으로 그룹화된 파일을 표시하기 위해 IDE에서
사용됩니다. 예를 들어 ".cpp" 파일은 "소스 파일" 필터와 연결되어 있습니다.
libtest.cpp
기본 응용 프로그램 소스 파일입니다.
/////////////////////////////////////////////////////////////////////////////
기타 표준 파일:
StdAfx.h, StdAfx.cpp
이 파일은 미리 컴파일된 헤더(PCH) 파일 libtest.pch와
미리 컴파일된 형식(PCT) 파일 StdAfx.obj를 빌드하는 데 사용됩니다.
/////////////////////////////////////////////////////////////////////////////
기타 참고:
응용 프로그램 마법사에서 사용하는 "TODO:" 주석은 사용자가 추가하거나 사용자 지정해야 하는
소스 코드 부분을 나타냅니다.
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,196 @@
#include "stdafx.h"
#include "ioHashString.h"
ioHashString::ioHashString()
{
m_iCapacity = DEFAULT_CAPACITY;
m_pString = new char[ m_iCapacity ];
Clear();
m_dwHashCode = CalcHashCode( m_pString );
}
ioHashString::ioHashString( const char* str ) : m_pString(NULL)
{
m_iLength = strlen( str );
int iCapacity = max( m_iLength + 1, DEFAULT_CAPACITY );
ReAllocCapacity( iCapacity );
strcpy_s( m_pString, iCapacity, str );
m_dwHashCode = CalcHashCode( str );
}
ioHashString::ioHashString( const ioHashString &rhs ) : m_pString(NULL)
{
m_iLength = rhs.Length();
ReAllocCapacity( rhs.m_iCapacity );
strcpy_s( m_pString, rhs.m_iCapacity, rhs.m_pString );
m_dwHashCode = rhs.m_dwHashCode;
}
ioHashString::~ioHashString()
{
if( m_pString )
{
delete[] m_pString;
m_pString = NULL;
}
}
bool ioHashString::IsEmpty() const
{
return ( m_iLength == 0 );
}
int ioHashString::Length() const
{
return m_iLength;
}
void ioHashString::Clear()
{
memset( m_pString, 0, m_iCapacity );
m_iLength = 0;
}
const char* ioHashString::c_str() const
{
return m_pString;
}
void ioHashString::ReAllocCapacity( int iNewCapacity )
{
if( m_pString )
{
delete[] m_pString;
m_pString = NULL;
}
m_iCapacity = iNewCapacity;
m_pString = new char[iNewCapacity];
}
DWORD ioHashString::CalcHashCode( const char *str )
{
DWORD dwLen, dwCh, dwResult;
dwLen = strlen( str );
dwResult = HASH_CONST;
for( DWORD i=0; i<dwLen ; i++ )
{
dwCh = (DWORD)str[i];
dwResult = ((dwResult<< 5) + dwResult) + dwCh; // hash * 33 + ch
}
return dwResult;
}
DWORD ioHashString::GetHashCode() const
{
return m_dwHashCode;
}
void ioHashString::MakeLower()
{
if( m_pString )
{
_strlwr_s( m_pString, m_iCapacity );
m_dwHashCode = CalcHashCode( m_pString );
}
}
void ioHashString::MakeUpper()
{
if( m_pString )
{
_strupr_s( m_pString, m_iCapacity );
m_dwHashCode = CalcHashCode( m_pString );
}
}
bool ioHashString::operator<( const ioHashString &rhs ) const
{
if( m_dwHashCode != rhs.m_dwHashCode )
return ( m_dwHashCode < rhs.m_dwHashCode );
return ( strcmp( m_pString, rhs.m_pString ) < 0 );
}
char ioHashString::At( int i ) const
{
if( m_iLength < i || !m_pString )
{
assert( false );
return 0;
}
return m_pString[i];
}
ioHashString& ioHashString::operator=( const ioHashString &rhs )
{
m_iLength = rhs.Length();
if( m_iCapacity < m_iLength + 1 )
{
ReAllocCapacity( m_iLength + 1 );
}
strcpy_s(m_pString, m_iCapacity, rhs.m_pString );
m_dwHashCode = rhs.m_dwHashCode;
return *this;
}
ioHashString& ioHashString::operator=( const char *szText )
{
m_iLength = strlen( szText );
if( m_iCapacity < m_iLength + 1 )
{
ReAllocCapacity( m_iLength + 1 );
}
strcpy_s( m_pString, m_iCapacity, szText );
m_dwHashCode = CalcHashCode( szText );
return *this;
}
bool ioHashString::operator==( const ioHashString &rhs ) const
{
if( m_dwHashCode != rhs.m_dwHashCode )
return false;
if( strcmp( m_pString, rhs.m_pString ) != 0 )
return false;
return true;
}
bool ioHashString::operator==( const char *szText ) const
{
if( strcmp( m_pString, szText ) != 0 )
return false;
return true;
}
bool ioHashString::operator!=( const ioHashString &rhs ) const
{
if( *this == rhs )
return false;
return true;
}
bool ioHashString::operator!=( const char *szText ) const
{
if( *this == szText )
return false;
return true;
}
@@ -0,0 +1,63 @@
#ifndef _ioHashString_h_
#define _ioHashString_h_
#define HASH_CONST 5381
#ifdef THAILAND_LONG_ID
#define DEFAULT_CAPACITY 44 // SetReturnData() size을 사용하므로 ID_NUM_PLUS_ONE 길이 보다 길어야함
#else
#define DEFAULT_CAPACITY 32 // SetReturnData() size을 사용하므로 ID_NUM_PLUS_ONE 길이 보다 길어야함
#endif
// Original version is www.gamza.net
class ioHashString
{
private:
char *m_pString;
DWORD m_dwHashCode;
int m_iLength;
int m_iCapacity;
private:
void ReAllocCapacity( int iNewCapacity );
public:
void Clear();
bool IsEmpty() const;
int Length() const;
char At( int i ) const;
DWORD GetHashCode() const;
const char* c_str() const;
void MakeLower();
void MakeUpper();
public:
static DWORD CalcHashCode( const char *str );
public:
bool operator < ( const ioHashString &rhs ) const;
ioHashString& operator=( const ioHashString &rhs );
ioHashString& operator=( const char *szText );
bool operator==( const ioHashString &rhs ) const;
bool operator==( const char *szText ) const;
bool operator!=( const ioHashString &rhs ) const;
bool operator!=( const char *szText ) const;
public:
ioHashString();
ioHashString( const char *str );
ioHashString( const ioHashString &rhs );
~ioHashString();
};
typedef std::vector< ioHashString > ioHashStringVec;
#endif
@@ -0,0 +1,106 @@
[NETWORK]
CSPORT = 20000
SSPORT = 20001
MSPORT = 7139
DBIP = 172.20.20.110
DBPORT = 30911
;DBIP = 172.20.20.110
;DBPORT = 30000
LOGDBIP = 172.20.20.73
LOGDBSTARTPORT = 30001
LOGDBMaxPortCnt= 1
LOGSERVERIP = 172.20.20.75
LOGSERVERPORT = 14009
MainServerIP = 172.20.20.110
MainServerPORT = 40000
BillingRelayServerIP = 172.20.20.75
; MY
;BillingRelayServerIP = 172.20.20.59
BillingRelayServerStartPort = 14010
BillingRelayServerMaxPortCnt= 1
;60분마다 DB에 판매량 Select
[ClassPrice]
LoadTime = 60
[MemoryPool]
server_pool = 10
battleroom_pool = 1000
ladderteam_pool = 3000
room_pool = 1000
channel_pool = 5000
user_pool = 1000
limit_user = 1000
[SECURITY]
ON = 1
ONE_SEC_RCV = 1000
[FEATURE]
NAME=아마1 존
ARRAY = 1
MainSleepMS = 1
;DefaultiniLoad = 0
[HACK]
check_min_time = 7000
check_max_time = 12000
check_less_count = 1
check_over_count = 0
check_less_over_count = 0
check_total_count = 0
[SpeedHackQuiz]
max_answer_chance = 3
client_answer_time = 15000
server_answer_time = 16000
first_max_operand_size = 2
second_max_operand_size = 2
max_operator_type = 1
[AbuseQuiz]
max_answer_chance = 3
client_answer_time = 30000
server_answer_time = 31000
first_max_operand_size = 2
second_max_operand_size = 1
max_operator_type = 1
[AddExerciseCharIndex]
; 연습용병 index는 4284967295 ~ 4294967294 까지 천만개를 사용.
; 지금 서버에서는 4284967295 + start_add_exercise_char_index 부터 4284967295 + end_add_exercise_char_index 까지 사용
; limit_user 숫자만큼 할당
max_index = 1000
[Xtrap]
; Xtrap 서버 기능 사용 유무 0 미사용 , 1사용
use = 0
[Local]
; 119483910 : 한국버전
Version = 119483910
; INFINITE 1일경우 Max 갯수 = INFI_Max값으로..
[SendBuffer Count]
;Min = 1
;Max = 10
Min = 10
Max = 1000
; Nagle Time은 10 ~ 30 ms로 설정. 유저가 렉으로 판단하지 않을정도의 적당한 수치를 찾아서..
; 레퍼런스 카운트 역시 SendBuffer가 너무 많이 쌓이지 않게 적당한 수치로 설정.
[Nagle]
Nagle_Time = 100
Nagle_RefCnt = 55
+287
View File
@@ -0,0 +1,287 @@
// libtest.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다.
//
#include "stdafx.h"
void ini_file_load();
void ini_file_load_quest();
void SetQuestData( DWORD dwMainIndex, DWORD dwSubIndex, ioINILoader &rkLoader );
int _tmain(int argc, _TCHAR* argv[])
{
//_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
//_CrtSetBreakAlloc( 80 );
/*for( int i = 0 ; i < 3 ; ++i )
{
ini_file_load();
ini_file_load_quest();
}
cout << "end..." << endl;*/
{
ioINILoader kLoader;
kLoader.SetFileName( "Gameserverinfo.ini" );
// 파일 바로 읽기.
bool boolvalue = kLoader.ReadBool( "security", "on", 0 );
int intvalue = kLoader.ReadInt( "memorypool", "server_pool", 777 );
float floatvalue = kLoader.ReadFloat( "classprice", "loadtime", 0 );
char buff[ 256 ];
int len = 256;
kLoader.ReadString( "feature", "name", "", buff, len );
}
{
ioINILoader kLoader2( "Gameserverinfo.ini" );
// 전체 reload
//kLoader2.ReloadFile( "Gameserverinfo.ini" );
// 부분 reload [feature]
kLoader2.ReloadFile( "Gameserverinfo.ini", "feature" );
//
kLoader2.SetTitle( "feature" );
int arrayint = kLoader2.LoadInt( "Array", 0 );
//remove
//kLoader2.RemoveFile( "Gameserverinfo.ini" );
}
int i = 0;
cin >> i;
//_CrtDumpMemoryLeaks();
return 0;
}
void ini_file_load()
{
DWORD time = GetTickCount();
int value = 0;
int temp[ 65535 ] = { 0, };
// 게임서버 ini파일 로드
ioINILoader kLoader( "sp2_monster_treasure_card.ini" );
int i = 0;
char szKey[MAX_PATH], szBuf[MAX_PATH];
kLoader.SetTitle( "common" );
// 선물 리스트
int iMaxTable = kLoader.LoadInt( "max_table", 0 );
for(i = 0;i < iMaxTable;i++)
{
sprintf_s( szKey, "table%d", i + 1 );
kLoader.SetTitle( szKey );
// 공용
kLoader.LoadString( "present_name", "", szBuf, MAX_PATH );
temp[ value++ ] = kLoader.LoadInt( "present_state", 0 );
temp[ value++ ] = kLoader.LoadInt( "present_ment", 0 );
temp[ value++ ] = kLoader.LoadInt( "present_period", 0 );
int iMaxPresent = kLoader.LoadInt( "max_present", 0 );
for(int k = 0;k < iMaxPresent;k++)
{
sprintf_s( szKey, "present%d_rand", k + 1 );
temp[ value++ ] = kLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "present%d_type", k + 1 );
temp[ value++ ] = kLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "present%d_value1", k + 1 );
temp[ value++ ] = kLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "present%d_value2", k + 1 );
temp[ value++ ] = kLoader.LoadInt( szKey, 0 );
}
}
// 장비 선물의 기간+강화값 랜덤 리스트
kLoader.SetTitle( "common" );
iMaxTable = kLoader.LoadInt( "max_extraitem_rand_table", 0 );
for(i = 0;i < iMaxTable;i++)
{
sprintf_s( szKey, "extraitem_rand_table%d", i + 1 );
kLoader.SetTitle( szKey );
int k = 0;
int iMaxLimitDate = kLoader.LoadInt( "max_limit_date", 0 );
for(k = 0;k < iMaxLimitDate;k++)
{
sprintf_s( szKey, "limit_date%d_rand", k + 1 );
temp[ value++ ] = kLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "limit_date%d_value", k + 1 );
temp[ value++ ] = kLoader.LoadInt( szKey, 0 );
}
int iMaxReinforceDate = kLoader.LoadInt( "max_reinforce", 0 );
for(k = 0;k < iMaxReinforceDate;k++)
{
sprintf_s( szKey, "reinforce%d_rand", k + 1 );
temp[ value++ ] = kLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "reinforce%d_value", k + 1 );
temp[ value++ ] = kLoader.LoadInt( szKey, 0 );
}
}
DWORD result = GetTickCount() - time;
cout << "sp2_monster_treasure_card result : " << result << endl;
}
void ini_file_load_quest()
{
DWORD time = GetTickCount();
ioINILoader kLoader( "sp2_quest_info.ini" );
kLoader.SetTitle( "common" );
int iMaxQuest = kLoader.LoadInt( "max_quest", 0 );
for(int i = 0;i < iMaxQuest;i++)
{
char szTitle[MAX_PATH] = "";
sprintf_s( szTitle, "quest%d", i + 1 );
kLoader.SetTitle( szTitle );
char szClassName[MAX_PATH] = "";
kLoader.LoadString( "class_name", "", szClassName, MAX_PATH );
DWORD dwMainIndex = kLoader.LoadInt( "main_index", 0 );
int iMaxSubQuest = kLoader.LoadInt( "max_sub_quest", 0 );
for(int j = 0;j < iMaxSubQuest;j++)
{
SetQuestData( dwMainIndex, j + 1, kLoader );
}
}
DWORD result = GetTickCount() - time;
cout << "sp2_quest_info result : " << result << endl;
}
void SetQuestData( DWORD dwMainIndex, DWORD dwSubIndex, ioINILoader &rkLoader )
{
int value = 0;
int temp[ 65535 ] = { 0, };
DWORD m_dwMainIndex = dwMainIndex;
DWORD m_dwSubIndex = dwSubIndex;
char szKey[MAX_PATH] = "";
char szBuf[MAX_PATH] = "";
sprintf_s( szKey, "sub%d_title", m_dwSubIndex );
rkLoader.LoadString( szKey, "", szBuf, MAX_PATH );
//m_szTitle = szBuf;
sprintf_s( szKey, "sub%d_perform_type", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_oneday_style", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadBool( szKey, false );
sprintf_s( szKey, "sub%d_repeat_style", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadBool( szKey, false );
sprintf_s( szKey, "sub%d_guild_style", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadBool( szKey, false );
sprintf_s( szKey, "sub%d_pcroom_style", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadBool( szKey, false );
sprintf_s( szKey, "sub%d_channeling_type", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, -1 );
sprintf_s( szKey, "sub%d_occur_value", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_occur_mode", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, -1 );
sprintf_s( szKey, "sub%d_occur_room_style", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, -1 );
sprintf_s( szKey, "sub%d_complete_value", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_complete_mode", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, -1 );
sprintf_s( szKey, "sub%d_complete_room_style", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, -1 );
sprintf_s( szKey, "sub%d_period_hour", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
//m_vRewardPresent.clear();
sprintf_s( szKey, "sub%d_max_reward", m_dwSubIndex );
int iMaxReward = rkLoader.LoadInt( szKey, 0 );
int i = 0;
for(;i < iMaxReward;i++)
{
sprintf_s( szKey, "sub%d_reward_present%d", m_dwSubIndex, i + 1 );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
}
sprintf_s( szKey, "sub%d_prev_main_index", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_prev_sub_index", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_next_main_index", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_next_sub_index", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_complete_game_alarm", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadBool( szKey, false );
sprintf_s( szKey, "sub%d_complete_web_alarm", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadBool( szKey, false );
//m_CustomValue.clear();
int iDefCustom = -999999999;
for(i = 0;i < 50;i++)
{
sprintf_s( szKey, "sub%d_custom_value%d", m_dwSubIndex, i + 1 );
int iCustomValue = rkLoader.LoadInt( szKey, iDefCustom );
if( iCustomValue == iDefCustom )
break;
//m_CustomValue.push_back( iCustomValue );
}
// 이벤트 퀘스트 시간 로드
sprintf_s( szKey, "sub%d_start_year", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_start_month", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_start_date", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_start_hour", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_end_year", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_end_month", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_end_date", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
sprintf_s( szKey, "sub%d_end_hour", m_dwSubIndex );
temp[ value++ ] = rkLoader.LoadInt( szKey, 0 );
}
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{201A7015-1664-4C02-BC30-8B99D2403B42}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libtest</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(IncludePath)</IncludePath>
<ReferencePath>$(ReferencePath)</ReferencePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="INILoader\ioDataChunk.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="INILoader\ioINILoader.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="INILoader\ioINIParser.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="INILoader\ioStream.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="Util\ioHashString.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="INILoader\ioDataChunk.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="INILoader\ioINILoader.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="INILoader\ioINIParser.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="INILoader\ioStream.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="libtest.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Util\ioHashString.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="소스 파일">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="헤더 파일">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="리소스 파일">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="INILoader">
<UniqueIdentifier>{095b0d9b-d70e-4b50-967d-e4a68e8780ca}</UniqueIdentifier>
</Filter>
<Filter Include="Util">
<UniqueIdentifier>{c7feb027-7e05-4707-b5e8-e519ea9d130f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="INILoader\ioDataChunk.h">
<Filter>INILoader</Filter>
</ClInclude>
<ClInclude Include="INILoader\ioINILoader.h">
<Filter>INILoader</Filter>
</ClInclude>
<ClInclude Include="INILoader\ioINIParser.h">
<Filter>INILoader</Filter>
</ClInclude>
<ClInclude Include="INILoader\ioStream.h">
<Filter>INILoader</Filter>
</ClInclude>
<ClInclude Include="Util\ioHashString.h">
<Filter>Util</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="libtest.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="INILoader\ioDataChunk.cpp">
<Filter>INILoader</Filter>
</ClCompile>
<ClCompile Include="INILoader\ioINILoader.cpp">
<Filter>INILoader</Filter>
</ClCompile>
<ClCompile Include="INILoader\ioINIParser.cpp">
<Filter>INILoader</Filter>
</ClCompile>
<ClCompile Include="INILoader\ioStream.cpp">
<Filter>INILoader</Filter>
</ClCompile>
<ClCompile Include="Util\ioHashString.cpp">
<Filter>Util</Filter>
</ClCompile>
</ItemGroup>
</Project>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+51
View File
@@ -0,0 +1,51 @@
// stdafx.cpp : 표준 포함 파일만 들어 있는 소스 파일입니다.
// libtest.pch는 미리 컴파일된 헤더가 됩니다.
// stdafx.obj에는 미리 컴파일된 형식 정보가 포함됩니다.
#include "stdafx.h"
// TODO: 필요한 추가 헤더는
// 이 파일이 아닌 STDAFX.H에서 참조합니다.
namespace ioStringConverter
{
StringVector Split( const string &param, const string &delims, int iMaxSplit )
{
StringVector ret;
int iNumSplits = 0;
size_t iStart, iPos;
iStart = 0;
do
{
iPos = param.find_first_of( delims, iStart );
if( iPos == iStart )
{
iStart = iPos + 1;
}
else if( iPos == param.npos || ( iMaxSplit && iNumSplits == iMaxSplit ) )
{
ret.push_back( param.substr(iStart) );
break;
}
else
{
ret.push_back( param.substr( iStart, iPos - iStart ) );
iStart = iPos + 1;
}
iStart = param.find_first_not_of( delims, iStart );
++iNumSplits;
}while( iPos != param.npos );
return ret;
}
void toLowerCase( std::string &str )
{
std::transform( str.begin(), str.end(), str.begin(), tolower );
}
}
+81
View File
@@ -0,0 +1,81 @@
// stdafx.h : 자주 사용하지만 자주 변경되지는 않는
// 표준 시스템 포함 파일 및 프로젝트 관련 포함 파일이
// 들어 있는 포함 파일입니다.
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: 프로그램에 필요한 추가 헤더는 여기에서 참조합니다.
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <Windows.h>
#include <assert.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef std::vector< std::string > StringVector;
#include "Util\ioHashString.h"
namespace ioStringConverter
{
StringVector Split( const std::string &param,
const std::string &delims,
int iMaxSplit = 0 );
void toLowerCase( std::string &str );
}
#define COMPARE(x,min,max) (((x)>=(min))&&((x)<(max)))
#define SAFEDELETE(x) if(x != NULL) { delete x; x = NULL; }
#define SAFEDELETEARRAY(x) if(x != NULL) { delete [] x; x = NULL; }
typedef unsigned char BYTE;
struct Vector3
{
float x,y,z;
Vector3(){}
Vector3( float _x, float _y, float _z )
{
x = _x;
y = _y;
z = _z;
}
};
#define use_lib
#ifdef use_lib
// typedef
typedef std::basic_string<TCHAR> tstring;
#include "../../../src/include/common.h"
#include "../../../src/ioINILoader/ioINILoader.h"
#ifdef _DEBUG
#pragma comment( lib, "../../../lib/INID.lib" )
#else
#pragma comment( lib, "../../../lib/INI.lib" )
#endif
#else
#include "INILoader\ioINILoader.h"
#endif
+8
View File
@@ -0,0 +1,8 @@
#pragma once
// SDKDDKVer.h를 포함하면 최고 수준의 가용성을 가진 Windows 플랫폼이 정의됩니다.
// 이전 Windows 플랫폼에 대해 응용 프로그램을 빌드하려는 경우에는 SDKDDKVer.h를 포함하기 전에
// WinSDKVer.h를 포함하고 _WIN32_WINNT 매크로를 지원하려는 플랫폼으로 설정하십시오.
#include <SDKDDKVer.h>