fixed json to jsonc and added two example configs for testing
parent
0cca0384c9
commit
aa6d513ca2
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
// Example application configuration for testing.
|
||||
"application": {
|
||||
"name": "Config Editor Example",
|
||||
"environment": "development"
|
||||
},
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 8080
|
||||
},
|
||||
"features": {
|
||||
"logging": true,
|
||||
"maintenanceMode": false
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<application>
|
||||
<name>Config Editor Example</name>
|
||||
<environment>development</environment>
|
||||
</application>
|
||||
<server>
|
||||
<host>localhost</host>
|
||||
<port>8080</port>
|
||||
</server>
|
||||
<features>
|
||||
<logging>true</logging>
|
||||
<maintenanceMode>false</maintenanceMode>
|
||||
</features>
|
||||
</configuration>
|
||||
|
|
@ -4,7 +4,7 @@ public class config_editor {
|
|||
static java.io.File config_file;
|
||||
|
||||
enum ConfigFileType {
|
||||
JSON,
|
||||
JSONC,
|
||||
XML
|
||||
}
|
||||
|
||||
|
|
@ -29,14 +29,14 @@ public class config_editor {
|
|||
}
|
||||
|
||||
static void config_file_type() {
|
||||
if (config_file_path.endsWith(".json")) {
|
||||
config_file_type = ConfigFileType.JSON;
|
||||
System.out.println("JSON config file detected.");
|
||||
if (config_file_path.endsWith(".jsonc")) {
|
||||
config_file_type = ConfigFileType.JSONC;
|
||||
System.out.println("JSONC config file detected.");
|
||||
} else if (config_file_path.endsWith(".xml")) {
|
||||
config_file_type = ConfigFileType.XML;
|
||||
System.out.println("XML config file detected.");
|
||||
} else {
|
||||
System.err.println("Unsupported config file type. Please provide a .json or .xml file.");
|
||||
System.err.println("Unsupported config file type. Please provide a .jsonc or .xml file.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
public class jsonc_parse {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
public class xml_parse {
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue