Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
65
Server/Billing/Db/Config.cpp
Normal file
65
Server/Billing/Db/Config.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "Config.h"
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
CConfigurator::CConfigurator()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
CConfigurator::~CConfigurator()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool CConfigurator::Load(const char* szFileName)
|
||||
{
|
||||
FILE* lpFile = fopen(szFileName, "rt");
|
||||
|
||||
if(NULL != lpFile)
|
||||
{
|
||||
const int MAX_READ = 4096;
|
||||
char szRead[MAX_READ];
|
||||
char* szDelimitChars = " =\t\n\r";
|
||||
|
||||
while(fgets(szRead, MAX_READ, lpFile))
|
||||
{
|
||||
const char* szCommand = strtok(szRead, szDelimitChars);
|
||||
const char* szValue = strtok(NULL, szDelimitChars);
|
||||
|
||||
if(0 != szCommand && 0 != szValue)
|
||||
{
|
||||
if(0 != strncmp(szCommand, TEXT("//"), strlen(TEXT("//"))))
|
||||
{
|
||||
m_ConfigMap.insert(std::make_pair(szCommand, szValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(lpFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* CConfigurator::Get(const char* szKey)
|
||||
{
|
||||
ConfigMap::iterator end = m_ConfigMap.end();
|
||||
ConfigMap::iterator find = m_ConfigMap.find(szKey);
|
||||
|
||||
if(end != find)
|
||||
{
|
||||
return find->second.c_str();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CConfigurator::Clear()
|
||||
{
|
||||
m_ConfigMap.clear();
|
||||
}
|
||||
25
Server/Billing/Db/Config.h
Normal file
25
Server/Billing/Db/Config.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _GAMA_DB_CONFIGURATOR_
|
||||
#define _GAMA_DB_CONFIGURATOR_
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class CConfigurator
|
||||
{
|
||||
public:
|
||||
|
||||
CConfigurator();
|
||||
~CConfigurator();
|
||||
|
||||
bool Load(const char* szFileName);
|
||||
const char* Get(const char* szKey);
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
|
||||
typedef std::map<std::string, std::string> ConfigMap;
|
||||
|
||||
ConfigMap m_ConfigMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
137
Server/Billing/Db/DB.vcproj
Normal file
137
Server/Billing/Db/DB.vcproj
Normal file
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="ks_c_5601-1987"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="DB"
|
||||
ProjectGUID="{68041CA4-DB5B-4716-BB34-AFD654BD9D33}"
|
||||
SccProjectName=""
|
||||
SccLocalPath=""
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../Executable/$(ConfigurationName)"
|
||||
IntermediateDirectory="../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/DB.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../Executable/$(ConfigurationName)"
|
||||
IntermediateDirectory="../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/DB.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="소스 파일"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\Config.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Log.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\myOLEDB.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="헤더 파일"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath=".\Config.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Log.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\myOLEDB.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="리소스 파일"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
93
Server/Billing/Db/Log.cpp
Normal file
93
Server/Billing/Db/Log.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
#include "Log.h"
|
||||
#include <windows.h>
|
||||
|
||||
CLog::CLog()
|
||||
: m_stdout(0), m_stderr(0)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
CLog::~CLog()
|
||||
{
|
||||
if(0 != m_stderr)
|
||||
{
|
||||
fclose(m_stderr);
|
||||
m_stderr = 0;
|
||||
}
|
||||
|
||||
if(0 != m_stdout)
|
||||
{
|
||||
fclose(m_stdout);
|
||||
m_stdout = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CLog::RedirectStdErr(const char* szFileName)
|
||||
{
|
||||
char szLogFileName[MAX_PATH];
|
||||
|
||||
if(MakeFileName(szFileName, szLogFileName))
|
||||
{
|
||||
m_stderr = freopen(szLogFileName, "at", stderr);
|
||||
return (0 != m_stderr);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CLog::RedirectStdOut(const char *szFileName)
|
||||
{
|
||||
char szLogFileName[MAX_PATH];
|
||||
|
||||
if(MakeFileName(szFileName, szLogFileName))
|
||||
{
|
||||
m_stdout = freopen(szLogFileName, "at", stdout);
|
||||
return (0 != m_stdout);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CLog::MakeFileName(const char* szFileName, char* szLogFileName)
|
||||
{
|
||||
// create log file name in good order
|
||||
for(unsigned long dwSpinCount = 0; TRUE; ++dwSpinCount)
|
||||
{
|
||||
int nLength = _snprintf(szLogFileName, MAX_PATH, "%s%04d.log",
|
||||
szFileName, dwSpinCount);
|
||||
|
||||
if(nLength < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (INVALID_FILE_ATTRIBUTES == GetFileAttributes(szLogFileName))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
HANDLE hFile = CreateFile(szLogFileName, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if(hFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD dwFileHighSize = 0;
|
||||
DWORD dwFileSize = GetFileSize(hFile, &dwFileHighSize);
|
||||
|
||||
CloseHandle(hFile);
|
||||
|
||||
if(0 == dwFileHighSize && dwFileSize < 10 * 1024 * 1024)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
24
Server/Billing/Db/Log.h
Normal file
24
Server/Billing/Db/Log.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef _GAMA_STD_LOG_H_
|
||||
#define _GAMA_STD_LOG_H_
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
class CLog
|
||||
{
|
||||
public:
|
||||
|
||||
CLog();
|
||||
~CLog();
|
||||
|
||||
bool RedirectStdErr(const char* szFileName);
|
||||
bool RedirectStdOut(const char* szFileName);
|
||||
|
||||
private:
|
||||
|
||||
bool MakeFileName(const char* szFileName, char* szLogFileName);
|
||||
|
||||
FILE* m_stdout;
|
||||
FILE* m_stderr;
|
||||
};
|
||||
|
||||
#endif
|
||||
21
Server/Billing/Db/ReadMe.txt
Normal file
21
Server/Billing/Db/ReadMe.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
========================================================================
|
||||
정적 라이브러리 : DB 프로젝트 개요
|
||||
========================================================================
|
||||
|
||||
응용 프로그램 마법사에서 이 DB 라이브러리 프로젝트를 만들었습니다.
|
||||
프로젝트에 대해 소스 파일은 만들어지지 않았습니다.
|
||||
|
||||
|
||||
DB.vcproj
|
||||
응용 프로그램 마법사를 사용하여 생성한 VC++ 프로젝트의 기본 프로젝트 파일입니다.
|
||||
해당 파일을 생성한 Visual C++의 버전 정보를 비롯하여
|
||||
응용 프로그램 마법사에서 선택한 플랫폼, 구성 및
|
||||
프로젝트 기능에 대한 정보가 들어 있습니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
기타 참고:
|
||||
|
||||
응용 프로그램 마법사에서 사용하는 "TODO:" 주석은 사용자가 추가하거나 사용자 지정해야 하는
|
||||
소스 코드 부분을 나타냅니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
1358
Server/Billing/Db/myOLEDB.cpp
Normal file
1358
Server/Billing/Db/myOLEDB.cpp
Normal file
File diff suppressed because it is too large
Load Diff
118
Server/Billing/Db/myOLEDB.h
Normal file
118
Server/Billing/Db/myOLEDB.h
Normal file
@@ -0,0 +1,118 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OleDB
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _OleDB
|
||||
#define _OleDB
|
||||
|
||||
#include <oledb.h>
|
||||
#include <oledberr.h>
|
||||
|
||||
//#define _CHECK_OLEDB_PERFORMANCE // DB 퍼포먼스 체크
|
||||
#ifdef _CHECK_OLEDB_PERFORMANCE
|
||||
#define DB_PERFORMANCE_CHECK(x) x
|
||||
#else
|
||||
#define DB_PERFORMANCE_CHECK(x) (void*)0;
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 클래스 정의
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class OleDB
|
||||
{
|
||||
public:
|
||||
const static unsigned long MaxRowNum = 2000; // 최대 열 숫자
|
||||
const static unsigned long MaxErrorLen = 512; // 최대 에러 길이
|
||||
const static unsigned long MaxQueryTextLen = 5000; // 최대 쿼리 문자열 길이
|
||||
|
||||
protected:
|
||||
|
||||
typedef struct _COL_INFO
|
||||
{
|
||||
const static unsigned short MaxColNameLen = 100; // 최대 컬럼 이름 길이
|
||||
|
||||
char ColName[MaxColNameLen]; // 컬럼 이름
|
||||
unsigned long ColSize; // 컬럼 사이즈
|
||||
}COL_INFO, *LPCOL_INFO;
|
||||
|
||||
typedef struct _RESULT_COLS
|
||||
{
|
||||
unsigned long ColNum;
|
||||
DBCOLUMNINFO* lpDBColumnInfo;
|
||||
WCHAR* lpStringsBuffer;
|
||||
}RESULT_COLS, *LPRESULT_COLS;
|
||||
|
||||
WCHAR m_QueryText[MaxQueryTextLen]; // 쿼리 문자열
|
||||
COL_INFO m_ColInfo;
|
||||
|
||||
public:
|
||||
enum ConnType { ConnType_ODBC = 0, ConnType_MSSQL = 1, ConnType_ORACLE };
|
||||
|
||||
enum Rowset { Rowset_Get = 0, Rowset_Update = 1 }; // 쿼리 실행후 로우셋
|
||||
|
||||
typedef struct _PARAM_INFO
|
||||
{
|
||||
const static unsigned short MaxColNum = 20; // 최대 컬럼 이름 길이
|
||||
|
||||
unsigned long ColNum; // 컬럼 숫자
|
||||
unsigned long ColSize[MaxColNum]; // 컬럼 사이즈
|
||||
unsigned short ColType[MaxColNum];
|
||||
}PARAM_INFO, *LPPARAM_INFO;
|
||||
|
||||
typedef struct _SET_BINARY
|
||||
{
|
||||
unsigned long Size;
|
||||
}SET_BINARY, *LPSET_BINARY;
|
||||
|
||||
public:
|
||||
|
||||
IDBInitialize* m_pIDBInit;
|
||||
IDBCreateSession* m_pIDBCreateSession;
|
||||
IDBCreateCommand* m_pIDBCreateCommand;
|
||||
IRowset* m_pIRowset;
|
||||
IRowsetChange* m_pIRowsetChange;
|
||||
|
||||
char m_ErrorString[MaxErrorLen];
|
||||
|
||||
public:
|
||||
|
||||
OleDB(void);
|
||||
virtual ~OleDB(void);
|
||||
|
||||
char* GetErrorString(void) { return m_ErrorString; }
|
||||
|
||||
bool ConnectDataSourcePrompt(HWND hWnd_In);
|
||||
bool ConnectSQLServer(LPCTSTR ServerName_In, LPCTSTR DataBaseName_In, LPCTSTR UserID_In, LPCTSTR UserPass_In, ConnType ConnType_In);
|
||||
bool DisconnectDataSource(void);
|
||||
|
||||
bool ExcuteQuery(LPCTSTR Query_In, Rowset Rowset_In = Rowset_Get);
|
||||
bool ExcuteQueryWithParams(LPCTSTR Query_In, char *Data_In, PARAM_INFO& ColInfo_In, Rowset Rowset_In);
|
||||
|
||||
bool ExcuteQueryGetData(LPCTSTR Query_In, void *Buffer_Out);
|
||||
|
||||
bool GetData(void *Buffer_Out);
|
||||
bool GetData(void **Buffer_Out, int RowSize_In, int Row_In, int *pGetRow_Out);
|
||||
|
||||
bool SetBinaryData(int ColNum_In, LPSET_BINARY lpSetBinary);
|
||||
|
||||
COL_INFO& GetColInfo(void) { return m_ColInfo; }
|
||||
|
||||
private:
|
||||
|
||||
bool HandleError(int ErrorLine_In, HRESULT hResult_In, char *Buffer_In);
|
||||
|
||||
bool CreateSession(void);
|
||||
bool DBCreateCommand(void);
|
||||
|
||||
bool AllocResultCols(IUnknown* lpIUnknown_In, RESULT_COLS &Rsult_Cols);
|
||||
bool ReleaseResultCols(IUnknown* lpIUnknown_In, RESULT_COLS &Rsult_Cols);
|
||||
|
||||
bool SetConnectionProperties(LPCTSTR ServerName_In, LPCTSTR DataBaseName_In, LPCTSTR UserID_In, LPCTSTR UserPass_In);
|
||||
DBBINDING* AllocBindGetData(int ColsNum_In, DBCOLUMNINFO* pDBColumnInfo_In);
|
||||
DBBINDING* AllocBindParamInputData(PARAM_INFO &ColInfo_In);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user