Exemple #1
0
        public string execute(CommandInterpreter commandInterpreter, string[] array)
        {
            StringBuilder stringBuilder = new StringBuilder(80);

            for (int i = 1; i < array.Length; i++)
            {
                stringBuilder.append(array[i]);
                stringBuilder.append(' ');
            }
            this.this_0.putResponse(stringBuilder.toString());
            return("");
        }
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     if (array.Length == 2)
     {
         if (!this.this_0.load(array[1]))
         {
             this.this_0.putResponse(new StringBuilder().append("load: trouble loading ").append(array[1]).toString());
         }
     }
     else
     {
         this.this_0.putResponse("Usage: load filename");
     }
     return("");
 }
Exemple #3
0
        public string execute(CommandInterpreter commandInterpreter, string[] array)
        {
            StringBuilder stringBuilder = new StringBuilder();

            for (int i = 1; i < array.Length; i++)
            {
                stringBuilder.append(array[i]).append(' ');
            }
            commandInterpreter.putResponse(this.val_sci.sendCommandGetResponse(stringBuilder.toString()));
            while (this.val_sci.isResponse())
            {
                commandInterpreter.putResponse(this.val_sci.getResponse());
            }
            return("");
        }
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     if (array.Length > 1)
     {
         string[] args = (string[])Arrays.copyOfRange(array, 1, array.Length);
         long     num  = java.lang.System.currentTimeMillis();
         this.this_0.putResponse(this.this_0.execute(args));
         long num2 = java.lang.System.currentTimeMillis();
         this.this_0.putResponse(new StringBuilder().append("Time: ").append((double)(num2 - num) / 1000.0).append(" seconds").toString());
     }
     else
     {
         this.this_0.putResponse("Usage: time cmd [args]");
     }
     return("");
 }
        public static void main(string[] args)
        {
            CommandInterpreter commandInterpreter = new CommandInterpreter();

            try
            {
                [email protected]("Welcome to the Command interpreter test program");
                commandInterpreter.setPrompt("CI> ");
                commandInterpreter.run();
                [email protected]("Goodbye!");
            }
            catch (System.Exception ex)
            {
                [email protected](ex);
            }
        }
 private void spawnCommandInterpreter(Socket socket)
 {
     try
     {
         BufferedReader     @in  = new BufferedReader(new InputStreamReader(socket.getInputStream()));
         PrintWriter        @out = new PrintWriter(socket.getOutputStream(), true);
         CommandInterpreter commandInterpreter = new CommandInterpreter(@in, @out);
         commandInterpreter.setSocket(socket);
         commandInterpreter.add(this.commandList);
         commandInterpreter.setTrace(this.trace);
         commandInterpreter.start();
     }
     catch (IOException ex)
     {
         java.lang.System.err.println(new StringBuilder().append("Could not attach CI to socket ").append(ex).toString());
     }
 }
Exemple #7
0
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     if (array.Length > 1)
     {
         string[]  array2    = new string[array.Length - 1];
         ArrayList arrayList = new ArrayList(5);
         int       num       = 0;
         for (int i = 1; i < array.Length; i++)
         {
             if (String.instancehelper_equals(array[i], ";"))
             {
                 if (num > 0)
                 {
                     arrayList.add(Arrays.copyOf(array2, num));
                     num = 0;
                 }
             }
             else
             {
                 string[] array3 = array2;
                 int      num2   = num;
                 num++;
                 array3[num2] = array[i];
             }
         }
         if (num > 0)
         {
             arrayList.add(Arrays.copyOf(array2, num));
         }
         Iterator iterator = arrayList.iterator();
         while (iterator.hasNext())
         {
             string[] args = (string[])iterator.next();
             this.this_0.putResponse(this.this_0.execute(args));
         }
     }
     else
     {
         this.this_0.putResponse("Usage: chain cmd1 ; cmd2 ; cmd3 ");
     }
     return("");
 }
Exemple #8
0
 public static void main(string[] args)
 {
     try
     {
         CommandInterpreter  commandInterpreter  = new CommandInterpreter();
         SocketCommandClient socketCommandClient = new SocketCommandClient("localhost", 7890);
         commandInterpreter.add("s", new SocketCommandClient_1(socketCommandClient));
         commandInterpreter.add("r", new SocketCommandClient_2(socketCommandClient));
         commandInterpreter.add("sr", new SocketCommandClient_3(socketCommandClient));
         commandInterpreter.setPrompt("scc-test> ");
         commandInterpreter.run();
     }
     catch (System.Exception ex)
     {
         java.lang.System.err.println("error occured.");
         Throwable.instancehelper_printStackTrace(ex);
         java.lang.System.exit(-1);
     }
     return;
 }
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     if (array.Length >= 3)
     {
         try
         {
             int      num  = Integer.parseInt(array[1]);
             string[] args = (string[])Arrays.copyOfRange(array, 2, array.Length);
             for (int i = 0; i < num; i++)
             {
                 this.this_0.putResponse(this.this_0.execute(args));
             }
         }
         catch (NumberFormatException)
         {
             this.this_0.putResponse("Usage: repeat count command args");
         }
     }
     else
     {
         this.this_0.putResponse("Usage: repeat count command args");
     }
     return("");
 }
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     Runtime.getRuntime().gc();
     return("");
 }
Exemple #11
0
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     CommandInterpreter.access_302(this.this_0, true);
     return("");
 }
Exemple #12
0
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     return("");
 }
Exemple #13
0
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     this.this_0.putResponse("Command Interpreter - Version 1.1 ");
     return("");
 }
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     return(new StringBuilder().append("Time is ").append(new Date()).toString());
 }
 internal static CommandInterpreter.CommandHistory access_100(CommandInterpreter commandInterpreter)
 {
     return(commandInterpreter.history);
 }
 internal static int access_200(CommandInterpreter commandInterpreter)
 {
     return(commandInterpreter.totalCommands);
 }
 internal static bool access_302(CommandInterpreter commandInterpreter, bool result)
 {
     commandInterpreter.done = result;
     return(result);
 }
 internal CommandHistory(CommandInterpreter commandInterpreter)
 {
     this_0       = commandInterpreter;
     this.history = new ArrayList(100);
 }
 internal static void access_000(CommandInterpreter commandInterpreter)
 {
     commandInterpreter.dumpCommands();
 }
Exemple #20
0
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     CommandInterpreter.access_100(this.this_0).dump();
     return("");
 }
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     this.this_0.putResponse(new StringBuilder().append("Total number of commands: ").append(CommandInterpreter.access_200(this.this_0)).toString());
     return("");
 }
Exemple #22
0
 internal CommandInterpreter_9(CommandInterpreter commandInterpreter)
 {
     this_0 = commandInterpreter;
 }
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     return("this is a test");
 }