From: sirakaba Date: Fri, 19 Feb 2010 03:49:58 +0000 (+0000) Subject: 圧縮レベル、Solid圧縮、ヘッダ暗号化の指定に対応。 X-Git-Tag: 0.01beta7~56 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8a921772fd910200d3800b91c353be8b2bd67ede;p=tpi%2Flychee.git 圧縮レベル、Solid圧縮、ヘッダ暗号化の指定に対応。 git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@232 9df91469-1e22-0410-86e7-ea8537beb833 --- diff --git a/src/plugin/7zArc/7zArc.cpp b/src/plugin/7zArc/7zArc.cpp index fa05b62..b6fd37b 100644 --- a/src/plugin/7zArc/7zArc.cpp +++ b/src/plugin/7zArc/7zArc.cpp @@ -75,7 +75,6 @@ int GetFileInformation2(void * _hArchive, TPI_FILEINFO * _fiInfo, unsigned int n hArc->GetProperty(nIndex, kpidATime, & prop); NWindows::NTime::FileTimeToUnixTime(prop.filetime, t); _fiInfo->tmAccess.Set((time_t) t); -// _fiInfo->uOSType = hdInfo.HostOS; hArc->GetProperty(nIndex, kpidPath, & prop); if (prop.vt == VT_BSTR) { @@ -142,7 +141,7 @@ int __stdcall GetFormatInformation2(TPI_FORMATINFO * _fiInfo, unsigned int & nIn _fiInfo->szSuffix = wxT("bz2"); _fiInfo->llSupportedCommand |= TPI_COMMAND_CREATE; _fiInfo->fArchive = false; - _fiInfo->sCompressLevelMin = 0; + _fiInfo->sCompressLevelMin = 1; _fiInfo->sCompressLevelMax = 9; } #if 0 @@ -226,7 +225,7 @@ int __stdcall GetFormatInformation2(TPI_FORMATINFO * _fiInfo, unsigned int & nIn _fiInfo->szSuffix = wxT("gz"); _fiInfo->llSupportedCommand |= TPI_COMMAND_CREATE; _fiInfo->fArchive = false; - _fiInfo->sCompressLevelMin = 0; + _fiInfo->sCompressLevelMin = 1; _fiInfo->sCompressLevelMax = 9; } else @@ -887,6 +886,7 @@ int __stdcall Command case TPI_COMMAND_CREATE: // case TPI_COMMAND_ADD: { + // 入力リストを作成。 CObjectVector fiItems; for (unsigned int i = 0; i < _szFiles.GetCount(); i++) { @@ -900,6 +900,7 @@ int __stdcall Command fiItems.Add(fi); } + // 書庫を作成。 COutFileStream * outFileStreamSpec = new COutFileStream; CMyComPtr outFileStream = outFileStreamSpec; if (! outFileStreamSpec->Create(_szArcName.c_str(), false)) @@ -907,12 +908,61 @@ int __stdcall Command return TPI_ERROR_IO_ARC_OPEN; } + // エンジンを読み込み。 IOutArchive * hArc; if (((unsigned int (__stdcall *)(const GUID *, const GUID *, void **)) g_fpProc)(& guidList[g_llEngineId.ToULong()], & IID_IOutArchive, (void **) & hArc) != S_OK) { return TPI_ERROR_ARC_UNSUPPORTED; } + // 形式情報を取得。 + TPI_FORMATINFO fiInfo; + unsigned int nIndex = g_llEngineId.ToULong(); + GetFormatInformation2(& fiInfo, nIndex); + + // パラメータを設定。 + ISetProperties * setProp; + if (hArc->QueryInterface(IID_ISetProperties, (void **) & setProp) == S_OK) + { + CRecordVector szProps; + NWindows::NCOM::CPropVariant propValues[100]; + wxString szProp; + // 圧縮レベル。 + if (fiInfo.sCompressLevelMin != fiInfo.sCompressLevelMax) + { + szProp = wxString::Format(wxT("x%d"), _swInfo->sCompressLevel); + szProps.Add(szProp.c_str()); + } + // Solid圧縮。 + if (fiInfo.fSolid) + { + propValues[szProps.Size()] = _swInfo->fSolid; + szProps.Add(wxT("s")); + } + // ヘッダ圧縮。 +/* if (fiInfo.fCompressHeader) + { + propValues[szProps.Size()] = _swInfo->fCompressHeader; + szProps.Add(wxT("hc")); + } +*/ // ヘッダ暗号化。 + if (fiInfo.fEncryptHeader) + { + propValues[szProps.Size()] = _swInfo->fEncryptHeader; + szProps.Add(wxT("he")); + } + +// szProp = wxString::Format(wxT("m")); +// propValues[szProps.Size()] = L"Deflate"; +// szProps.Add(szProp.c_str()); + +// szProp = wxString::Format(wxT("fb%d"), ); +// szProps.Add(szProp.c_str()); + + setProp->SetProperties(& szProps.Front(), propValues, szProps.Size()); + } + + // 更新処理を実行。 CArchiveUpdateCallback * updateCallbackSpec = new CArchiveUpdateCallback; CMyComPtr updateCallback(updateCallbackSpec); updateCallbackSpec->fiItems = & fiItems;