-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmdb.cpp
57 lines (45 loc) · 902 Bytes
/
mdb.cpp
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
#include "mdb.h"
#include <QFile>
#include <QMessageBox>
#include <QDebug>
MDB::MDB(QObject *parent) :
QObject(parent)
{
}
QByteArray MDB::getKey(const QString fn)
{
filename = fn;
if(mdbOpen())
{
return mdbParse();
}
}
QByteArray MDB::mdbParse()
{
QByteArray result;
char buf;
file.seek(qint64(8));
for (int j = 0; j < 0x10; j++)
{
file.getChar(&buf);
result[(j & 0x0c) + (3 - (j & 0x03))] = buf;
}
return result;
}
bool MDB::mdbOpen()
{
file.setFileName(filename);
if (file.bytesAvailable() > 0)
{
file.open(QIODevice::ReadOnly);
return true;
}else{
this->errorHandling("cannot open " + filename);
}
return false;
}
void MDB::errorHandling(const QString error)
{
qDebug() << error;
//QMessageBox::warning(QWidget *MainWindow,tr("Fehler"),tr("%1").arg(error));
}