/* Parses a command from the console to the system */ public void parseCommand(String command) { if (command.startsWith("/")) { String comm = command.toLowerCase().replaceFirst("/", ""); Notes.console.clearInput(); if (comm.startsWith("exit")) { Notes.console.clearInput(); Notes.console.dPrint(SystemConsole.Types.SYSTEM, "Notes now exiting!"); Notes.exit(); } else if (comm.startsWith("plugins")) { Notes.console.dPrint("Current Plugins loaded: "); File dir = new File("plugs/"); String[] plugins = dir.list(); for (int i = 0; i < plugins.length; i++) { Notes.console.dPrint(plugins[i]); } } else if (comm.startsWith("dumplog")) { dumpToLog(); } else if (comm.startsWith("dummy")) { dummyCommand(command.substring(7)); } else if (comm.startsWith("date")) { String date = String.format("%tc", new Date(System.currentTimeMillis())); Notes.console.dPrint("The date is " + date); } else if (comm.startsWith("sysinfo")) { Notes.console.dPrint( "Max Memory JVM will use(MB): " + meminf.maxMem / OSMemoryInfo.MEGABYTE); Notes.console.dPrint( "Total Memory JVM can use(MB): " + meminf.totalMem / OSMemoryInfo.MEGABYTE); Notes.console.dPrint("# CPU cores in system: " + meminf.cpus); Notes.console.dPrint( "Amount of free memory(MB): " + meminf.freeMem / OSMemoryInfo.MEGABYTE); } else if (comm.startsWith("forceupdate")) { Notes.console.dPrint(SystemConsole.Types.SYSTEM, "Forcing update..."); String[] run = {"java", "-jar", "update.jar"}; try { Runtime.getRuntime().exec(run); System.out.println("TO THE UPDATER!"); } catch (Exception ex) { ex.printStackTrace(); Watchdog.quitWithException(-2); } System.exit(0); } else if (comm.startsWith("verinfo")) { Notes.console.dPrint("Notes by WareHouse Software"); Notes.console.dPrint("Currently Running " + Notes.getVersion()); Notes.console.dPrint( "Note that this is Beta Software! It does not represent the final or finished product!"); } else if (comm.startsWith("crash")) { crash(Integer.parseInt(command.substring(7))); } else if (comm.startsWith("restart")) { String[] run = {"java", "-jar", "Notes.jar"}; try { Notes.console.dPrint(Types.WARNING, "RESTARTING NOTES..."); Runtime.getRuntime().exec(run); } catch (Exception ex) { ex.printStackTrace(); } System.exit(0); } else if (comm.startsWith("switchlang")) { switchLang(command.substring(12)); } else if (comm.startsWith("createtab")) { NotesFrame.tabs.createNewTextTab(); } else if (comm.startsWith("changethemewin")) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { ex.printStackTrace(); } } else if (comm.startsWith("changethemejava")) { try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception ex) { ex.printStackTrace(); } } else if (comm.startsWith("rungc")) { System.gc(); Notes.console.dPrint(Types.SYSTEM, "Garbage Collection Run!"); } else if (comm.startsWith("clear")) { Notes.console.cls(); } else if (comm.startsWith("icarus")) { if (!sp.isActive()) { Notes.console.dPrint(Types.SYSTEM, "Icarus Lives..."); playIcarus(); } else { Notes.console.dPrint(Types.WARNING, "Icarus already lives!"); } } else if (comm.startsWith("stop")) { sp.stop(); Notes.console.console.setFont(new Font("Courier New", 12, 12)); } else if (comm.startsWith("mad")) { if (!sp.isActive()) { Notes.console.dPrint(Types.SYSTEM, "That's Totla Mad!"); playTotla(); } else { Notes.console.dPrint(Types.WARNING, "Already Mad!"); } } else if (comm.startsWith("ponponpon")) { if (!sp.isActive()) { Notes.console.console.setFont(new Font("Bitstream Cyberbit", Font.PLAIN, 12)); Notes.console.dPrint(Types.SYSTEM, "ねえ!あなたはにほんじんですか? PONPONPON"); ponPon(); } else { Notes.console.dPrint(Types.WARNING, "ALready Pon'ing!"); } } else if (debugMode) { if (comm.startsWith("debugcpu")) { // Hangs main program execution... cpu.run(); } else if (comm.startsWith("verinfo")) { Notes.console.dPrint("Notes by WareHouse Software"); Notes.console.dPrint("Currently Version " + Notes.getVersion()); Notes.console.dPrint( "Note that this is Beta Software! It does not represent the final product!"); } if (comm.startsWith("rungc")) { System.gc(); Notes.console.dPrint(Types.SYSTEM, "Garbage Collection Run!"); } } else { System.out.println("Invalid Command: " + command); } } else { Notes.console.dPrint("Invalid command: " + command); Notes.console.clearInput(); } }
private void playTotla() { File tMad = new File("mad.wav"); NotesFrame.textArea.append("TOTLA MAD BRO"); sp.play(tMad); }
private void ponPon() { File pon = new File("pon.wav"); NotesFrame.textArea.append("PON PON PON!!"); sp.play(pon); }
private void playIcarus() { File icarus = new File("icarus.wav"); NotesFrame.textArea.append("Icarus Lives...\n"); sp.play(icarus); }