From ae1dd2b94fdcd2a9aba03bc5ea441ce2c56e3d08 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 09:44:01 +0000 Subject: Utilisateur : Fcolin Date : 10/04/06 Heure : 18:45 Archivé dans $/CSharp/Ivy/Ivy Commentaire: optimisation diverse suite a passage de Code Analysis (vss 62) --- CSharp/Ivy/Ivy/Ivy.cs | 57 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) (limited to 'CSharp/Ivy') diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs index 5b15275..1cffc1b 100644 --- a/CSharp/Ivy/Ivy/Ivy.cs +++ b/CSharp/Ivy/Ivy/Ivy.cs @@ -224,7 +224,7 @@ namespace IvyBus [Category("Ivy")] #endif [DefaultValue(null)] - public string[] SentMessageClasses + public StringCollection SentMessageClasses { get { @@ -280,7 +280,6 @@ namespace IvyBus internal const ushort DEFAULT_PRIORITY = 100; /// the domain for the UDP rendez vous private static readonly string DEFAULT_DOMAIN = "127.255.255.255:" + DEFAULT_PORT; - private const string libVersion = "2.0.0"; internal int protocolVersion = 3; private static bool debug = false; private static ushort serial = 0; /* an unique ID for each regexp */ @@ -300,7 +299,7 @@ namespace IvyBus internal Dictionary bindings; private List clients; - private string[] sent_messageClasses = null; + private StringCollection sent_messageClasses; private bool stopped = true; internal ushort applicationPort; /* Application port number */ internal IPAddress applicationHost; /* Application host number */ @@ -445,7 +444,7 @@ namespace IvyBus { throw new IvyException("can't open TCP service socket " + e); } - traceDebug("lib: " + libVersion + " protocol: " + ProtocolVersion + " TCP service open on port " + applicationPort); + traceDebug("Ivy protocol: " + ProtocolVersion + " TCP service open on port " + applicationPort); watchers = new List(); Domain[] d = parseDomains(domainbus); @@ -487,7 +486,7 @@ namespace IvyBus } /* a small private method for debbugging purposes */ - public string domains(string toparse) + public static string domains(string toparse) { StringBuilder s = new StringBuilder("broadcasting on "); Ivy.Domain[] d = parseDomains(toparse); @@ -501,7 +500,7 @@ namespace IvyBus return s.ToString(); } - internal Domain[] parseDomains(string domainbus) + internal static Domain[] parseDomains(string domainbus) { string[] st = domainbus.Split(','); Domain[] d = new Domain[st.Length]; @@ -654,7 +653,7 @@ namespace IvyBus { throw new IvyException("client wants to remove an unexistant regexp " + id); } - ApplicationBinding bind = (ApplicationBinding)bindings[id]; + //ApplicationBinding bind = (ApplicationBinding)bindings[id]; lock (clients) { foreach (IvyClient c in clients) @@ -755,34 +754,34 @@ namespace IvyBus return true; else return false; } - internal void FireDirectMessage(IvyClient app, int id, string arg) + internal void FireDirectMessage(IvyClient clnt, int id, string arg) { if (DirectMessageReceived != null) { if (IsSynchronous()) - syncControl.Invoke(DirectMessageReceived, new object[] { app, id, arg }); - else DirectMessageReceived(app, id, arg); + syncControl.Invoke(DirectMessageReceived, new object[] { clnt, id, arg }); + else DirectMessageReceived(clnt, id, arg); } } - internal void FireClientConnected(IvyClient app) + internal void FireClientConnected(IvyClient clnt) { if (ClientConnected != null) { if (IsSynchronous()) - syncControl.Invoke(ClientConnected, new object[] { app }); - else ClientConnected(app); + syncControl.Invoke(ClientConnected, new object[] { clnt }); + else ClientConnected(clnt); } } - internal void FireClientDisconnected(IvyClient app) + internal void FireClientDisconnected(IvyClient clnt) { if (ClientDisconnected != null) { try { if (IsSynchronous()) - syncControl.Invoke(ClientDisconnected, new object[] { app }); - else ClientDisconnected(app); + syncControl.Invoke(ClientDisconnected, new object[] { clnt }); + else ClientDisconnected(clnt); } catch (ObjectDisposedException ) { @@ -790,41 +789,41 @@ namespace IvyBus } } } - internal void FireClientAddBinding(IvyClient app, string regexp) + internal void FireClientAddBinding(IvyClient clnt, string regexp) { if (BindingAdd != null) { if (IsSynchronous()) - syncControl.Invoke(BindingAdd, new object[] { app, regexp }); - else BindingAdd(app, regexp); + syncControl.Invoke(BindingAdd, new object[] { clnt, regexp }); + else BindingAdd(clnt, regexp); } } - internal void FireClientRemoveBinding(IvyClient app, string regexp) + internal void FireClientRemoveBinding(IvyClient clnt, string regexp) { if (BindingRemove != null) { if (IsSynchronous()) - syncControl.Invoke(BindingRemove, new object[] { app, regexp }); - else BindingRemove(app, regexp); + syncControl.Invoke(BindingRemove, new object[] { clnt, regexp }); + else BindingRemove(clnt, regexp); } } - internal ApplicationExit FireDie(IvyClient app, int id, string arg) + internal ApplicationExit FireDie(IvyClient clnt, int id, string arg) { if (dieReceived != null) { if (IsSynchronous()) - return (ApplicationExit)syncControl.Invoke(dieReceived, new object[] { app, id, arg }); - else return dieReceived(app, id, arg); + return (ApplicationExit)syncControl.Invoke(dieReceived, new object[] { clnt, id, arg }); + else return dieReceived(clnt, id, arg); } return ApplicationExit.FORCE_EXIT; } - internal void FireError(IvyClient client, int id, string arg) + internal void FireError(IvyClient clnt, int id, string arg) { if (ErrorMessage != null) { if (IsSynchronous()) - syncControl.Invoke(ErrorMessage, new object[] { client, id, arg }); - else ErrorMessage(client, id, arg); + syncControl.Invoke(ErrorMessage, new object[] { clnt, id, arg }); + else ErrorMessage(clnt, id, arg); } } @@ -1014,7 +1013,7 @@ namespace IvyBus } [Conditional("DEBUG")] - private void traceDebug(string s) + private static void traceDebug(string s) { Trace.Assert(!debug, "-->ivy<-- " + s); } -- cgit v1.1