Debian Codegraph @

libqnapi/src/utils/p7zipdecoder.cpp

raw symbols SCIP
1 /*****************************************************************************
2 ** QNapi
3 ** Copyright (C) 2008-2017 Piotr KrzemiƄski <[email protected]>
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 **
13 *****************************************************************************/
14
15 #include "p7zipdecoder.h"cxx . . $ `<file>/libqnapi/src/utils/p7zipdecoder.h`/
16
17 #include <QProcess>
18
19 P7ZipDecodercxx . . $ P7ZipDecoder#::P7ZipDecodercxx . . $ P7ZipDecoder#P7ZipDecoder(29ed8fcd127906b1).(const QStringcxx . . $ QString#& p7zipPath, int operationTimeoutMsecs)
20 : p7zipPathcxx . . $ P7ZipDecoder#p7zipPath.(p7zipPath), operationTimeoutMsecscxx . . $ P7ZipDecoder#operationTimeoutMsecs.(operationTimeoutMsecs) {}
21
22 QStringListcxx . . $ QStringList# P7ZipDecodercxx . . $ P7ZipDecoder#::listArchiveFilescxx . . $ P7ZipDecoder#listArchiveFiles(50afb52245723b61).(const QStringcxx . . $ QString#& archivePath) const {
23 QStringcxx . . $ QString# stdoutBuff = readP7ZipOutputcxx . . $ QString#QString(e1217c004a86c950).({cxx . . $ QStringList#QStringList(d3efa563c6b2065f)."l", "-slt", archivePath});
24
25 #ifdef Q_OS_WIN
26 QRegExp r("\r\nPath = ([^\r\n]*)\r\n");
27 #else
28 QRegExpcxx . . $ QRegExp# rcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("\nPath = ([^\n]*)\n"cxx . . $ QString#QString(85c52e162fed56f9).);
29 #endif
30 r.setPatternSyntaxcxx . . $ QRegExp#setPatternSyntax(e2983a6a777435d7).(QRegExpcxx . . $ QRegExp#::RegExp2cxx . . $ QRegExp#RegExp2.);
31
32 QStringListcxx . . $ QStringList# filescxx . . $ QStringList#QStringList(49f6e7a06ebc5aa8).;
33 int offset = 0;
34
35 while ((offset = r.indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(stdoutBuff, offset)) != -1) {
36 files <<cxx . . $ QStringList#`operator<<`(85116071a693d053). r.capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(1);
37 offset += r.matchedLengthcxx . . $ QRegExp#matchedLength(455f465bc33b4cdf).();
38 }
39
40 return files;
41 }
42
43 bool P7ZipDecodercxx . . $ P7ZipDecoder#::unpackArchiveFilecxx . . $ P7ZipDecoder#unpackArchiveFile(b62c89774989cffa).(const QStringcxx . . $ QString#& archivePath,
44 const QStringcxx . . $ QString#& filename,
45 const QStringcxx . . $ QString#& targetPath) const {
46 return runP7Zipcxx . . $ P7ZipDecoder#runP7Zip(5f1b03c390062051).({cxx . . $ QStringList#QStringList(d3efa563c6b2065f)."e", "-y", "-o" +cxx . . $ operator+(c75c3ae4eb9af1a8). targetPath, archivePath, filename});
47 }
48
49 bool P7ZipDecodercxx . . $ P7ZipDecoder#::unpackArchiveFilescxx . . $ P7ZipDecoder#unpackArchiveFiles(90f171d2530d3e23).(const QStringcxx . . $ QString#& archivePath,
50 const QStringcxx . . $ QString#& targetPath) const {
51 return runP7Zipcxx . . $ P7ZipDecoder#runP7Zip(5f1b03c390062051).({cxx . . $ QStringList#QStringList(d3efa563c6b2065f)."e", "-y", "-o" +cxx . . $ operator+(c75c3ae4eb9af1a8). targetPath, archivePath});
52 }
53
54 bool P7ZipDecodercxx . . $ P7ZipDecoder#::unpackSecureArchiveFilescxx . . $ P7ZipDecoder#unpackSecureArchiveFiles(b62c89774989cffa).(const QStringcxx . . $ QString#& archivePath,
55 const QStringcxx . . $ QString#& password,
56 const QStringcxx . . $ QString#& targetPath) const {
57 return runP7Zipcxx . . $ P7ZipDecoder#runP7Zip(5f1b03c390062051).({cxx . . $ QStringList#QStringList(d3efa563c6b2065f)."e", "-y", "-p" +cxx . . $ operator+(c75c3ae4eb9af1a8). password, "-o" +cxx . . $ operator+(c75c3ae4eb9af1a8). targetPath, archivePath});
58 }
59
60 bool P7ZipDecodercxx . . $ P7ZipDecoder#::runP7Zipcxx . . $ P7ZipDecoder#runP7Zip(5f1b03c390062051).(const QStringListcxx . . $ QStringList#& args) const {
61 QProcesscxx . . $ QProcess# p7zipcxx . . $ QProcess#QProcess(749de1b6ae65bddd).;
62 p7zip.startcxx . . $ QProcess#start(5e315ba9c811784d).(p7zipPathcxx . . $ P7ZipDecoder#p7zipPath., args);
63
64 bool result = p7zip.waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a).(operationTimeoutMsecscxx . . $ P7ZipDecoder#operationTimeoutMsecs.);
65
66 p7zip.closecxx . . $ QProcess#close(49f6e7a06ebc5aa8).();
67
68 return result;
69 }
70
71 QStringcxx . . $ QString# P7ZipDecodercxx . . $ P7ZipDecoder#::readP7ZipOutputcxx . . $ P7ZipDecoder#readP7ZipOutput(ea5597cae5d7a1b8).(const QStringListcxx . . $ QStringList#& args) const {
72 QProcesscxx . . $ QProcess# p7zipcxx . . $ QProcess#QProcess(749de1b6ae65bddd).;
73 p7zip.startcxx . . $ QProcess#start(5e315ba9c811784d).(p7zipPathcxx . . $ P7ZipDecoder#p7zipPath., args);
74
75 p7zip.waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a).(operationTimeoutMsecscxx . . $ P7ZipDecoder#operationTimeoutMsecs.);
76
77 QStringcxx . . $ QString# stdoutBuffcxx . . $ QString#QString(e1217c004a86c950). = QByteArraycxx . . $ QString#QString(45672f3c6961a244).(p7zip.readAllcxx . . $ QIODevice#readAll(b3c286cec66e09f4).());
78
79 p7zip.closecxx . . $ QProcess#close(49f6e7a06ebc5aa8).();
80
81 return stdoutBuffcxx . . $ QString#QString(e1217c004a86c950).;
82 }