From a40e883dd66d74669d56782049cad3348e23ae74 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 10:08:11 +0000 Subject: Utilisateur : Fcolin Date : 22/12/05 Heure : 17:48 Archivé dans $/CSharp/Ivy/IvyProbeConsole Commentaire: (vss 7) --- CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs | 36 ++++++++++++--------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs b/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs index 5cd0b70..4b9355e 100644 --- a/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs +++ b/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs @@ -3,11 +3,12 @@ /// * /// (C) CENA /// * -namespace IvyProbe +namespace IvyProbeConsole { using System; using System.Collections; - using System.Threading; + using System.Collections.Generic; + using System.Threading; using System.Text.RegularExpressions; using System.IO; using System.Configuration; @@ -45,17 +46,12 @@ namespace IvyProbe bool timestamp = false; String domain = Ivy.getDomain(null); bool debug = false; - - if ( ConfigurationManager.AppSettings["domain"] != null ) - domain = ConfigurationManager.AppSettings["domain"]; - if (ConfigurationManager.AppSettings["name"] != null) - name = ConfigurationManager.AppSettings["name"]; - if (ConfigurationManager.AppSettings["quiet"] != null) - quiet = bool.Parse(ConfigurationManager.AppSettings["quiet"]); - if (ConfigurationManager.AppSettings["timestamp"] != null) - timestamp = bool.Parse(ConfigurationManager.AppSettings["timestamp"]); - if (ConfigurationManager.AppSettings["IVY_DEBUG"] != null) - debug = bool.Parse(ConfigurationManager.AppSettings["IVY_DEBUG"]); + + domain = Properties.Settings.Default.domain; + name = Properties.Settings.Default.name; + quiet = Properties.Settings.Default.quiet; + timestamp = Properties.Settings.Default.timestamp; + debug = Properties.Settings.Default.IvyDebug; /* Getopt opt = new Getopt("Probe", args, "n:b:dqht"); @@ -178,13 +174,13 @@ namespace IvyProbe else if ((result = directMsgRE.Match(s)).Success) { String target = result.Groups[1].ToString(); - int id = Int32.Parse(result.Groups[2].ToString()); + ushort id = ushort.Parse(result.Groups[2].ToString()); String message = result.Groups[3].ToString(); - ArrayList v = bus.getIvyClientsByName(target); + List v = bus.getIvyClientsByName(target); if (v.Count == 0) println("no Ivy client with the name \"" + target + "\""); for (int i = 0; i < v.Count; i++) - ((IvyClient) v[i]).sendDirectMsg(id, message); + v[i].sendDirectMsg(id, message); return ; } else if (s.LastIndexOf(".die ") >= 0) @@ -262,21 +258,21 @@ namespace IvyProbe println(client.ApplicationName + " disconnected "); } - private bool die(IvyClient client, int id) + private bool die(IvyClient client, int id, string message) { - println("received die msg from " + client.ApplicationName + " good bye"); + println("received die msg from " + client.ApplicationName + " good bye cause: "+message); /* I cannot stop the readLine(), because it is native code */ if (exitOnDie) System.Environment.Exit(0); return true; } - private void directMessage(IvyClient client, int id, IvyArgument arg) + private void directMessage(IvyClient client, int id, string arg) { println(client.ApplicationName + " direct Message " + id + arg); } - private void receive(IvyClient client, IvyArgument args) + private void receive(IvyClient client, string[] args) { String s = client.ApplicationName + " sent" + args.ToString(); println(s); -- cgit v1.1