package main; import java.io.IOException; import java.io.OptionalDataException; import big7.big7Entity; import big7.cmdStr; import big7.command; import big7.msgStr; public class main { private static command com1; private static Ctrl ctrl; private static String noR ="big7引擎未响应"; static big7Entity myBig7Entity; /** * @param args * @throws IOException * @throws ClassNotFoundException * @throws OptionalDataException */ public static void main(String[] args) throws OptionalDataException, ClassNotFoundException, IOException { // TODO Auto-generated method stub com1 = new command(); big7Entity a = com1.run(cmdStr.start); //big7Entity b = a.deepClone(); ctrl = new Ctrl(); ctrl.Show(); Form form1 = new Form(); form1.show(); ctrl.CoreSay(a.msgString); if(a.msgString.startsWith(msgStr.status_success)) { form1.Refesh(a.xyZone,a.maxX,a.maxY); } } /* 选中 */ public static boolean select(int x,int y) { //拼接命令 String commandStr = cmdStr.select+"("+x+","+y+")"; //命令执行 return commandToBig7(commandStr); } /* 消除 */ public static boolean delete(int x,int y,int x2,int y2) { if(x==x2&& y==y2) return delete(x,y); //拼接命令 String commandStr = cmdStr.delete+"("+x+","+y + ","+x2+","+y2+")"; //命令执行 return commandToBig7(commandStr); } public static boolean delete(int x,int y) { //拼接命令 String commandStr = cmdStr.delete;//+"("+x+","+y+")"; //命令执行 return commandToBig7(commandStr); } /* 移动 */ public static boolean move(int x,int y) { //拼接命令 String commandStr = cmdStr.move+"("; // 左右 if(x>0) { //右 if(y>0) { commandStr += msgStr.ifo_004; } //左 else{ commandStr += msgStr.ifo_003; } } // 上下 else{ //下 if(y>0) { commandStr += msgStr.ifo_002; } //上 else{ commandStr += msgStr.ifo_001; } } commandStr += ","+Math.abs(y)+")"; //命令执行 return commandToBig7(commandStr); } /* 命令执行 */ public static boolean commandToBig7(String commandStr) { //控制台出力 ctrl.ShellSay(commandStr); try { //执行命令 myBig7Entity = com1.run(commandStr); ctrl.CoreSay(myBig7Entity.msgString); //控制台出力 return myBig7Entity.msgString.startsWith(msgStr.status_success)||myBig7Entity.msgString.startsWith(msgStr.status_warning); } catch (Throwable e) { // TODO Auto-generated catch block ctrl.ShellSay(noR); return false; } } }