Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
69a78741
Commit
69a78741
authored
Oct 13, 2017
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xml string as second command-line param(first - path to xml)
parent
22f98629
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
5 deletions
+73
-5
X2tConverter/src/cextracttools.h
X2tConverter/src/cextracttools.h
+60
-0
X2tConverter/src/main.cpp
X2tConverter/src/main.cpp
+13
-5
No files found.
X2tConverter/src/cextracttools.h
View file @
69a78741
...
@@ -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""
);
}
}
}
}
...
...
X2tConverter/src/main.cpp
View file @
69a78741
...
@@ -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
sArg
2
,
sArg
3
,
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
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment