diff options
Diffstat (limited to 'CSharp')
-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);
|