mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
.
This commit is contained in:
@ -33,6 +33,7 @@ HEADERS += \
|
|||||||
./../DesktopEditor/graphics/TemporaryCS.h
|
./../DesktopEditor/graphics/TemporaryCS.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
../OdfFile/Common/logging.cpp \
|
||||||
./../DesktopEditor/graphics/TemporaryCS.cpp
|
./../DesktopEditor/graphics/TemporaryCS.cpp
|
||||||
|
|
||||||
# THREAD
|
# THREAD
|
||||||
|
|||||||
@ -33,6 +33,8 @@
|
|||||||
#include "ZipUtilsCP.h"
|
#include "ZipUtilsCP.h"
|
||||||
#include "../../DesktopEditor/common/File.h"
|
#include "../../DesktopEditor/common/File.h"
|
||||||
#include "../../DesktopEditor/common/Directory.h"
|
#include "../../DesktopEditor/common/Directory.h"
|
||||||
|
#include "../../OdfFile/Common/logging.h"
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
COfficeUtils::COfficeUtils(OnProgressCallback* fCallback)
|
COfficeUtils::COfficeUtils(OnProgressCallback* fCallback)
|
||||||
{
|
{
|
||||||
@ -48,10 +50,12 @@ HRESULT COfficeUtils::ExtractToDirectory(const std::wstring& _zipFile, const std
|
|||||||
std::wstring zipFile = _zipFile;
|
std::wstring zipFile = _zipFile;
|
||||||
std::wstring unzipDir = _unzipDir;
|
std::wstring unzipDir = _unzipDir;
|
||||||
#endif
|
#endif
|
||||||
|
_CP_LOG << L"start unzip" << std::endl;
|
||||||
|
|
||||||
if( ZLibZipUtils::UnzipToDir( zipFile.c_str(), unzipDir.c_str(), m_fCallback, password, ( extract_without_path > 0 ) ? (true) : (false) ) == 0 )
|
if( ZLibZipUtils::UnzipToDir( zipFile.c_str(), unzipDir.c_str(), m_fCallback, password, ( extract_without_path > 0 ) ? (true) : (false) ) == 0 )
|
||||||
{
|
{
|
||||||
return S_OK;
|
_CP_LOG << L"end unzip" << std::endl;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -65,11 +69,13 @@ HRESULT COfficeUtils::ExtractToDirectory(BYTE* data, size_t len, const std::wstr
|
|||||||
std::wstring unzipDir = CorrectPathW(_unzipDir);
|
std::wstring unzipDir = CorrectPathW(_unzipDir);
|
||||||
#else
|
#else
|
||||||
std::wstring unzipDir = _unzipDir;
|
std::wstring unzipDir = _unzipDir;
|
||||||
#endif
|
#endif
|
||||||
|
_CP_LOG << L"start unzip" << std::endl;
|
||||||
|
|
||||||
if( ZLibZipUtils::UnzipToDir( data, len, unzipDir.c_str(), m_fCallback, password, ( extract_without_path > 0 ) ? (true) : (false) ) == 0 )
|
if( ZLibZipUtils::UnzipToDir( data, len, unzipDir.c_str(), m_fCallback, password, ( extract_without_path > 0 ) ? (true) : (false) ) == 0 )
|
||||||
{
|
{
|
||||||
return S_OK;
|
_CP_LOG << L"end unzip" << std::endl;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -87,13 +93,15 @@ HRESULT COfficeUtils::CompressFileOrDirectory(const std::wstring& _name, const s
|
|||||||
std::wstring name = _name;
|
std::wstring name = _name;
|
||||||
std::wstring outputFile = _outputFile;
|
std::wstring outputFile = _outputFile;
|
||||||
#endif
|
#endif
|
||||||
|
_CP_LOG << L"start zip" << std::endl;
|
||||||
|
|
||||||
HRESULT result = S_FALSE;
|
HRESULT result = S_FALSE;
|
||||||
if(NSDirectory::Exists(name))
|
if(NSDirectory::Exists(name))
|
||||||
{
|
{
|
||||||
if ( ZLibZipUtils::ZipDir( name.c_str(), outputFile.c_str(), m_fCallback, bSorted, method, level, bDateTime ) == 0 )
|
if ( ZLibZipUtils::ZipDir( name.c_str(), outputFile.c_str(), m_fCallback, bSorted, method, level, bDateTime ) == 0 )
|
||||||
{
|
{
|
||||||
result = S_OK;
|
_CP_LOG << L"end zip" << std::endl;
|
||||||
|
result = S_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -104,7 +112,8 @@ HRESULT COfficeUtils::CompressFileOrDirectory(const std::wstring& _name, const s
|
|||||||
{
|
{
|
||||||
if ( ZLibZipUtils::ZipFile( name.c_str(), outputFile.c_str(), method, level, bDateTime ) == 0 )
|
if ( ZLibZipUtils::ZipFile( name.c_str(), outputFile.c_str(), method, level, bDateTime ) == 0 )
|
||||||
{
|
{
|
||||||
result = S_OK;
|
_CP_LOG << L"end zip" << std::endl;
|
||||||
|
result = S_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -59,6 +59,7 @@
|
|||||||
|
|
||||||
#include "../../DesktopEditor/doctrenderer/docbuilder.h"
|
#include "../../DesktopEditor/doctrenderer/docbuilder.h"
|
||||||
#include "../../MsBinaryFile/Common/Vba/VbaReader.h"
|
#include "../../MsBinaryFile/Common/Vba/VbaReader.h"
|
||||||
|
#include "../../OdfFile/Common/logging.h"
|
||||||
|
|
||||||
namespace NExtractTools
|
namespace NExtractTools
|
||||||
{
|
{
|
||||||
@ -1577,6 +1578,7 @@ namespace NExtractTools
|
|||||||
|
|
||||||
_UINT32 fromInputParams(InputParams& oInputParams)
|
_UINT32 fromInputParams(InputParams& oInputParams)
|
||||||
{
|
{
|
||||||
|
_CP_LOG << L"start/detect conversion" << std::endl;
|
||||||
TConversionDirection conversion = oInputParams.getConversionDirection();
|
TConversionDirection conversion = oInputParams.getConversionDirection();
|
||||||
|
|
||||||
std::wstring sFileFrom = oInputParams.m_sFileFrom ? *oInputParams.m_sFileFrom : L"";
|
std::wstring sFileFrom = oInputParams.m_sFileFrom ? *oInputParams.m_sFileFrom : L"";
|
||||||
@ -1647,11 +1649,13 @@ namespace NExtractTools
|
|||||||
NSFile::CFileBinary::SetTempPath(sGlobalTempDir);
|
NSFile::CFileBinary::SetTempPath(sGlobalTempDir);
|
||||||
return AVS_FILEUTILS_ERROR_CONVERT_LIMITS;
|
return AVS_FILEUTILS_ERROR_CONVERT_LIMITS;
|
||||||
}
|
}
|
||||||
|
_CP_LOG << L"doct initialize" << std::endl;
|
||||||
|
|
||||||
#ifndef BUILD_X2T_AS_LIBRARY_DYLIB
|
#ifndef BUILD_X2T_AS_LIBRARY_DYLIB
|
||||||
NSDoctRenderer::CDocBuilder::Initialize();
|
NSDoctRenderer::CDocBuilder::Initialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_CP_LOG << L"start conversion" << std::endl;
|
||||||
_UINT32 result = 0;
|
_UINT32 result = 0;
|
||||||
switch (conversion)
|
switch (conversion)
|
||||||
{
|
{
|
||||||
@ -2310,10 +2314,13 @@ namespace NExtractTools
|
|||||||
if (!sGlobalTempDir.empty())
|
if (!sGlobalTempDir.empty())
|
||||||
NSFile::CFileBinary::SetTempPath(sGlobalTempDir);
|
NSFile::CFileBinary::SetTempPath(sGlobalTempDir);
|
||||||
|
|
||||||
|
_CP_LOG << L"end conversion and start dispose doctrenderer" << std::endl;
|
||||||
// clean up v8
|
// clean up v8
|
||||||
#ifndef BUILD_X2T_AS_LIBRARY_DYLIB
|
#ifndef BUILD_X2T_AS_LIBRARY_DYLIB
|
||||||
NSDoctRenderer::CDocBuilder::Dispose();
|
NSDoctRenderer::CDocBuilder::Dispose();
|
||||||
#endif
|
#endif
|
||||||
|
_CP_LOG << L"finish" << std::endl;
|
||||||
|
|
||||||
if (SUCCEEDED_X2T(result) && oInputParams.m_bOutputConvertCorrupted)
|
if (SUCCEEDED_X2T(result) && oInputParams.m_bOutputConvertCorrupted)
|
||||||
{
|
{
|
||||||
return AVS_FILEUTILS_ERROR_CONVERT_CORRUPTED;
|
return AVS_FILEUTILS_ERROR_CONVERT_CORRUPTED;
|
||||||
|
|||||||
Reference in New Issue
Block a user