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:
273
Server/ToolProject/GameDBTool/Misc/FileOpen.cpp
Normal file
273
Server/ToolProject/GameDBTool/Misc/FileOpen.cpp
Normal file
@@ -0,0 +1,273 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 파일 오픈 클래스
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include "FileOpen.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FileOpen 생성자 [ public ]
|
||||
// - 맴버 변수 초기화
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
FileOpen::FileOpen(HWND hWnd_In, LPCTSTR InitialDir_In)
|
||||
{
|
||||
m_OpenFileName.lStructSize = sizeof(OPENFILENAME);
|
||||
m_OpenFileName.hwndOwner = hWnd_In;
|
||||
m_OpenFileName.hInstance = NULL;
|
||||
m_OpenFileName.lpstrFilter = "All file\0*.*";
|
||||
m_OpenFileName.lpstrCustomFilter = NULL;
|
||||
m_OpenFileName.nMaxCustFilter = 0;
|
||||
m_OpenFileName.nFilterIndex = 0;
|
||||
m_OpenFileName.lpstrFile = NULL;
|
||||
m_OpenFileName.nMaxFile = FileNameBufferSize;
|
||||
m_OpenFileName.lpstrFileTitle = NULL;
|
||||
m_OpenFileName.nMaxFileTitle = MAX_PATH;
|
||||
m_OpenFileName.lpstrInitialDir = InitialDir_In;
|
||||
m_OpenFileName.lpstrTitle = NULL;
|
||||
m_OpenFileName.Flags = OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_LONGNAMES | OFN_EXPLORER;
|
||||
m_OpenFileName.nFileOffset = 0;
|
||||
m_OpenFileName.nFileExtension = 0;
|
||||
m_OpenFileName.lpstrDefExt = NULL;
|
||||
m_OpenFileName.lCustData = 0;
|
||||
m_OpenFileName.lpfnHook = NULL;
|
||||
m_OpenFileName.lpTemplateName = NULL;
|
||||
|
||||
m_OpenFileName.lpstrFile = m_FileNameBuffer;
|
||||
m_OpenFileName.lpstrFileTitle = m_FilePathName[0];
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FileOpen 소멸자 [ public ]
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
FileOpen::~FileOpen(void)
|
||||
{
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OpenDlg [ public ]
|
||||
// - 오픈 다이얼로그
|
||||
//
|
||||
// Parameter :
|
||||
// 1st : 파일 필터
|
||||
//
|
||||
// Return:
|
||||
// 성공시 true
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool FileOpen::OpenDlg(char* Filter_In)
|
||||
{
|
||||
int Counter;
|
||||
|
||||
ZeroMemory(m_FileNameBuffer, FileNameBufferSize);
|
||||
ZeroMemory(m_FilePathName, MAX_PATH);
|
||||
|
||||
m_OpenFileName.lpstrFilter = Filter_In;
|
||||
|
||||
if(GetOpenFileName(&m_OpenFileName))
|
||||
{
|
||||
m_FileCount = 0;
|
||||
|
||||
if(m_OpenFileName.nFileExtension == 0)
|
||||
{
|
||||
for(Counter = 0; m_FileCount < MaxFileNumber;)
|
||||
{
|
||||
if(m_FileNameBuffer[Counter++] == NULL)
|
||||
{
|
||||
if(m_FileNameBuffer[Counter] != NULL)
|
||||
{
|
||||
sprintf(m_FilePathName[m_FileCount], "%s\\%s", m_FileNameBuffer, &m_FileNameBuffer[Counter]);
|
||||
|
||||
m_FileCount++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(m_FilePathName[m_FileCount], m_FileNameBuffer);
|
||||
m_FileCount++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SaveDlg [ public ]
|
||||
// - 저장 다이얼로그
|
||||
//
|
||||
// Parameter :
|
||||
// 1st : 디폴트 확장자
|
||||
// 2st : 파일 필터
|
||||
//
|
||||
// Return:
|
||||
// 성공시 true
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool FileOpen::SaveDlg(char* DefulatExt_In, char* Filter_In)
|
||||
{
|
||||
ZeroMemory(m_FileNameBuffer, FileNameBufferSize);
|
||||
ZeroMemory(m_FilePathName, MAX_PATH);
|
||||
|
||||
m_OpenFileName.lpstrFilter = Filter_In;
|
||||
|
||||
if(GetSaveFileName(&m_OpenFileName))
|
||||
{
|
||||
m_FileCount = 0;
|
||||
|
||||
if(IsExistExt(m_FileNameBuffer))
|
||||
strcpy(m_FilePathName[m_FileCount++], m_FileNameBuffer);
|
||||
else
|
||||
sprintf(m_FilePathName[m_FileCount++], "%s.%s", m_FileNameBuffer, DefulatExt_In);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetFileNameFromBuffer [ public ]
|
||||
// - 버퍼로 부터 파일 이름 얻기
|
||||
//
|
||||
// Parameter :
|
||||
// 1st : 인덱스
|
||||
//
|
||||
// Return:
|
||||
// 성공시 파일 이름
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
char* FileOpen::GetFileNameFromBuffer(int Index_In)
|
||||
{
|
||||
if(Index_In < 0)
|
||||
return NULL;
|
||||
|
||||
m_FileIndex = Index_In;
|
||||
|
||||
return ConvertToFileName(m_FilePathName[m_FileIndex++]);
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetNextFileNameFromBuffer [ public ]
|
||||
// - 버퍼로 부터 다음 파일 이름 얻기 : GetFileNameFromBuffer 호출 이후 다음 인덱스
|
||||
//
|
||||
// Parameter :
|
||||
//
|
||||
// Return:
|
||||
// 성공시 파일 이름
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
char* FileOpen::GetNextFileNameFromBuffer(void)
|
||||
{
|
||||
if(m_FileIndex >= m_FileCount)
|
||||
return NULL;
|
||||
|
||||
return ConvertToFileName(m_FilePathName[m_FileIndex++]);
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetFilePathNameFromBuffer [ public ]
|
||||
// - 버퍼로 부터 경로 파일 이름 얻기
|
||||
//
|
||||
// Parameter :
|
||||
// 1st : 인덱스
|
||||
//
|
||||
// Return:
|
||||
// 성공시 경로 파일 이름
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
char* FileOpen::GetFilePathNameFromBuffer(int Index_In)
|
||||
{
|
||||
if(Index_In < 0)
|
||||
return NULL;
|
||||
|
||||
m_FileIndex = Index_In;
|
||||
|
||||
return m_FilePathName[m_FileIndex++];
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetNextFilePathNameFromBuffer [ public ]
|
||||
// - 버퍼로 부터 다음 경로 파일 이름 얻기 : GetFileNameFromBuffer 호출 이후 다음 인덱스
|
||||
//
|
||||
// Parameter :
|
||||
//
|
||||
// Return:
|
||||
// 성공시 경로 파일 이름
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
char* FileOpen::GetNextFilePathNameFromBuffer(void)
|
||||
{
|
||||
if(m_FileIndex >= m_FileCount)
|
||||
return NULL;
|
||||
|
||||
return m_FilePathName[m_FileIndex++];
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ConvertToFileName [ public ]
|
||||
// - 경로 파일 이름을 파일 이름으로 변경
|
||||
//
|
||||
// Parameter :
|
||||
// 1st : 경로 파일 이름
|
||||
//
|
||||
// Return:
|
||||
// 성공시 파일 이름
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
char* FileOpen::ConvertToFileName(char* FilePathName_In)
|
||||
{
|
||||
char *FileNameStart = FilePathName_In;
|
||||
char *Position;
|
||||
|
||||
for(Position = FileNameStart; *Position != NULL; Position++)
|
||||
{
|
||||
if(*Position == '\\')
|
||||
FileNameStart = Position + 1;
|
||||
}
|
||||
|
||||
return FileNameStart;
|
||||
}
|
||||
|
||||
//Interface////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IsExistExt [ public ]
|
||||
// - 파일명에서 확장자 존재 유무 확인
|
||||
//
|
||||
// Parameter :
|
||||
// 1st : 파일 이름
|
||||
//
|
||||
// Return:
|
||||
// 성공시 true
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool FileOpen::IsExistExt(char* FileName)
|
||||
{
|
||||
int FileNameLen;
|
||||
int Counter;
|
||||
|
||||
if(FileName == NULL)
|
||||
return false;
|
||||
|
||||
FileNameLen = static_cast<int>(strlen(FileName));
|
||||
for(Counter = 0; Counter < FileNameLen; Counter++)
|
||||
if(FileName[Counter] == '.')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
70
Server/ToolProject/GameDBTool/Misc/FileOpen.h
Normal file
70
Server/ToolProject/GameDBTool/Misc/FileOpen.h
Normal file
@@ -0,0 +1,70 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 파일 오픈 클래스
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _FileOpen
|
||||
#define _FileOpen
|
||||
|
||||
#include <windows.h>
|
||||
#include <commdlg.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 상수 정의
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const unsigned int MaxFileNumber = 40;
|
||||
const unsigned int FileNameBufferSize = MaxFileNumber * MAX_PATH;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 클래스 정의
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class FileOpen
|
||||
{
|
||||
private:
|
||||
OPENFILENAME m_OpenFileName;
|
||||
|
||||
char m_FileNameBuffer[MAX_PATH];
|
||||
char m_FilePathName[MaxFileNumber][MAX_PATH];
|
||||
|
||||
int m_FileIndex;
|
||||
int m_FileCount;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FileOpen 기본 클래스 메소드
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
FileOpen(HWND hWnd_In, LPCTSTR InitialDir_In = NULL);
|
||||
~FileOpen(void);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 파일 다이얼로그 관련 메소드
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool OpenDlg(char* Filter_In = "All file\0*.*");
|
||||
bool SaveDlg(char* DefulatExt_In, char* Filter_In = "All file\0*.*");
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 파일 처리 관련 메소드
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
char* GetFileNameFromBuffer(int Index_In = 0);
|
||||
char* GetNextFileNameFromBuffer(void);
|
||||
|
||||
char* GetFilePathNameFromBuffer(int Index_In = 0);
|
||||
char* GetNextFilePathNameFromBuffer(void);
|
||||
|
||||
char* ConvertToFileName(char* FilePathName_In);
|
||||
|
||||
private:
|
||||
bool IsExistExt(char* FileName);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user