Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenFlipper-Free
OpenFlipper-Free
Commits
34de1965
Commit
34de1965
authored
Nov 19, 2015
by
Daniel Gotzen
Browse files
Read/write to ini by using OpenFlipperSettings
parent
746dfe31
Changes
1
Hide whitespace changes
Inline
Side-by-side
OpenFlipper/LicenseManager/LicenseManagerActive.cc
View file @
34de1965
...
...
@@ -84,7 +84,6 @@ License File format:
#include
<QCryptographicHash>
#include
<QNetworkInterface>
#include
<OpenFlipper/BasePlugin/INIInterface.hh>
#include
<limits>
...
...
@@ -136,38 +135,30 @@ void LicenseManager::blockSignals( bool _state) {
bool
LicenseManager
::
timestampOk
()
{
QString
inifile
=
OpenFlipper
::
Options
::
configDirStr
()
+
OpenFlipper
::
Options
::
dirSeparator
()
+
"OpenFlipper.ini"
;
INIFile
ini
;
if
(
!
ini
.
connect
(
inifile
,
true
)
)
{
//emit log(LOGERR,tr("Can not create user ini file"));
return
false
;
}
bool
notExpired
=
false
;
bool
gotTimestampEntry
=
false
;
quint64
timestamp
=
QDateTime
::
currentMSecsSinceEpoch
();
quint64
lastTimestamp
=
timestamp
;
quint64
timestampEntry
=
0
;
QString
lastTimestampEntry
;
std
::
vector
<
QString
>
lastTimestampEntryVec
;
quint64
lastTimestampEntryNum
=
0
;
bool
gotTimestampEntry
=
false
;
// ===============================================================================================
// Read last Timestemp
// ===============================================================================================
if
(
ini
.
get_entry
(
lastTimestampEntryVec
,
"Timestamp"
,
pluginFileName
()
)
){
lastTimestampEntry
=
lastTimestampEntryVec
[
0
];
lastTimestampEntryNum
=
lastTimestampEntry
.
toULongLong
(
&
gotTimestampEntry
,
16
);
}
else
{
QString
title
=
"Timestamp/"
+
pluginFileName
();
QString
lastTimestampEntry
=
OpenFlipperSettings
().
value
(
title
,
"empty"
).
toString
();
if
(
lastTimestampEntry
==
QString
(
"empty"
)){
notExpired
=
true
;
}
else
{
lastTimestampEntryNum
=
lastTimestampEntry
.
toULongLong
(
&
gotTimestampEntry
,
16
);
}
// ===============================================================================================
// Decrypt last Timestamp
// ===============================================================================================
...
...
@@ -212,11 +203,7 @@ bool LicenseManager::timestampOk() {
// Write new Timestemp
// ===============================================================================================
ini
.
add_entry
(
"Timestamp"
,
pluginFileName
(),
QString
::
number
(
timestampEntry
,
16
));
//ini.add_entry("Timestamp","Read", QString::number(lastTimestamp));
//ini.add_entry("Timestamp","Write", QString::number(QDateTime::currentMSecsSinceEpoch()));
ini
.
disconnect
();
OpenFlipperSettings
().
setValue
(
title
,
QString
::
number
(
timestampEntry
,
16
)
);
return
notExpired
;
...
...
Write
Preview
Supports
Markdown
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