if (asFiles.GetCount() == 1 && ::wxFileExists(asFiles[0]))\r
{\r
// 対応しているかどうか確認。\r
- long l = this->mainFrame->LoadTPI(asFiles[0]);\r
- if (l != 0)\r
+ wxULongLong_t llFileCount = 0;\r
+ if (this->mainFrame->LoadTPI(asFiles[0], & llFileCount))\r
{\r
// 書庫を開く。\r
- e.SetExtraLong(l);\r
+ e.SetExtraLong((long) llFileCount);\r
this->mainFrame->fnArchive = wxFileName(asFiles[0]);\r
this->mainFrame->OnArcOpen(e);\r
return true;\r
ProcessDialog procDlg;\r
procDlg.Show(true);\r
\r
- // TPIã\82\92èªã\81¿è¾¼ã\81¿ã\80\81æ\9c\80å\88\9dã\81®ã\82³ã\83¼ã\83«ã\83\90ã\83\83ã\82¯ã\82\92é\80\81ä¿¡ã\80\82\r
+ // TPIを読み込み。\r
TPI_PROCESSINFO piInfo;\r
- piInfo.eMessage = TPI_MESSAGE_STATUS;\r
- piInfo.eStatus = 0x1000;\r
- piInfo.nProcessedSize = 0;\r
- piInfo.fiInfo.fnFileName = this->fnArchive;\r
- piInfo.fiInfo.nUnpackedSize = e.GetExtraLong() != 0 ? e.GetExtraLong() : this->LoadTPI(this->fnArchive.GetFullPath());\r
+ piInfo.fiInfo.nUnpackedSize = e.GetExtraLong();\r
if (piInfo.fiInfo.nUnpackedSize == 0)\r
{\r
- procDlg.Show(false);\r
- tpi.FreeLibrary();\r
- if (this->IsShown())\r
+ // DnD以外で書庫を開く場合。\r
+ if (! this->LoadTPI(this->fnArchive.GetFullPath(), & piInfo.fiInfo.nUnpackedSize))\r
{\r
- wxBell();\r
- this->statusbar->SetStatusText(_("No plug-in supporting this archive was found!"), 4);\r
- }\r
- else\r
- {\r
- wxLogError(_("No plug-in supporting this archive was found!"));\r
- this->Close(true);\r
+ procDlg.Show(false);\r
+ tpi.FreeLibrary();\r
+ if (this->IsShown())\r
+ {\r
+ wxBell();\r
+ this->statusbar->SetStatusText(_("No plug-in supporting this archive was found!"), 4);\r
+ }\r
+ else\r
+ {\r
+ wxLogError(_("No plug-in supporting this archive was found!"));\r
+ this->Close(true);\r
+ }\r
+ return;\r
}\r
- return;\r
}\r
+\r
+ // 最初のコールバックを送信。\r
+ piInfo.eMessage = TPI_MESSAGE_STATUS;\r
+ piInfo.eStatus = 0x1000;\r
+ piInfo.nProcessedSize = 0;\r
+ piInfo.fiInfo.fnFileName = this->fnArchive;\r
procDlg.CallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
\r
// 配列のサイズを確保。\r
this->fileinfo.Alloc(piInfo.fiInfo.nUnpackedSize);\r
\r
- // 書庫を開く。\r
- if (! tpi.OpenArchive(this->fnArchive.GetFullPath()))\r
- {\r
- procDlg.Show(false);\r
- tpi.FreeLibrary();\r
- this->ErrorCheck(tpi.nErrorCode, wxT("OpenArchive"));\r
- return;\r
- }\r
-\r
// 履歴に追加。\r
this->conf.WriteHistory(CONF_HISTORY_PATH, this->fnArchive.GetPath());\r
this->conf.WriteHistory(CONF_HISTORY_NAME, this->fnArchive.GetFullName());\r
\r
// イベントハンドラ以外。\r
\r
-wxULongLong_t MainFrame::LoadTPI(wxString szFileName)\r
+bool MainFrame::LoadTPI(wxString szFileName, wxULongLong_t * llFileCount)\r
{\r
// TPIを読み込み。\r
wxDir fs(L_DIR_B_LIB);\r
- wxULongLong_t llFileCount = 0;\r
wxString szTPIName;\r
if (fs.GetFirst(& szTPIName, wxT("*" TPI_EXT)))\r
{\r
tpi.SetCallbackProc(TPICallbackProc);\r
\r
// 対応確認。\r
- if (! tpi.CheckArchive(szFileName, & llFileCount) || llFileCount == 0)\r
+ if (! tpi.CheckArchive(szFileName, llFileCount) || ! tpi.OpenArchive(szFileName))\r
{\r
tpi.FreeLibrary();\r
- llFileCount = 0;\r
+ * llFileCount = 0;\r
continue;\r
}\r
- break;\r
+ return true;\r
}\r
while (fs.GetNext(& szTPIName));\r
}\r
- return llFileCount;\r
+ return false;\r
}\r
\r
int MainFrame::ErrorCheck(int nErrorCode, wxString szAPIName)\r
\r
int __stdcall CheckArchive\r
(\r
- const wxString & _szArcName,\r
- wxULongLong_t * _llFileCount\r
+ const wxString &,\r
+ wxULongLong_t *\r
)\r
{\r
- void * _hArchive;\r
- int nErrorCode = OpenArchive(_szArcName, & _hArchive);\r
- if (nErrorCode != TPI_ERROR_SUCCESS)\r
- {\r
- return nErrorCode;\r
- }\r
-\r
- if (_llFileCount != NULL)\r
- {\r
- unsigned int nFileCount = 0;\r
- ((IInArchive *) _hArchive)->GetNumberOfItems(& nFileCount);\r
- * _llFileCount = nFileCount;\r
- }\r
-\r
- return CloseArchive(_hArchive);\r
+ return TPI_ERROR_SUCCESS;\r
}\r
\r
int __stdcall OpenArchive\r
int __stdcall CheckArchive\r
(\r
const wxString & _szArcName,\r
- wxULongLong_t * _llFileCount\r
+ wxULongLong_t *\r
)\r
{\r
FARPROC fpProc = ::GetAPIAddress("IsValidArchive");\r
return TPI_ERROR_U_USE_LIBRARY;\r
}\r
\r
- if (_llFileCount != NULL)\r
- {\r
- * _llFileCount = 1;\r
- }\r
-\r
egg_type eType;\r
return ErrorCodeConvert(((UINT (__cdecl *)(const wchar_t *, egg_type *)) fpProc)(_szArcName.wchar_str(), & eType));\r
}\r
\r
int __stdcall CheckArchive\r
(\r
- const wxString & _szArcName,\r
- wxULongLong_t * _llFileCount\r
+ const wxString &,\r
+ wxULongLong_t *\r
)\r
{\r
- void * _hArchive;\r
- int nErrorCode = OpenArchive(_szArcName, & _hArchive);\r
- if (nErrorCode != TPI_ERROR_SUCCESS)\r
- {\r
- return nErrorCode;\r
- }\r
-\r
- if (_llFileCount != NULL)\r
- {\r
- * _llFileCount = 1;\r
- }\r
-\r
- return CloseArchive(_hArchive);\r
+ return TPI_ERROR_SUCCESS;\r
}\r
\r
int __stdcall OpenArchive\r