Simplify encrypted flag in the Container class

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent 885fa3d0ed
commit 723bd42a8e
  1. 20
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt

@ -33,35 +33,31 @@ public class CacheImporter @Inject constructor(
private val alloc: ByteBufAllocator private val alloc: ByteBufAllocator
) { ) {
public abstract class Container( public abstract class Container(
data: ByteBuf data: ByteBuf,
public val encrypted: Boolean
) : DefaultByteBufHolder(data) { ) : DefaultByteBufHolder(data) {
public val bytes: ByteArray = ByteBufUtil.getBytes(data, data.readerIndex(), data.readableBytes(), false) public val bytes: ByteArray = ByteBufUtil.getBytes(data, data.readerIndex(), data.readableBytes(), false)
public val crc32: Int = data.crc32() public val crc32: Int = data.crc32()
public val whirlpool: ByteArray = Whirlpool.whirlpool(bytes) public val whirlpool: ByteArray = Whirlpool.whirlpool(bytes)
public abstract val encrypted: Boolean
} }
private class MasterIndex( private class MasterIndex(
val index: Js5MasterIndex, val index: Js5MasterIndex,
data: ByteBuf data: ByteBuf,
) : Container(data) { ) : Container(data, false)
override val encrypted: Boolean = false
}
public class Index( public class Index(
public val index: Js5Index, public val index: Js5Index,
data: ByteBuf data: ByteBuf,
) : Container(data) { ) : Container(data, false)
override val encrypted: Boolean = false
}
public class Group( public class Group(
public val archive: Int, public val archive: Int,
public val group: Int, public val group: Int,
data: ByteBuf, data: ByteBuf,
public val version: Int, public val version: Int,
override val encrypted: Boolean encrypted: Boolean
) : Container(data) ) : Container(data, encrypted)
public suspend fun import(store: Store, game: String, build: Int?, timestamp: Instant?) { public suspend fun import(store: Store, game: String, build: Int?, timestamp: Instant?) {
database.execute { connection -> database.execute { connection ->

Loading…
Cancel
Save