From c82f9a03c0749864f6a4cc5dd09dccb255220ec8 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 10:08:26 +0000 Subject: Utilisateur : Fcolin Date : 23/06/06 Heure : 11:12 Archivé dans $/CSharp/Ivy/IvyProbeConsole Commentaire: (vss 14) --- CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs | 36 ++++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs b/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs index 6467b11..6c9ce7a 100644 --- a/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs +++ b/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs @@ -14,6 +14,7 @@ namespace IvyProbeConsole using System.Configuration; using System.Diagnostics; using IvyBus; + using Gnu; /// Console implementation of the ivyprobe test program. /// @@ -54,12 +55,12 @@ namespace IvyProbeConsole timestamp = Properties.Settings.Default.timestamp; debug = Properties.Settings.Default.IvyDebug; -/* - Getopt opt = new Getopt("Probe", args, "n:b:dqht"); - int c; - while ((c = opt.getopt()) != - 1) - { - switch (c) + + GetOpt opt = new GetOpt(args, "n:b:dqht"); + Arg a; + while ((a = opt.NextArg()) != null) + { + switch (a.Flag) { case 'd': //UPGRADE_ISSUE: Method 'java.lang.System.getProperties' was not converted. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1000_javalangSystemgetProperties"' @@ -68,10 +69,10 @@ namespace IvyProbeConsole break; case 'b': - domain = opt.Optarg; break; + domain = a.Parameter; break; case 'n': - name = opt.Optarg; break; + name = a.Parameter; break; case 'q': quiet = true; break; @@ -86,18 +87,18 @@ namespace IvyProbeConsole } } -*/ + IvyProbeConsole p = new IvyProbeConsole(System.Console.In, timestamp, quiet, debug ); p.ExitOnDie = true; Ivy bus = new Ivy(name, name + " ready"); -/* for (int i = opt.Optind; i < args.Length; i++) + foreach(string ex in opt.Extras) { if (!quiet) - System.Console.Out.WriteLine("you want to subscribe to " + args[i]); - bus.bindMsg(args[i], p); + System.Console.Out.WriteLine("you want to subscribe to " + ex); + bus.BindMsg(ex, p.receive); } -*/ + if (!quiet) System.Console.Out.WriteLine(Ivy.Domains(domain)); @@ -274,8 +275,13 @@ namespace IvyProbeConsole private void receive(object sender, IvyMessageEventArgs e) { - String s = e.Client.ApplicationName + " sent" + e.Arguments.ToString(); - println(s); + String s = e.Client.ApplicationName + " sent "; + // Copy the collection to a new array starting at index 0. + String[] args = new String[e.Arguments.Count]; + e.Arguments.CopyTo(args, 0); + + s += string.Join(",", args); + println(s); } [Conditional("DEBUG")] private void traceDebug(String s) -- cgit v1.1