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
e37ace91
Commit
e37ace91
authored
Dec 30, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused function
parent
f0fd0b51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
28 deletions
+0
-28
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
.../mirai/qqandroid/network/protocol/packet/PacketFactory.kt
+0
-28
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
View file @
e37ace91
...
...
@@ -3,19 +3,12 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet
import
kotlinx.atomicfu.AtomicInt
import
kotlinx.atomicfu.atomic
import
kotlinx.io.core.ByteReadPacket
import
kotlinx.io.core.discardExact
import
kotlinx.io.core.readBytes
import
kotlinx.serialization.DeserializationStrategy
import
kotlinx.serialization.protobuf.ProtoBuf
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.network.BotNetworkHandler
import
net.mamoe.mirai.qqandroid.network.protocol.packet.login.NullPacketId
import
net.mamoe.mirai.qqandroid.network.protocol.packet.login.PacketId
import
net.mamoe.mirai.utils.cryptor.Decrypter
import
net.mamoe.mirai.utils.cryptor.DecrypterType
import
net.mamoe.mirai.utils.cryptor.readProtoMap
import
net.mamoe.mirai.utils.io.debugPrint
import
net.mamoe.mirai.utils.io.read
/**
* 一种数据包的处理工厂. 它可以解密解码服务器发来的这个包, 也可以编码加密要发送给服务器的这个包
...
...
@@ -40,27 +33,6 @@ abstract class PacketFactory<out TPacket : Packet, TDecrypter : Decrypter>(val d
*/
abstract
suspend
fun
ByteReadPacket
.
decode
(
id
:
PacketId
,
sequenceId
:
UShort
,
handler
:
BotNetworkHandler
):
TPacket
fun
<
T
>
ByteReadPacket
.
decodeProtoPacket
(
deserializer
:
DeserializationStrategy
<
T
>,
debuggingTag
:
String
?
=
null
):
T
{
val
headLength
=
readInt
()
val
protoLength
=
readInt
()
if
(
debuggingTag
!=
null
)
{
readBytes
(
headLength
).
debugPrint
(
"$debuggingTag head"
)
}
else
{
discardExact
(
headLength
)
}
val
bytes
=
readBytes
(
protoLength
)
// println(ByteReadPacket(bytes).readProtoMap())
if
(
debuggingTag
!=
null
)
{
bytes
.
read
{
readProtoMap
()
}.
toString
().
debugPrint
(
"$debuggingTag proto"
)
}
return
ProtoBuf
.
load
(
deserializer
,
bytes
)
}
companion
object
{
private
val
sequenceId
:
AtomicInt
=
atomic
(
1
)
...
...
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