Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
8c4855a1
Commit
8c4855a1
authored
Jul 31, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build
parent
1d07650d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
15 deletions
+16
-15
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt
.../commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt
+9
-8
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/DeferredReusableInput.jvm.kt
...t/mamoe/mirai/utils/internal/DeferredReusableInput.jvm.kt
+1
-1
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/asReusableInput.jvm.kt
...lin/net/mamoe/mirai/utils/internal/asReusableInput.jvm.kt
+6
-6
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt
View file @
8c4855a1
...
@@ -11,12 +11,15 @@
...
@@ -11,12 +11,15 @@
package
net.mamoe.mirai.utils
package
net.mamoe.mirai.utils
import
kotlinx.io.core.readBytes
import
kotlinx.io.core.use
import
net.mamoe.mirai.contact.Contact
import
net.mamoe.mirai.contact.Contact
import
net.mamoe.mirai.contact.Group
import
net.mamoe.mirai.contact.Group
import
net.mamoe.mirai.contact.User
import
net.mamoe.mirai.contact.User
import
net.mamoe.mirai.message.MessageReceipt
import
net.mamoe.mirai.message.MessageReceipt
import
net.mamoe.mirai.message.data.Image
import
net.mamoe.mirai.message.data.Image
import
net.mamoe.mirai.message.data.sendTo
import
net.mamoe.mirai.message.data.sendTo
import
net.mamoe.mirai.message.data.toUHexString
import
net.mamoe.mirai.utils.internal.DeferredReusableInput
import
net.mamoe.mirai.utils.internal.DeferredReusableInput
import
net.mamoe.mirai.utils.internal.ReusableInput
import
net.mamoe.mirai.utils.internal.ReusableInput
import
kotlin.jvm.JvmSynthetic
import
kotlin.jvm.JvmSynthetic
...
@@ -30,16 +33,14 @@ import kotlin.jvm.JvmSynthetic
...
@@ -30,16 +33,14 @@ import kotlin.jvm.JvmSynthetic
* @See ExternalImage.upload 上传图片并得到 [Image] 消息
* @See ExternalImage.upload 上传图片并得到 [Image] 消息
*/
*/
public
class
ExternalImage
internal
constructor
(
public
class
ExternalImage
internal
constructor
(
override
val
input
:
ReusableInput
internal
val
input
:
ReusableInput
)
:
ExternalFile
{
)
{
public
override
val
formatName
:
String
by
lazy
{
internal
val
md5
:
ByteArray
get
()
=
input
.
md5
TODO
()
public
val
formatName
:
String
by
lazy
{
/*
val
hex
=
input
.
asInput
().
use
{
val
hex
=
input
.
asInput
().
use
{
//it.asInput().readBytes(8).toUHexString("")
it
.
readBytes
(
8
).
toUHexString
(
""
)
TODO()
}
}
return@lazy hex.detectFormatName()
as String*/
return
@
lazy
hex
.
detectFormatName
()
}
}
init
{
init
{
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/DeferredReusableInput.jvm.kt
View file @
8c4855a1
...
@@ -45,7 +45,7 @@ internal actual class DeferredReusableInput actual constructor(
...
@@ -45,7 +45,7 @@ internal actual class DeferredReusableInput actual constructor(
return
delegate
?.
writeTo
(
out
)
?:
error
(
"DeferredReusableInput not yet initialized"
)
return
delegate
?.
writeTo
(
out
)
?:
error
(
"DeferredReusableInput not yet initialized"
)
}
}
override
fun
asInput
():
Input
Stream
{
override
fun
asInput
():
Input
{
return
delegate
?.
asInput
()
?:
error
(
"DeferredReusableInput not yet initialized"
)
return
delegate
?.
asInput
()
?:
error
(
"DeferredReusableInput not yet initialized"
)
}
}
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/asReusableInput.jvm.kt
View file @
8c4855a1
...
@@ -37,8 +37,8 @@ internal actual fun ByteArray.asReusableInput(): ReusableInput {
...
@@ -37,8 +37,8 @@ internal actual fun ByteArray.asReusableInput(): ReusableInput {
return
this
@
asReusableInput
.
size
.
toLongUnsigned
()
return
this
@
asReusableInput
.
size
.
toLongUnsigned
()
}
}
override
fun
asInput
():
Input
Stream
{
override
fun
asInput
():
Input
{
return
ByteArrayInputStream
(
this
@
asReusableInput
)
return
ByteArrayInputStream
(
this
@
asReusableInput
)
.
asInput
()
}
}
}
}
}
}
...
@@ -63,8 +63,8 @@ internal fun File.asReusableInput(deleteOnClose: Boolean): ReusableInput {
...
@@ -63,8 +63,8 @@ internal fun File.asReusableInput(deleteOnClose: Boolean): ReusableInput {
return
inputStream
().
use
{
it
.
copyTo
(
out
)
}
return
inputStream
().
use
{
it
.
copyTo
(
out
)
}
}
}
override
fun
asInput
():
Input
Stream
{
override
fun
asInput
():
Input
{
return
inputStream
()
return
inputStream
()
.
asInput
()
}
}
}
}
}
}
...
@@ -89,8 +89,8 @@ internal fun File.asReusableInput(deleteOnClose: Boolean, md5: ByteArray): Reusa
...
@@ -89,8 +89,8 @@ internal fun File.asReusableInput(deleteOnClose: Boolean, md5: ByteArray): Reusa
return
inputStream
().
use
{
it
.
copyTo
(
out
)
}
return
inputStream
().
use
{
it
.
copyTo
(
out
)
}
}
}
override
fun
asInput
():
Input
Stream
{
override
fun
asInput
():
Input
{
return
inputStream
()
return
inputStream
()
.
asInput
()
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment