diff --git a/src/config_editor.java b/src/config_editor.java new file mode 100644 index 0000000..bab7a9b --- /dev/null +++ b/src/config_editor.java @@ -0,0 +1,43 @@ +public class config_editor { + public static String config_file_path; + public static Enum config_file_type; + static java.io.File config_file; + + enum ConfigFileType { + JSON, + XML + } + + public static void main(String[] args) { + config_file_path = args[0]; + verify_config_file(); + config_file_type(); + } + + static void verify_config_file() { + if (config_file_path == null || config_file_path.isEmpty()) { + System.err.println("Config file path is not provided."); + return; + } + + config_file = new java.io.File(config_file_path); + + if (!config_file.exists()) { + System.err.println("Config file does not exist: " + config_file_path); + return; + } + } + + static void config_file_type() { + if (config_file_path.endsWith(".json")) { + config_file_type = ConfigFileType.JSON; + System.out.println("JSON 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."); + } + } + +} \ No newline at end of file diff --git a/src/json_parse.java b/src/json_parse.java new file mode 100644 index 0000000..e69de29