1 /*******************************************************************************
\r
2 TPI - flexible but useless plug-in framework.
\r
3 Copyright (C) 2002-2009 Silky
\r
5 This library is free software; you can redistribute it and/or modify it under
\r
6 the terms of the GNU Lesser General Public License as published by the Free
\r
7 Software Foundation; either version 2.1 of the License, or (at your option)
\r
10 This library is distributed in the hope that it will be useful, but WITHOUT
\r
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
\r
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
\r
15 You should have received a copy of the GNU Lesser General Public License along
\r
16 with this library; if not, write to the Free Software Foundation, Inc.,
\r
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
\r
19 $Id: library.h,v 1.5 2009/09/27 10:11:13 sirakaba Exp $
\r
20 *******************************************************************************/
\r
22 //******************************************************************************
\r
24 //******************************************************************************
\r
26 #include "../header/plugin.h"
\r
27 #include <wx/file.h>
\r
29 //******************************************************************************
\r
31 //******************************************************************************
\r
33 wxString MakeCommandLineSend(wxString szCommandLine, wxString szArcName, TPI_SWITCHES * swInfo, wxArrayString asFiles, wxString szResponceFileName);
\r
34 wxString MakeResponceFile(wxArrayString asFiles, bool bQuote);
\r
35 wxString MB2String(const char * sz);
\r
36 wxString UTF82String(const char * sz);
\r
37 wxString WC2String(const wchar_t * sz);
\r
40 #include <wx/xml/xml.h>
\r
41 #define CheckSupportedCommand(attr, value) if (xmlLibrary->HasProp(wxT(attr)) || xmlLibrary->HasProp(wxT(attr) wxT("-alt"))) _fiInfo->llSupportedCommand |= value
\r
42 #define CheckSupportedSwitch(var, value) value = szCmdLine.Find(wxT(var)) != wxNOT_FOUND
\r
44 inline short GetNumValue(wxXmlNode * node, wxString szValue)
\r
47 node->GetPropVal(szValue, wxT("0")).ToLong(& l);
\r
51 inline void MakeFormatInfo(wxString szTPIName, TPI_FORMATINFO * _fiInfo, wxXmlNode * xmlLibrary, wxULongLong llId)
\r
53 _fiInfo->szTypeName = xmlLibrary->GetPropVal(wxT("typename"),wxEmptyString);
\r
54 _fiInfo->szSuffix = xmlLibrary->GetPropVal(wxT("suffix"), wxEmptyString);
\r
55 _fiInfo->szEngineName = xmlLibrary->GetPropVal(wxT("name"), wxEmptyString);
\r
56 _fiInfo->szTPIName = szTPIName;
\r
57 _fiInfo->llTypeId = llId;
\r
59 //
\91Î
\89\9e\83R
\83}
\83\93\83h
\82ð
\92²
\8d¸
\81B
\r
60 CheckSupportedCommand("add", TPI_COMMAND_ADD);
\r
61 CheckSupportedCommand("extract",TPI_COMMAND_EXTRACT);
\r
62 CheckSupportedCommand("delete", TPI_COMMAND_DELETE);
\r
63 CheckSupportedCommand("update", TPI_COMMAND_UPDATE);
\r
64 CheckSupportedCommand("test", TPI_COMMAND_TEST);
\r
65 CheckSupportedCommand("repair", TPI_COMMAND_REPAIR);
\r
66 CheckSupportedCommand("move", TPI_COMMAND_MOVE);
\r
67 CheckSupportedCommand("sfx", TPI_COMMAND_SFX);
\r
68 CheckSupportedCommand("unsfx", TPI_COMMAND_UNSFX);
\r
70 //
\91Î
\89\9e\83X
\83C
\83b
\83`
\82ð
\92²
\8d¸
\81B
\r
71 wxString szCmdLine =
\r
72 xmlLibrary->HasProp(wxT("add")) ? xmlLibrary->GetPropVal(wxT("add"), wxEmptyString) :
\r
73 xmlLibrary->HasProp(wxT("add-alt")) ? xmlLibrary->GetPropVal(wxT("add-alt"), wxEmptyString) :
\r
74 xmlLibrary->HasProp(wxT("extract")) ? xmlLibrary->GetPropVal(wxT("extract"), wxEmptyString) :
\r
75 xmlLibrary->HasProp(wxT("extract-alt")) ? xmlLibrary->GetPropVal(wxT("extract-alt"), wxEmptyString) :
\r
76 (wxString) wxEmptyString;
\r
77 CheckSupportedSwitch("96", _fiInfo->fComment);
\r
78 CheckSupportedSwitch("a1", _fiInfo->fSFX);
\r
79 CheckSupportedSwitch("a2", _fiInfo->fSolid);
\r
80 CheckSupportedSwitch("a3", _fiInfo->fMMOptimize);
\r
81 CheckSupportedSwitch("a4", _fiInfo->fEncryptHeader);
\r
82 CheckSupportedSwitch("a5", _fiInfo->fEncryptPassword);
\r
83 CheckSupportedSwitch("a6", _fiInfo->fEncryptKeyFile);
\r
84 CheckSupportedSwitch("a7", _fiInfo->fMultiVolume);
\r
86 _fiInfo->sCompressLevelMin = GetNumValue(xmlLibrary, wxT("level-min"));
\r
87 _fiInfo->sCompressLevelMax = GetNumValue(xmlLibrary, wxT("level-max"));
\r
88 _fiInfo->sRecoveryRecordMin = GetNumValue(xmlLibrary, wxT("rr-min"));
\r
89 _fiInfo->sRecoveryRecordMax = GetNumValue(xmlLibrary, wxT("rr-max"));
\r