mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-24 02:51:34 -08:00
Binary files as time
This commit is contained in:
1 parent
efe30b598b
commit
dc3d720e8d
3 files changed
+11
-9
No files matched your search
@@ -29,8 +29,11 @@ class BinaryPool {
|
||||
return pool[key]
|
||||
}
|
||||
|
||||
fun put(key: Int, value: BinaryAttachment) {
|
||||
pool[key] = value
|
||||
fun put(key: Int?, value: BinaryAttachment) {
|
||||
if (key == null)
|
||||
put(value)
|
||||
else
|
||||
pool[key] = value
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -542,13 +542,12 @@ class DatabaseKDBX : DatabaseVersioned<UUID, UUID, GroupKDBX, EntryKDBX> {
|
||||
fun buildNewBinary(cacheDirectory: File,
|
||||
protection: Boolean,
|
||||
compression: Boolean,
|
||||
cacheId: String? = null): BinaryAttachment {
|
||||
// Unused cache key if needed
|
||||
val binaryId = cacheId ?: binaryPool.findUnusedKey().toString()
|
||||
val fileInCache = File(cacheDirectory, binaryId)
|
||||
binaryPoolId: Int? = null): BinaryAttachment {
|
||||
// New file with current time
|
||||
val fileInCache = File(cacheDirectory, System.currentTimeMillis().toString())
|
||||
val binaryAttachment = BinaryAttachment(fileInCache, protection, compression)
|
||||
// add attachment to pool
|
||||
binaryPool.put(binaryId.toInt(), binaryAttachment)
|
||||
binaryPool.put(binaryPoolId, binaryAttachment)
|
||||
return binaryAttachment
|
||||
}
|
||||
|
||||
|
||||
@@ -948,7 +948,7 @@ class DatabaseInputKDBX(cacheDirectory: File,
|
||||
|
||||
val key = xpp.getAttributeValue(null, DatabaseKDBXXML.AttrId)
|
||||
return if (key != null) {
|
||||
createBinary(key, xpp)
|
||||
createBinary(key.toIntOrNull(), xpp)
|
||||
}
|
||||
|
||||
// New binary to retrieve
|
||||
@@ -958,7 +958,7 @@ class DatabaseInputKDBX(cacheDirectory: File,
|
||||
}
|
||||
|
||||
@Throws(IOException::class, XmlPullParserException::class)
|
||||
private fun createBinary(binaryId: String?, xpp: XmlPullParser): BinaryAttachment? {
|
||||
private fun createBinary(binaryId: Int?, xpp: XmlPullParser): BinaryAttachment? {
|
||||
var compressed = false
|
||||
var protected = false
|
||||
|
||||
|
||||
Reference in new issue
Block a user