mirror of
https://github.com/InsanusMokrassar/SDI.git
synced 2024-12-28 03:27:23 +00:00
now it is possible to use custon Json to load Module
This commit is contained in:
parent
2748c3f861
commit
b3966beb32
@ -4,4 +4,7 @@ import kotlinx.serialization.ImplicitReflectionSerializer
|
|||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
@ImplicitReflectionSerializer
|
@ImplicitReflectionSerializer
|
||||||
fun loadModule(json: String): Module = Json.nonstrict.parse(ModuleDeserializerStrategy, json)
|
fun Json.loadModule(json: String): Module = parse(ModuleDeserializerStrategy, json)
|
||||||
|
|
||||||
|
@ImplicitReflectionSerializer
|
||||||
|
fun loadModule(json: String): Module = Json.nonstrict.loadModule(json)
|
||||||
|
@ -2,10 +2,17 @@ package com.insanusmokrassar.sdi
|
|||||||
|
|
||||||
import kotlinx.io.InputStream
|
import kotlinx.io.InputStream
|
||||||
import kotlinx.serialization.ImplicitReflectionSerializer
|
import kotlinx.serialization.ImplicitReflectionSerializer
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@ImplicitReflectionSerializer
|
@ImplicitReflectionSerializer
|
||||||
fun loadModule(stream: InputStream) = loadModule(stream.reader().readText())
|
fun Json.loadModule(stream: InputStream) = loadModule(stream.reader().readText())
|
||||||
|
|
||||||
@ImplicitReflectionSerializer
|
@ImplicitReflectionSerializer
|
||||||
fun loadModule(file: File) = loadModule(file.inputStream())
|
fun loadModule(stream: InputStream) = Json.nonstrict.loadModule(stream.reader().readText())
|
||||||
|
|
||||||
|
@ImplicitReflectionSerializer
|
||||||
|
fun Json.loadModule(file: File) = loadModule(file.inputStream())
|
||||||
|
|
||||||
|
@ImplicitReflectionSerializer
|
||||||
|
fun loadModule(file: File) = Json.nonstrict.loadModule(file.inputStream())
|
||||||
|
Loading…
Reference in New Issue
Block a user