mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-05 07:30:09 +08:00
Unified Image suffix: .mirai
This commit is contained in:
parent
5ad5c17a60
commit
437f9db575
@ -91,7 +91,7 @@ internal class FriendImpl(
|
||||
fileId = 0,
|
||||
fileMd5 = image.md5,
|
||||
fileSize = image.inputSize.toInt(),
|
||||
fileName = image.md5.toUHexString("") + ".gif",
|
||||
fileName = image.md5.toUHexString("") + "." + ExternalImage.defaultFormatName,
|
||||
imgOriginal = 1
|
||||
)
|
||||
).sendAndExpect<LongConn.OffPicUp.Response>()
|
||||
|
@ -67,12 +67,15 @@ class ExternalImage private constructor(
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val defaultFormatName = "mirai"
|
||||
|
||||
|
||||
fun generateUUID(md5: ByteArray): String {
|
||||
return "${md5[0, 3]}-${md5[4, 5]}-${md5[6, 7]}-${md5[8, 9]}-${md5[10, 15]}"
|
||||
}
|
||||
|
||||
fun generateImageId(md5: ByteArray): String {
|
||||
return """{${generateUUID(md5)}}.gif"""
|
||||
return """{${generateUUID(md5)}}.$defaultFormatName"""
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,9 +93,7 @@ class ExternalImage private constructor(
|
||||
|
||||
override fun toString(): String = "[ExternalImage(${generateUUID(md5)})]"
|
||||
|
||||
fun calculateImageResourceId(): String {
|
||||
return "{${generateUUID(md5)}}.gif"
|
||||
}
|
||||
fun calculateImageResourceId(): String = generateImageId(md5)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user