//initializing the editor
private void init() throws Exception {
        loadDB();//deserialize the database
        outer:
        while (true) {
            //show options
            System.out.println("Main menu:");
            System.out.println("1:Start Parsing\n2:Start Browsing\n3:Start Configuration System\n4:Export Current Database\n5:Import a database\n6:Exit");
            switch (Integer.parseInt(br.readLine())) {
                case 1://start the parser
                    BufferedReader br2 = new BufferedReader(new FileReader(FILES[2]));
                    String s = br2.readLine();
                    while (s != null) {
                        ar.add(s);//read the options in the parser configuration file
                        s = br2.readLine();
                    }
                    Codes.fixInput(ar);//same as before
                    Parser p = new Parser(db, ar.toArray(new String[ar.size()]), status);//initializing the database parser
                    p.parse();//handing control to the parser
                    break;
                case 2://start the editor
                    Editor e = new Editor(db, auto_entry);//initializing the editor
                    e.browse();
                    break;//the editor is capable of returning to the main menu
                case 3://configure everything again?
                    ConfigCLI.init();//configuration system is self-initialising, just hand over control to it
                    break outer;//that's all, after configuration, the program needs to be restarted anyway
                case 4://export the current database to a Database_Exported.csv file,which opens in MS Excel
                    new ExportImport().exporter(db, auto_entry);//initializing the export system and handing over control to it!
                    break;//we can come back to the main menu
                case 5://import an existing exported database(using this program on a different computer?)
                    new ExportImport().importer(db, auto_entry);//now it's the import system
                    break;//same as case 4
                case 6://No!!! Don't leave me behind!(Can't do anything about it anyway, can I?)
                    System.out.println("Exiting...");
                    System.exit(0);//Bye-Bye
                default://Stop making mistakes in input!
                    //I'm very considerate, I give everybody infinite chances
            }
        }
    }
break;
case 2://start the editor
Editor e = new Editor(db, auto_entry);//initializing the editor
e.browse();
break;//the editor is capable of returning to the main menu
String s = br2.readLine();
while (s != null) {
ar.add(s);//read the options in the parser configuration file
s = br2.readLine();
}
Codes.fixInput(ar);//same as before
Parser p = new Parser(db, ar.toArray(new String[ar.size()]), status);//initializing the database parser
p.parse();//handing control to the parser
break;
case 2://start the editor
Editor e = new Editor(db, auto_entry);//initializing the editor
e.browse();
break;//the editor is capable of returning to the main menu
case 3://configure everything again?
ConfigCLI.init();//configuration system is self-initialising, just hand over control to it
break outer;//that's all, after configuration, the program needs to be restarted anyway
case 4://export the current database to a Database_Exported.csv file,which opens in MS Excel
new ExportImport().exporter(db, auto_entry);//initializing the export system and handing over control to it!
break;//we can come back to the main menu
case 5://import an existing exported database(using this program on a different computer?)
new ExportImport().importer(db, auto_entry);//now it's the import system
private void init() throws Exception {
loadDB();//deserialize the database
outer:
while (true) {
//show options
System.out.println("Main menu:");
System.out.println("1:Start Parsing\n2:Start Browsing\n3:Start Configuration System\n4:Export Current Database\n5:Import a database\n6:Exit");
switch (Integer.parseInt(br.readLine())) {
case 1://start the parser
BufferedReader br2 = new BufferedReader(new FileReader(FILES[2]));
String s = br2.readLine();
while (s != null) {
ar.add(s);//read the options in the parser configuration file
s = br2.readLine();
}
Codes.fixInput(ar);//same as before
Parser p = new Parser(db, ar.toArray(new String[ar.size()]), status);//initializing the database parser
p.parse();//handing control to the parser
break;
case 2://start the editor
Editor e = new Editor(db, auto_entry);//initializing the editor
e.browse();
break;//the editor is capable of returning to the main menu
case 3://configure everything again?
ConfigCLI.init();//configuration system is self-initialising, just hand over control to it
break outer;//that's all, after configuration, the program needs to be restarted anyway
case 4://export the current database to a Database_Exported.csv file,which opens in MS Excel
new ExportImport().exporter(db, auto_entry);//initializing the export system and handing over control to it!
break;//we can come back to the main menu
case 5://import an existing exported database(using this program on a different computer?)
new ExportImport().importer(db, auto_entry);//now it's the import system
break;//same as case 4
case 6://No!!! Don't leave me behind!(Can't do anything about it anyway, can I?)
System.out.println("Exiting...");
System.exit(0);//Bye-Bye
default://Stop making mistakes in input!
//I'm very considerate, I give everybody infinite chances
}
}
}