mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-15 04:50:11 +08:00
Generator for directory
This commit is contained in:
parent
dc9551abbf
commit
efb662a978
@ -3,19 +3,23 @@ package test;
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
fun main(){
|
fun main(){
|
||||||
val var9 = toJCEInfo(
|
|
||||||
File(
|
|
||||||
"""
|
|
||||||
E:\Projects\QQAndroidFF\app\src\main\java\PushNotifyPack\RequestPushForceOffline.java
|
|
||||||
""".trimIndent()
|
|
||||||
).readText()
|
|
||||||
)
|
|
||||||
println(
|
println(
|
||||||
"import kotlinx.serialization.SerialId\n" +
|
"import kotlinx.serialization.SerialId\n" +
|
||||||
"import kotlinx.serialization.Serializable\n" +
|
"import kotlinx.serialization.Serializable\n" +
|
||||||
"import net.mamoe.mirai.qqandroid.io.JceStruct\n"
|
"import net.mamoe.mirai.qqandroid.io.JceStruct\n"
|
||||||
)
|
)
|
||||||
println(var9.toString())
|
File(
|
||||||
|
"""
|
||||||
|
E:\Projects\QQAndroidFF\app\src\main\java\friendlist\
|
||||||
|
""".trimIndent()
|
||||||
|
).listFiles()!!.forEach {
|
||||||
|
try {
|
||||||
|
println(toJCEInfo(it.readText()).toString())
|
||||||
|
} catch (e: Exception) {
|
||||||
|
println("when processing ${it.path}")
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +95,7 @@ class Property(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun toStringWithSpacing(maxIDLength:Int): String {
|
fun toStringWithSpacing(maxIDLength:Int): String {
|
||||||
val space = " ".repeat(maxIDLength - (jceID.toString().length))
|
val space = " ".repeat((maxIDLength - (jceID.toString().length)).coerceAtLeast(0))
|
||||||
var base = " @SerialId(" + jceID + ") " + space + "val " + name + ":" + type + ""
|
var base = " @SerialId(" + jceID + ") " + space + "val " + name + ":" + type + ""
|
||||||
if(!isRequired){
|
if(!isRequired){
|
||||||
if(defaultValue == null) {
|
if(defaultValue == null) {
|
||||||
@ -114,7 +118,7 @@ fun toJCEInfo(source:String):JCEInfo{
|
|||||||
val info = JCEInfo()
|
val info = JCEInfo()
|
||||||
val allProperties = mutableMapOf<String,Property>()
|
val allProperties = mutableMapOf<String,Property>()
|
||||||
var inputStreamVariableRegix:String? = null
|
var inputStreamVariableRegix:String? = null
|
||||||
println(source)
|
// println(source)
|
||||||
source.split("\n").forEach{
|
source.split("\n").forEach{
|
||||||
when{
|
when{
|
||||||
it.contains("class") -> {
|
it.contains("class") -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user