#include "stdafx.h" #include "NxFileSystemTool.h" #include "NxFileSystemToolDlg.h" #include "FileIOThread.h" #include ".\NxFileSystemTool.h" #include "StringUtil.h" #include "BugReporter.h" #ifdef _DEBUG #define new DEBUG_NEW #endif #pragma comment(lib,"dbghelp.lib") /* #ifdef _DEBUG #pragma comment( lib, "zlib_MTd.lib" ) #pragma comment( lib, "EtFileSystem_MTd.lib" ) #else #pragma comment( lib, "zlib_MT.lib" ) #pragma comment( lib, "EtFileSystem_MT.lib" ) #endif */ // CNxFileSystemToolApp BEGIN_MESSAGE_MAP(CNxFileSystemToolApp, CWinApp) END_MESSAGE_MAP() // CNxFileSystemToolApp »ý¼º CNxFileSystemToolApp::CNxFileSystemToolApp() { // TODO: ¿©±â¿¡ »ý¼º Äڵ带 Ãß°¡ÇÕ´Ï´Ù. // InitInstance¿¡ ¸ðµç Áß¿äÇÑ ÃʱâÈ­ ÀÛ¾÷À» ¹èÄ¡ÇÕ´Ï´Ù. _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // _CrtMemDumpAllObjectsSince(0); //_CrtSetBreakAlloc(15359); } // À¯ÀÏÇÑ CNxFileSystemToolApp °³Ã¼ÀÔ´Ï´Ù. CNxFileSystemToolApp theApp; // CNxFileSystemToolApp ÃʱâÈ­ BOOL CNxFileSystemToolApp::InitInstance() { BugReporter::ReportingServerInfo info; gs_BugReporter.SetReportingServerInfo(info); gs_BugReporter.Enable(); CString szCmdLine; szCmdLine = m_lpCmdLine; if ( szCmdLine.IsEmpty() == FALSE ) { tstring szAgrv = m_lpCmdLine; std::vector tokens; #ifdef _UNICODE TokenizeW( szAgrv, tokens, _T(" ")); #else TokenizeA( szAgrv, tokens, _T(" ")); #endif bool bResult = false; std::string str; #ifdef _UNICODE ToMultiString(tokens[0], str); #else str = tokens[0]; #endif // ÆÄ¶ó¹ÌÅÍ // -capa_pak Data 50 ÆÐÅ·ÇÒÆú´õ ¾Æ¿ôDzÆú´õ // -folder_pak ÆÐÅ·Á¤º¸xml ¾Æ¿ôDzÆú´õ if ( str == "-capacity_pack") { return _CapaPacking(tokens); } else if ( str == "-folder_pack" ) { return _FolderPacking(tokens); } } // ÀÀ¿ë ÇÁ·Î±×·¥ ¸Å´ÏÆä½ºÆ®°¡ ComCtl32.dll ¹öÀü 6 ÀÌ»óÀ» »ç¿ëÇÏ¿© ºñÁÖ¾ó ½ºÅ¸ÀÏÀ» // »ç¿ëÇϵµ·Ï ÁöÁ¤ÇÏ´Â °æ¿ì, Windows XP »ó¿¡¼­ ¹Ýµå½Ã InitCommonControls()°¡ ÇÊ¿äÇÕ´Ï´Ù. // InitCommonControls()¸¦ »ç¿ëÇÏÁö ¾ÊÀ¸¸é âÀ» ¸¸µé ¼ö ¾ø½À´Ï´Ù. InitCommonControls(); CWinApp::InitInstance(); AfxEnableControlContainer(); // Ç¥ÁØ ÃʱâÈ­ // ÀÌµé ±â´ÉÀ» »ç¿ëÇÏÁö ¾Ê°í ÃÖÁ¾ ½ÇÇà ÆÄÀÏÀÇ Å©±â¸¦ ÁÙÀÌ·Á¸é // ¾Æ·¡¿¡¼­ ÇÊ¿ä ¾ø´Â ƯÁ¤ ÃʱâÈ­ ·çƾÀ» Á¦°ÅÇØ¾ß ÇÕ´Ï´Ù. // ÇØ´ç ¼³Á¤ÀÌ ÀúÀåµÈ ·¹Áö½ºÆ®¸® ۸¦ º¯°æÇϽʽÿÀ. // TODO: ÀÌ ¹®ÀÚ¿­À» ȸ»ç ¶Ç´Â Á¶Á÷ÀÇ À̸§°ú °°Àº // ÀûÀýÇÑ ³»¿ëÀ¸·Î ¼öÁ¤ÇØ¾ß ÇÕ´Ï´Ù. SetRegistryKey(_T("·ÎÄà ÀÀ¿ë ÇÁ·Î±×·¥ ¸¶¹ý»ç¿¡¼­ »ý¼ºÇÑ ÀÀ¿ë ÇÁ·Î±×·¥")); CNxFileSystemToolDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: ¿©±â¿¡ ´ëÈ­ »óÀÚ°¡ È®ÀÎÀ» ´­·¯ ¾ø¾îÁö´Â °æ¿ì ó¸®ÇÒ // Äڵ带 ¹èÄ¡ÇÕ´Ï´Ù. } else if (nResponse == IDCANCEL) { // TODO: ¿©±â¿¡ ´ëÈ­ »óÀÚ°¡ Ãë¼Ò¸¦ ´­·¯ ¾ø¾îÁö´Â °æ¿ì ó¸®ÇÒ // Äڵ带 ¹èÄ¡ÇÕ´Ï´Ù. } // ´ëÈ­ »óÀÚ°¡ ´ÝÇûÀ¸¹Ç·Î ÀÀ¿ë ÇÁ·Î±×·¥ÀÇ ¸Þ½ÃÁö ÆßÇÁ¸¦ ½ÃÀÛÇÏÁö ¾Ê°í // ÀÀ¿ë ÇÁ·Î±×·¥À» ³¡³¾ ¼ö ÀÖµµ·Ï FALSE¸¦ ¹ÝȯÇÕ´Ï´Ù. return FALSE; } // ¿ë·®º° ÆÐÅ· BOOL CNxFileSystemToolApp::_CapaPacking(std::vector& tokens) { if ( tokens.size() != 5 ) return FALSE; int nCapa = atoi(tokens[2].c_str()); if ( nCapa < 1 || nCapa > 2000 ) { nCapa = 50; } DIVPackingCapacityInfo info; info.m_szBaseName = tokens[1].c_str(); info.m_InputPath = tokens[3].c_str(); info.m_OutputPath = tokens[4].c_str(); info.nDivCapacity = nCapa; g_pDivPackingCapaThread = new CDivPackingCapacityThread(NULL, info); g_pDivPackingCapaThread->Start(); /* if ( ::WaitForSingleObject( g_pDivPackingThread->m_hHandleThread, INFINITE ) == WAIT_OBJECT_0 ) { delete g_pDivPackingThread; return TRUE; }*/ if ( g_pDivPackingCapaThread->WaitForTerminate() ) { delete g_pDivPackingCapaThread; return TRUE; } return FALSE; } // Æú´õ·Î ÆÐÅ· BOOL CNxFileSystemToolApp::_FolderPacking(std::vector& tokens) { if ( tokens.size() != 3 ) return FALSE; bool bResult = false; std::vector<_PackingInfo> packingInfo; std::string str = tokens[1]; bResult = ParseSettingFile(str.c_str(), packingInfo); if ( bResult == false ) return FALSE; g_pDivPackingThread = new CDivPackingThread(NULL, CString(tokens[1].c_str()), packingInfo); g_pDivPackingThread->Start(); /* if ( ::WaitForSingleObject( g_pDivPackingThread->m_hHandleThread, INFINITE ) == WAIT_OBJECT_0 ) { delete g_pDivPackingThread; return TRUE; }*/ if ( g_pDivPackingThread->WaitForTerminate() ) { delete g_pDivPackingThread; return TRUE; } return FALSE; }