From 723bd42a8eed2804f93e76de388553db1b260510 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 31 Jan 2021 20:18:57 +0000 Subject: [PATCH] Simplify encrypted flag in the Container class Signed-off-by: Graham --- .../openrs2/archive/cache/CacheImporter.kt | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt b/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt index 58c184a3..39c2894a 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt @@ -33,35 +33,31 @@ public class CacheImporter @Inject constructor( private val alloc: ByteBufAllocator ) { public abstract class Container( - data: ByteBuf + data: ByteBuf, + public val encrypted: Boolean ) : DefaultByteBufHolder(data) { public val bytes: ByteArray = ByteBufUtil.getBytes(data, data.readerIndex(), data.readableBytes(), false) public val crc32: Int = data.crc32() public val whirlpool: ByteArray = Whirlpool.whirlpool(bytes) - public abstract val encrypted: Boolean } private class MasterIndex( val index: Js5MasterIndex, - data: ByteBuf - ) : Container(data) { - override val encrypted: Boolean = false - } + data: ByteBuf, + ) : Container(data, false) public class Index( public val index: Js5Index, - data: ByteBuf - ) : Container(data) { - override val encrypted: Boolean = false - } + data: ByteBuf, + ) : Container(data, false) public class Group( public val archive: Int, public val group: Int, data: ByteBuf, public val version: Int, - override val encrypted: Boolean - ) : Container(data) + encrypted: Boolean + ) : Container(data, encrypted) public suspend fun import(store: Store, game: String, build: Int?, timestamp: Instant?) { database.execute { connection ->