From 1af4e97ea8bb5dd7792f2acc93b98d07bbaef13b Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 09:54:50 +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/IvyPPC/Ivy.cs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'CSharp') diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs index 5e90a27..0790854 100644 --- a/CSharp/Ivy/IvyPPC/Ivy.cs +++ b/CSharp/Ivy/IvyPPC/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