From 848375328ec9a52a2a5f46b8438011f1a553295b Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 10:08:23 +0000 Subject: Utilisateur : Fcolin Date : 2/06/06 Heure : 16:47 Archivé dans $/CSharp/Ivy/IvyProbeConsole Commentaire: Mise ajour Lib Ivy (vss 13) --- CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs | 53 +++++++++++++-------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'CSharp/Ivy/IvyProbeConsole') diff --git a/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs b/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs index 3507e40..6467b11 100644 --- a/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs +++ b/CSharp/Ivy/IvyProbeConsole/IvyProbeConsole.cs @@ -45,7 +45,7 @@ namespace IvyProbeConsole String name = "C#PROBE"; bool quiet = false; bool timestamp = false; - String domain = Ivy.getDomain(null); + String domain = Ivy.GetDomain(null); bool debug = false; domain = Properties.Settings.Default.domain; @@ -99,9 +99,9 @@ namespace IvyProbeConsole } */ if (!quiet) - System.Console.Out.WriteLine(Ivy.domains(domain)); + System.Console.Out.WriteLine(Ivy.Domains(domain)); - bus.start(domain); + bus.Start(domain); p.start(bus); } @@ -134,7 +134,7 @@ namespace IvyProbeConsole bus.ClientConnected += connect; bus.ClientDisconnected += disconnect; - bus.dieReceived += die ; + bus.DieReceived += die ; bus.DirectMessageReceived += directMessage; looperThread = new Thread(new ThreadStart(Run)); @@ -157,7 +157,7 @@ namespace IvyProbeConsole parseCommand(s); } println("End of input. Good bye !"); - bus.stop(); + bus.Stop(); traceDebug("Probe Thread stopped"); } @@ -170,18 +170,18 @@ namespace IvyProbeConsole // provided with .direct ! if (s.Length == 0) { - println("-> Sent to " + bus.sendMsg(s) + " peers"); + println("-> Sent to " + bus.SendMsg(s) + " peers"); } else if ((result = directMsgRE.Match(s)).Success) { String target = result.Groups[1].ToString(); ushort id = ushort.Parse(result.Groups[2].ToString()); String message = result.Groups[3].ToString(); - List v = bus.getIvyClientsByName(target); + List v = bus.GetClientsByName(target); if (v.Count == 0) println("no Ivy client with the name \"" + target + "\""); for (int i = 0; i < v.Count; i++) - v[i].sendDirectMsg(id, message); + v[i].SendDirectMsg(id, message); return ; } else if (s.LastIndexOf(".die ") >= 0) @@ -193,7 +193,7 @@ namespace IvyProbeConsole else if (s.LastIndexOf(".unbind ") >= 0) { String regexp = s.Substring(8); - if (bus.unBindMsg(regexp)) + if (bus.UnbindMsg(regexp)) { println("you want to unsubscribe to " + regexp); } @@ -206,7 +206,7 @@ namespace IvyProbeConsole { String regexp = s.Substring(6); println("you want to subscribe to " + regexp); - bus.bindMsg(regexp, receive); + bus.BindMsg(regexp, receive); } else if (s.LastIndexOf(".ping ") >= 0) { @@ -218,7 +218,7 @@ namespace IvyProbeConsole } else if ((s.LastIndexOf(".quit") >= 0) || (s.LastIndexOf(".bye") >= 0)) { - bus.stop(); + bus.Stop(); System.Environment.Exit(0); } else if (s.LastIndexOf(".list") >= 0) @@ -240,42 +240,41 @@ namespace IvyProbeConsole } else { - println("-> Sent to " + bus.sendMsg(s) + " peers"); + println("-> Sent to " + bus.SendMsg(s) + " peers"); } } // parseCommand - private void connect(IvyClient client) + private void connect(object sender, IvyEventArgs e) { - println(client.ApplicationName + " connected from "+client.RemoteAddress+":"+client.RemotePort); - foreach (string re in client.Regexps ) + println(e.Client.ApplicationName + " connected from "+e.Client.RemoteAddress+":"+e.Client.RemotePort); + foreach (string re in e.Client.Regexps ) { - println(client.ApplicationName + " subscribes to " + re); + println(e.Client.ApplicationName + " subscribes to " + re); } } - private void disconnect(IvyClient client) + private void disconnect(object sender, IvyEventArgs e) { - println(client.ApplicationName + " disconnected "); + println(e.Client.ApplicationName + " disconnected "); } - - private Ivy.ApplicationExit die(IvyClient client, int id, string message) + + private void die(object sender, IvyDieEventArgs e) { - println("received die msg from " + client.ApplicationName + " good bye cause: "+message); + println("received die msg from " + e.Client.ApplicationName + " good bye cause: "+e.Argument); /* I cannot stop the readLine(), because it is native code */ if (exitOnDie) System.Environment.Exit(0); - return Ivy.ApplicationExit.FORCE_EXIT; } - private void directMessage(IvyClient client, int id, string arg) + private void directMessage(object sender, IvyEventArgs e) { - println(client.ApplicationName + " direct Message " + id + arg); + println(e.Client.ApplicationName + " direct Message " + e.Id + e.Argument); } - - private void receive(IvyClient client, string[] args) + + private void receive(object sender, IvyMessageEventArgs e) { - String s = client.ApplicationName + " sent" + args.ToString(); + String s = e.Client.ApplicationName + " sent" + e.Arguments.ToString(); println(s); } [Conditional("DEBUG")] -- cgit v1.1