diff options
author | fcolin | 2007-02-01 10:08:11 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 10:08:11 +0000 |
commit | a40e883dd66d74669d56782049cad3348e23ae74 (patch) | |
tree | c1e4d03a9c3cf7517b73ad2953e95ab2651bc6ba /CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs | |
parent | 5191df18a804e46a7d789b425e23533b3c135126 (diff) | |
download | ivy-csharp-a40e883dd66d74669d56782049cad3348e23ae74.zip ivy-csharp-a40e883dd66d74669d56782049cad3348e23ae74.tar.gz ivy-csharp-a40e883dd66d74669d56782049cad3348e23ae74.tar.bz2 ivy-csharp-a40e883dd66d74669d56782049cad3348e23ae74.tar.xz |
Utilisateur : Fcolin Date : 22/12/05 Heure : 17:48 Archivé dans $/CSharp/Ivy/IvyProbeConsole Commentaire: (vss 7)
Diffstat (limited to 'CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs')
-rw-r--r-- | CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs | 36 |
1 files 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<IvyClient> 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);
|