From 7be51feca34173d28c1ea6d96eccf9d2393d310d Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 10:06:31 +0000 Subject: Utilisateur : Fcolin Date : 2/06/06 Heure : 16:47 Archivé dans $/CSharp/Ivy/IvyProbe Commentaire: Mise ajour Lib Ivy (vss 21) --- CSharp/Ivy/IvyProbe/IvyProbe.cs | 66 +++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/CSharp/Ivy/IvyProbe/IvyProbe.cs b/CSharp/Ivy/IvyProbe/IvyProbe.cs index 55360fa..1a9a37c 100644 --- a/CSharp/Ivy/IvyProbe/IvyProbe.cs +++ b/CSharp/Ivy/IvyProbe/IvyProbe.cs @@ -26,23 +26,32 @@ namespace IvyProbe ta.AppendText(s + "\r\n"); } - private void connect(IvyClient client) + private void connect(object sender, IvyEventArgs e) { - append(client.ApplicationName + " connected from " + Dns.GetHostEntry(client.RemoteAddress).HostName); + append(e.Client.ApplicationName + " connected from " + Dns.GetHostEntry(e.Client.RemoteAddress).HostName); } - private void disconnect(IvyClient client) + private void disconnect(object sender, IvyEventArgs e) { - append(client.ApplicationName + " disconnected from " + Dns.GetHostEntry(client.RemoteAddress).HostName); + append(e.Client.ApplicationName + " disconnected from " + Dns.GetHostEntry(e.Client.RemoteAddress).HostName); } - private Ivy.ApplicationExit die(IvyClient client, int id, string message) + private void die(object sender, IvyDieEventArgs e) { - append("receive die from "+client.ApplicationName+" cause: "+message ); - // return true terminate the application - return Ivy.ApplicationExit.FORCE_EXIT; + append("receive die from " + e.Client.ApplicationName + " cause: " + e.Argument); } - private void directMessage(IvyClient client, int id, string arg) + private void receive(object sender, IvyMessageEventArgs e) + { + string receive_str = "client " + e.Client.ApplicationName + " envoie: ["; + // Copy the collection to a new array starting at index 0. + String[] args = new String[e.Arguments.Count]; + e.Arguments.CopyTo(args, 0); + + receive_str += string.Join(",", args); + receive_str += "]"; + append(receive_str); + } + private void directMessage(object sender, IvyEventArgs e) { - append(client.ApplicationName + " direct Message " + id + arg); + append(e.Client.ApplicationName + " direct Message " + e.Id + e.Argument); } public void RegexpCB(System.Object event_sender, System.EventArgs e) @@ -50,7 +59,7 @@ namespace IvyProbe // ajoute la nouvelle regex string regexp = tbRegexp.Text; regexp.Trim(); - int regexp_id = bus.bindMsg(regexp, receive); + int regexp_id = bus.BindMsg(regexp, receive); tbRegexp.Text = ""; append( "bind("+regexp_id+") ->"+regexp); } @@ -59,25 +68,18 @@ namespace IvyProbe // ajoute la nouvelle regex string expression = tbRegexp.Text; expression.Trim(); - int regexp_id = bus.bindSimpleMsg(expression, receive); + int regexp_id = bus.BindSimpleMsg(expression, receive); tbRegexp.Text = ""; append( "bind("+regexp_id+") ->"+expression); } - private void receive(IvyClient client, string[] args) - { - string receive_str = "client " + client.ApplicationName + " envoie: ["; - - receive_str += string.Join(",",args); - receive_str += "]"; - append(receive_str); - } + public void SendCB(System.Object event_sender, System.EventArgs e) { int count; System.String tosend = tbMsg.Text; tbMsg.Text = ""; - count = bus.sendMsg(tosend); + count = bus.SendMsg(tosend); append("Sending '" + tosend + "' count " + count); } @@ -107,7 +109,7 @@ namespace IvyProbe { // enleve la regex string regexp = tbRegexp.Text; - bool removed = bus.unBindMsg( regexp ); + bool removed = bus.UnbindMsg( regexp ); if ( removed ) { append( "unbind("+regexp+")"); @@ -119,35 +121,35 @@ namespace IvyProbe } } - private void bus_addBinding(IvyClient app, string arg) + private void bus_addBinding(object sender, IvyEventArgs e) { - append( app.ApplicationName + " add binding '"+arg+"'"); + append(e.Client.ApplicationName + " add binding '" + e.Argument + "'"); } - private void bus_removeBinding(IvyClient app, string arg) + private void bus_removeBinding(object sender, IvyEventArgs e) { - append( app.ApplicationName + " remove binding '"+arg+"'"); + append(e.Client.ApplicationName + " remove binding '" + e.Argument + "'"); } private void busDomain_DomainChanged(object sender, EventArgs e) { - bus.stop(); - bus.start(busDomain.Domain); + bus.Stop(); + bus.Start(busDomain.Domain); } private void IvyProbe_FormClosed(object sender, FormClosedEventArgs e) { - bus.stop(); + bus.Stop(); } private void IvyProbe_Load(object sender, EventArgs e) { - bus.start(busDomain.Domain); + bus.Start(busDomain.Domain); } - private void bus_ErrorMessage(IvyClient app, int id, string arg) + private void bus_ErrorMessage(object sender, IvyEventArgs e) { - append(app.ApplicationName + " error message "+ id + " '" + arg + "'"); + append(e.Client.ApplicationName + " error message "+ e.Id + " '" + e.Argument + "'"); } } } \ No newline at end of file -- cgit v1.1