Commit 69a78741 authored by konovalovsergey's avatar konovalovsergey

xml string as second command-line param(first - path to xml)

parent 22f98629
...@@ -471,11 +471,13 @@ namespace NExtractTools ...@@ -471,11 +471,13 @@ namespace NExtractTools
std::wstring sName = oXmlNode.GetName(); std::wstring sName = oXmlNode.GetName();
if(_T("m_oMailMergeSend") == sName) if(_T("m_oMailMergeSend") == sName)
{ {
RELEASEOBJECT(m_oMailMergeSend);
m_oMailMergeSend = new InputParamsMailMerge(); m_oMailMergeSend = new InputParamsMailMerge();
m_oMailMergeSend->FromXmlNode(oXmlNode); m_oMailMergeSend->FromXmlNode(oXmlNode);
} }
else if(_T("m_oThumbnail") == sName) else if(_T("m_oThumbnail") == sName)
{ {
RELEASEOBJECT(m_oThumbnail);
m_oThumbnail = new InputParamsThumbnail(); m_oThumbnail = new InputParamsThumbnail();
m_oThumbnail->FromXmlNode(oXmlNode); m_oThumbnail->FromXmlNode(oXmlNode);
} }
...@@ -485,49 +487,107 @@ namespace NExtractTools ...@@ -485,49 +487,107 @@ namespace NExtractTools
if(oXmlNode.GetTextIfExist(sValue)) if(oXmlNode.GetTextIfExist(sValue))
{ {
if(_T("m_sKey") == sName) if(_T("m_sKey") == sName)
{
RELEASEOBJECT(m_sKey);
m_sKey = new std::wstring(sValue); m_sKey = new std::wstring(sValue);
}
else if(_T("m_sFileFrom") == sName) else if(_T("m_sFileFrom") == sName)
{
RELEASEOBJECT(m_sFileFrom);
m_sFileFrom = new std::wstring(sValue); m_sFileFrom = new std::wstring(sValue);
}
else if(_T("m_sFileTo") == sName) else if(_T("m_sFileTo") == sName)
{
RELEASEOBJECT(m_sFileTo);
m_sFileTo = new std::wstring(sValue); m_sFileTo = new std::wstring(sValue);
}
else if(_T("m_nFormatFrom") == sName) else if(_T("m_nFormatFrom") == sName)
{
RELEASEOBJECT(m_nFormatFrom);
m_nFormatFrom = new int(XmlUtils::GetInteger(sValue)); m_nFormatFrom = new int(XmlUtils::GetInteger(sValue));
}
else if(_T("m_nFormatTo") == sName) else if(_T("m_nFormatTo") == sName)
{
RELEASEOBJECT(m_nFormatTo);
m_nFormatTo = new int(XmlUtils::GetInteger(sValue)); m_nFormatTo = new int(XmlUtils::GetInteger(sValue));
}
else if(_T("m_nCsvTxtEncoding") == sName) else if(_T("m_nCsvTxtEncoding") == sName)
{
RELEASEOBJECT(m_nCsvTxtEncoding);
m_nCsvTxtEncoding = new int(XmlUtils::GetInteger(sValue)); m_nCsvTxtEncoding = new int(XmlUtils::GetInteger(sValue));
}
else if(_T("m_nCsvDelimiter") == sName) else if(_T("m_nCsvDelimiter") == sName)
{
RELEASEOBJECT(m_nCsvDelimiter);
m_nCsvDelimiter = new int(XmlUtils::GetInteger(sValue)); m_nCsvDelimiter = new int(XmlUtils::GetInteger(sValue));
}
else if(_T("m_nCsvDelimiterChar") == sName) else if(_T("m_nCsvDelimiterChar") == sName)
{
RELEASEOBJECT(m_sCsvDelimiterChar);
m_sCsvDelimiterChar = new std::wstring(sValue); m_sCsvDelimiterChar = new std::wstring(sValue);
}
else if(_T("m_bPaid") == sName) else if(_T("m_bPaid") == sName)
{
RELEASEOBJECT(m_bPaid);
m_bPaid = new bool(XmlUtils::GetBoolean2(sValue)); m_bPaid = new bool(XmlUtils::GetBoolean2(sValue));
}
else if(_T("m_bFromChanges") == sName) else if(_T("m_bFromChanges") == sName)
{
RELEASEOBJECT(m_bFromChanges);
m_bFromChanges = new bool(XmlUtils::GetBoolean2(sValue)); m_bFromChanges = new bool(XmlUtils::GetBoolean2(sValue));
}
else if(_T("m_sAllFontsPath") == sName) else if(_T("m_sAllFontsPath") == sName)
{
RELEASEOBJECT(m_sAllFontsPath);
m_sAllFontsPath = new std::wstring(sValue); m_sAllFontsPath = new std::wstring(sValue);
}
else if(_T("m_sFontDir") == sName) else if(_T("m_sFontDir") == sName)
{
RELEASEOBJECT(m_sFontDir);
m_sFontDir = new std::wstring(sValue); m_sFontDir = new std::wstring(sValue);
}
else if(_T("m_sThemeDir") == sName) else if(_T("m_sThemeDir") == sName)
{
RELEASEOBJECT(m_sThemeDir);
m_sThemeDir = new std::wstring(sValue); m_sThemeDir = new std::wstring(sValue);
}
else if(_T("m_bDontSaveAdditional") == sName) else if(_T("m_bDontSaveAdditional") == sName)
{
RELEASEOBJECT(m_bDontSaveAdditional);
m_bDontSaveAdditional = new bool(XmlUtils::GetBoolean2(sValue)); m_bDontSaveAdditional = new bool(XmlUtils::GetBoolean2(sValue));
}
else if(_T("m_nDoctParams") == sName) else if(_T("m_nDoctParams") == sName)
{
RELEASEOBJECT(m_nDoctParams);
m_nDoctParams = new int(XmlUtils::GetInteger(sValue)); m_nDoctParams = new int(XmlUtils::GetInteger(sValue));
}
else if(_T("m_sHtmlFileInternalPath") == sName) else if(_T("m_sHtmlFileInternalPath") == sName)
{
RELEASEOBJECT(m_sHtmlFileInternalPath);
m_sHtmlFileInternalPath = new std::wstring(sValue); m_sHtmlFileInternalPath = new std::wstring(sValue);
}
else if(_T("m_sPassword") == sName) else if(_T("m_sPassword") == sName)
{
RELEASEOBJECT(m_sPassword);
m_sPassword = new std::wstring(sValue); m_sPassword = new std::wstring(sValue);
}
else if(_T("m_sTempDir") == sName) else if(_T("m_sTempDir") == sName)
{
RELEASEOBJECT(m_sTempDir);
m_sTempDir = new std::wstring(sValue); m_sTempDir = new std::wstring(sValue);
}
else if(_T("m_bIsNoBase64") == sName) else if(_T("m_bIsNoBase64") == sName)
{
RELEASEOBJECT(m_bIsNoBase64);
m_bIsNoBase64 = new bool(XmlUtils::GetBoolean2(sValue)); m_bIsNoBase64 = new bool(XmlUtils::GetBoolean2(sValue));
}
} }
else if(_T("m_nCsvDelimiterChar") == sName) else if(_T("m_nCsvDelimiterChar") == sName)
{ {
std::wstring sNil; std::wstring sNil;
if (!oXmlNode.GetAttributeIfExist(L"xsi:nil", sNil)) if (!oXmlNode.GetAttributeIfExist(L"xsi:nil", sNil))
{ {
RELEASEOBJECT(m_sCsvDelimiterChar);
m_sCsvDelimiterChar = new std::wstring(L""); m_sCsvDelimiterChar = new std::wstring(L"");
} }
} }
......
...@@ -104,33 +104,41 @@ static std::wstring utf8_to_unicode(const char *src) ...@@ -104,33 +104,41 @@ static std::wstring utf8_to_unicode(const char *src)
return getReturnErrorCode(AVS_FILEUTILS_ERROR_CONVERT_PARAMS); return getReturnErrorCode(AVS_FILEUTILS_ERROR_CONVERT_PARAMS);
} }
std::wstring sArg1, sExePath; std::wstring sArg1, sArg2, sExePath;
#if !defined(_WIN32) && !defined (_WIN64) #if !defined(_WIN32) && !defined (_WIN64)
sExePath = utf8_to_unicode(argv [0]); sExePath = utf8_to_unicode(argv [0]);
sArg1 = utf8_to_unicode(argv [1]); sArg1 = utf8_to_unicode(argv [1]);
if (argc >= 3) sArg2 = utf8_to_unicode(argv [2]);
#else #else
sExePath = std::wstring(argv [0]); sExePath = std::wstring(argv [0]);
sArg1 = std::wstring(argv [1]); sArg1 = std::wstring(argv [1]);
if (argc >= 3) sArg2 = std::wstring(argv [2]);
#endif #endif
int result = 0; int result = 0;
std::wstring sXmlExt = _T(".xml"); std::wstring sXmlExt = _T(".xml");
if(sXmlExt == sArg1.substr(sArg1.length() - sXmlExt.length(), sXmlExt.length())) if(sXmlExt == sArg1.substr(sArg1.length() - sXmlExt.length(), sXmlExt.length()))
{ {
result = NExtractTools::FromFile(sArg1); NExtractTools::InputParams oInputParams;
if (oInputParams.FromXmlFile(sArg1) && (sArg2.empty() || oInputParams.FromXml(sArg2)))
{
result = NExtractTools::fromInputParams(oInputParams);
}
else
{
result = AVS_FILEUTILS_ERROR_CONVERT_PARAMS;
}
} }
else else
{ {
std::wstring sArg2, sArg3, sArg4, sArg5; std::wstring sArg3, sArg4, sArg5;
#if !defined(_WIN32) && !defined (_WIN64) #if !defined(_WIN32) && !defined (_WIN64)
if (argc >= 3) sArg2 = utf8_to_unicode(argv [2]);
if (argc >= 4) sArg3 = utf8_to_unicode(argv [3]); if (argc >= 4) sArg3 = utf8_to_unicode(argv [3]);
if (argc >= 5) sArg4 = utf8_to_unicode(argv [4]); if (argc >= 5) sArg4 = utf8_to_unicode(argv [4]);
if (argc >= 6) sArg5 = utf8_to_unicode(argv [5]); if (argc >= 6) sArg5 = utf8_to_unicode(argv [5]);
#else #else
if (argc >= 3) sArg2 = std::wstring(argv [2]);
if (argc >= 4) sArg3 = std::wstring(argv [3]); if (argc >= 4) sArg3 = std::wstring(argv [3]);
if (argc >= 5) sArg4 = std::wstring(argv [4]); if (argc >= 5) sArg4 = std::wstring(argv [4]);
if (argc >= 6) sArg5 = std::wstring(argv [5]); if (argc >= 6) sArg5 = std::wstring(argv [5]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment