Files
Client/Server/ToolProject/MakeItemDataToHTML/MakeItemDataToHTML.cpp
LGram16 dd97ddec92 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>
2025-11-29 20:17:20 +09:00

94 lines
2.4 KiB
C++

// MakeItemDataToHTML.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다.
//
#include "stdafx.h"
#include <windows.h>
bool FindItemNames(unsigned short nItemProtoType, char* szFileName_Out, const int nFileNameSize)
{
const int MAX_FILENAME = 1024;
char szFileName[MAX_FILENAME];
_snprintf(szFileName, MAX_FILENAME - 1, "./SavedItems/%6d - *.*", nItemProtoType);
WIN32_FIND_DATA findData;
memset(&findData, 0, sizeof(WIN32_FIND_DATA));
HANDLE hSearch = FindFirstFile(szFileName, &findData);
if(INVALID_HANDLE_VALUE == hSearch)
{
return false;
}
_snprintf(szFileName_Out, nFileNameSize - 1, "./SavedItems/%s", findData.cFileName);
szFileName_Out[nFileNameSize - 1] = 0;
FindClose(hSearch);
return true;
}
int _tmain(int argc, _TCHAR* argv[])
{
if(3 != argc)
{
printf("usage : MakeItemDataToHTML 만들파일명 만든파일명");
return -1;
}
FILE* lpIn = fopen(argv[1], "rt");
if(lpIn)
{
FILE* lpOut = fopen(argv[2], "wt");
if(lpOut)
{
//SavedItems
const int MAX_BUFFER = 4096;
char szData[MAX_BUFFER];
char szFileName[MAX_BUFFER];
// write header
fprintf(lpOut, "<html>\n<head>\n<meta http-equiv='Content-Type' content='text/html; charset=euc-kr'>\n"
"</head>\n<body>\n<table>");
while(fgets(szData, MAX_BUFFER - 1, lpIn))
{
szData[MAX_BUFFER - 1] = 0;
fprintf(lpOut, "<tr>\n");
char* szToken = strtok(szData, " \t\r\n");
while(szToken)
{
int nItemProtoType = atoi(szToken);
if(0 != nItemProtoType)
{
if(0 != FindItemNames(nItemProtoType, szFileName, MAX_BUFFER))
{
fprintf(lpOut, "<td><img src='%s'></td>\n", szFileName);
}
}
else
{
fprintf(lpOut, "<td></td>\n");
}
szToken = strtok(0, " \t\r\n");
}
fprintf(lpOut, "<td>\n");
}
fprintf(lpOut, "</table>\n</body>\n</html>");
fclose(lpOut);
}
fclose(lpIn);
}
return 0;
}