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
731a9fde
Commit
731a9fde
authored
Feb 13, 2020
by
Him188
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
227a22d3
17af6861
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
+7
-11
mirai-console/src/main/kotlin/net/mamoe/mirai/plugin/ConfigSection.kt
...e/src/main/kotlin/net/mamoe/mirai/plugin/ConfigSection.kt
+7
-11
No files found.
mirai-console/src/main/kotlin/net/mamoe/mirai/plugin/ConfigSection.kt
View file @
731a9fde
...
...
@@ -214,9 +214,9 @@ open class ConfigSectionImpl() : ConcurrentHashMap<String, Any>(), ConfigSection
interface
FileConfig
:
Config
{
fun
deserialize
(
content
:
String
):
ConfigSection
Impl
fun
deserialize
(
content
:
String
):
ConfigSection
fun
serialize
(
config
:
ConfigSection
Impl
):
String
fun
serialize
(
config
:
ConfigSection
):
String
}
...
...
@@ -244,31 +244,27 @@ abstract class FileConfigImpl internal constructor(
}
override
fun
asMap
():
Map
<
String
,
Any
>
{
return
content
return
content
.
asMap
()
}
}
class
JsonConfig
internal
constructor
(
file
:
File
)
:
FileConfigImpl
(
file
)
{
@UnstableDefault
override
fun
deserialize
(
content
:
String
):
ConfigSection
Impl
{
override
fun
deserialize
(
content
:
String
):
ConfigSection
{
if
(
content
.
isEmpty
()
||
content
.
isBlank
()
||
content
==
"{}"
)
{
return
ConfigSectionImpl
()
}
val
section
=
ConfigSectionImpl
()
val
map
:
LinkedHashMap
<
String
,
Any
>
=
JSON
.
parseObject
(
val
section
=
JSON
.
parseObject
(
content
,
object
:
TypeReference
<
LinkedHashMap
<
String
,
Any
>
>()
{},
object
:
TypeReference
<
ConfigSectionImpl
>()
{},
Feature
.
OrderedField
)
map
.
forEach
{
(
t
,
u
)
->
section
[
t
]
=
u
}
return
section
}
@UnstableDefault
override
fun
serialize
(
config
:
ConfigSection
Impl
):
String
{
override
fun
serialize
(
config
:
ConfigSection
):
String
{
return
JSONObject
.
toJSONString
(
config
)
}
...
...
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