From 2315589a7213c1f20b9907949c5512468c34daab Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 09:42:51 +0000 Subject: Utilisateur : Fcolin Date : 19/09/05 Heure : 14:14 Archivé dans $/CSharp/Ivy Commentaire: Passage Nouvel API IVY ( pas teste ) (vss 27) --- CSharp/Ivy/Ivy/Ivy.cs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'CSharp/Ivy') diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs index 5e90a27..0790854 100644 --- a/CSharp/Ivy/Ivy/Ivy.cs +++ b/CSharp/Ivy/Ivy/Ivy.cs @@ -21,14 +21,14 @@ namespace IvyBus public class Ivy { /* Event handler */ - public delegate void DirectMessageHandler (IvyClient app, int id, string arg ); + public delegate void DirectMessageHandler (IvyClient app, int id, byte[] arg ); public delegate void ClientConnectedHandler (IvyClient app); public delegate void ClientDisconnectedHandler (IvyClient app); public delegate bool DieHandler (IvyClient app, int id ); public delegate void ClientAddBindingHandler (IvyClient app, string arg ); public delegate void ClientRemoveBindingHandler (IvyClient app, string arg ); - public delegate void MessageHandler ( IvyClient app, string[] args ); + public delegate void MessageHandler ( IvyClient app, IvyArgument args ); /* Event */ @@ -458,7 +458,7 @@ namespace IvyBus /// // // for compatibility raison with old IVY - public int bindMsg(String regexp, MessageHandler callback) + public int bindMsg(string regexp, MessageHandler callback) { return bindMsg( regexp, callback, null); } @@ -571,7 +571,7 @@ namespace IvyBus return newbind.key; } - internal void FireDirectMessage (IvyClient app, int id, string arg ) + internal void FireDirectMessage (IvyClient app, int id, byte[] arg ) { if ( directMessageReceived != null ) { @@ -661,11 +661,11 @@ namespace IvyBus // /////////////////////////////////////////////////////////////////: - internal void addClient(Socket socket) + internal void addClient(Socket socket,string appname) { if (stopped) return ; - IvyClient client = new IvyClient(this,socket); + IvyClient client = new IvyClient(this,socket,appname); lock ( clients.SyncRoot ) { clients.Add(client); @@ -673,16 +673,17 @@ namespace IvyBus traceDebug(ClientNames); } - internal void callCallback(IvyClient client, Int32 key, string[] tab) + internal void callCallback(IvyClient client, int key, byte[] data) { ApplicationBinding bind = ( ApplicationBinding ) bindings[key]; if (bind.callback == null) { throw new IvyException("(callCallback) Not regexp matching id " + key); } + IvyArgument arg = IvyArgument.Deserialize( data ); if ( syncControl != null ) - syncControl.Invoke( bind.callback, new object[]{client,tab}); - else bind.callback(client, tab); + syncControl.Invoke( bind.callback, new object[]{client,arg}); + else bind.callback(client, arg); } @@ -759,7 +760,7 @@ namespace IvyBus if (stopped) break; // early disconnexion - addClient(socket); // the peer called me + addClient(socket,"Unkown(waiting for name reception)"); // the peer called me } catch (IOException e) { @@ -781,7 +782,7 @@ namespace IvyBus private void traceDebug(string s) { if (debug) - Console.Out.WriteLine("-->ivy<-- " + s); + Console.WriteLine("-->ivy<-- " + s); } internal class Domain -- cgit v1.1