bump resource-tools to 0.3.1

This commit is contained in:
A.C.Sukazyo Eyre 2024-08-05 11:59:13 +08:00
parent 597e87f5fe
commit 46519138e1
Signed by: Eyre_S
GPG Key ID: C17CE40291207874
6 changed files with 9 additions and 9 deletions

View File

@ -18,7 +18,7 @@ lib_spotbugs_v = 4.8.4
lib_scalamodule_xml_v = 2.2.0 lib_scalamodule_xml_v = 2.2.0
lib_messiva_v = 0.2.0 lib_messiva_v = 0.2.0
lib_resourcetools_v = 0.2.2 lib_resourcetools_v = 0.3.1
lib_slf4j_v = 2.0.13 lib_slf4j_v = 2.0.13
lib_javatelegramapi_v = 6.9.1 lib_javatelegramapi_v = 6.9.1

View File

@ -5,7 +5,7 @@ import java.io.IOException
object MornyAbout { object MornyAbout {
val MORNY_PREVIEW_IMAGE_ASCII: String = val MORNY_PREVIEW_IMAGE_ASCII: String =
try { MornyAssets.pack getResource "texts/server-hello.txt" readAsString } try { MornyAssets.pack getFile "texts/server-hello.txt" readString }
catch case e: IOException => catch case e: IOException =>
throw RuntimeException("Cannot read MORNY_PREVIEW_IMAGE_ASCII from assets pack", e) throw RuntimeException("Cannot read MORNY_PREVIEW_IMAGE_ASCII from assets pack", e)

View File

@ -1,11 +1,11 @@
package cc.sukazyo.cono.morny package cc.sukazyo.cono.morny
import cc.sukazyo.restools.ResourcesPackage import cc.sukazyo.restools.{ResourceDirectory, ResourcePackage}
object MornyAssets { object MornyAssets {
class AssetsException (caused: Throwable) extends Exception("Cannot read assets file.", caused) class AssetsException (caused: Throwable) extends Exception("Cannot read assets file.", caused)
val pack: ResourcesPackage = ResourcesPackage(MornyAssets.getClass, "assets_morny") val pack: ResourceDirectory = ResourcePackage.get("assets_morny").getDirectory("assets_morny")
} }

View File

@ -22,7 +22,7 @@ object TelegramImages {
@throws[AssetsException] @throws[AssetsException]
private def read (): Unit = { private def read (): Unit = {
Using ((MornyAssets.pack getResource assetsPath)read) { stream => Using (MornyAssets.pack getFile assetsPath read) { stream =>
try { this.cache = Some(stream.readAllBytes()) } try { this.cache = Some(stream.readAllBytes()) }
catch case e: IOException => { catch case e: IOException => {
throw AssetsException(e) throw AssetsException(e)

View File

@ -1,13 +1,13 @@
package cc.sukazyo.cono.morny.test package cc.sukazyo.cono.morny.test
import cc.sukazyo.restools.ResourcesPackage import cc.sukazyo.restools.{ResourceDirectory, ResourcePackage}
import org.scalatest.freespec.AnyFreeSpec import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should import org.scalatest.matchers.should
abstract class MornyTests extends AnyFreeSpec with should.Matchers { abstract class MornyTests extends AnyFreeSpec with should.Matchers {
val assets: ResourcesPackage = val assets: ResourceDirectory =
ResourcesPackage(classOf[MornyTests], "assets_morny_tests") ResourcePackage.get("assets_morny_tests").getDirectory("assets_morny_tests")
val pending_val = "[not-implemented]" val pending_val = "[not-implemented]"

View File

@ -83,7 +83,7 @@ class CommonEncryptTest extends MornyTests with TableDrivenPropertyChecks {
if file == null then if file == null then
Array.empty[Byte] Array.empty[Byte]
else else
assets.getResource(file).read.readAllBytes assets.getFile(file).read.readAllBytes
s"while hashing binary $_name :" - { s"while hashing binary $_name :" - {