This repository has been archived by the owner on May 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PKGBuilder.h
59 lines (54 loc) · 1.97 KB
/
PKGBuilder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#include <QString>
#include <QByteArray>
#include <QFile>
#include <QDataStream>
#include <QJsonDocument>
#include <QJsonObject>
#include <QCryptographicHash>
#include "rsasignature.h"
#include <QStringList>
#include "version.h"
#include <QDir>
typedef unsigned long RIFF_SIZE;
class PKGBuilder
{
public:
PKGBuilder();
~PKGBuilder();
struct PKGTask
{
int type;
double IMT_Ver;
double version;
QString name;
QByteArray icon;
QString author;
QString about;
QString EULA;
QString wdate;
QString wtime;
QStringList files;
QString root;
};
static void appendChunk(QDataStream stream, char* name, QByteArray data);
static QByteArray BuildChunk(char* name, QByteArray data);
static void appendFile(QByteArray* chunkdata, QByteArray filedata, QString filepos);
static QByteArray BuildInformationChunk(int type, double IMT_Ver, double Ver, QString name, QByteArray icon, QString author, QString about, QString EULA, QString wdate, QString wtime);
static QByteArray SignChunk(QByteArray chunkdata);
static QByteArray BuildPack(QByteArray inforchunk, QByteArray filechunk);
static QString getPosPath(int type, QString filepath, QString rootpath, QString pkgname);
static QByteArray BuildListChunk(int type, QStringList filelist, QString rootpath, QString pkgname);
static QByteArray Pack(PKGTask task);
static bool checkFileList(QStringList filelist);
static QStringList getInforList(QStringList filelist, QString rootpath, int type);
static bool checkSign(QString filename);
static bool checkSignature(QStringList inforfilelist);
static QStringList getInforNameList(QStringList inforfilelist, QString rootpath);
static void prepareTempory(QString TemporyDir);
static void cleanTempory(QString TemporyDir);
static void tempFileChunk(QString TemporyDir, QString FileName, QString FilePos);
static RIFF_SIZE getTempSize(QString TemporyDir);
static void linkTempFile(QDataStream* stream, QString TemporyDir);
static void Pack_D(PKGTask task, QString packfile);
};