diff options
author | fcolin | 2007-02-01 09:43:08 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 09:43:08 +0000 |
commit | 3f7e562f4fd7125e39ebe1d092329d048deb5cc6 (patch) | |
tree | dd86df91ad74388895cd47a307edfde2bb5ba98a | |
parent | 889f5d25012d9b05296ae0f5d859316618733199 (diff) | |
download | ivy-csharp-3f7e562f4fd7125e39ebe1d092329d048deb5cc6.zip ivy-csharp-3f7e562f4fd7125e39ebe1d092329d048deb5cc6.tar.gz ivy-csharp-3f7e562f4fd7125e39ebe1d092329d048deb5cc6.tar.bz2 ivy-csharp-3f7e562f4fd7125e39ebe1d092329d048deb5cc6.tar.xz |
Utilisateur : Fcolin Date : 20/01/06 Heure : 17:57 Archivé dans $/CSharp/Ivy/Ivy Commentaire: (vss 36)
-rw-r--r-- | CSharp/Ivy/Ivy/Ivy.cs | 102 |
1 files changed, 41 insertions, 61 deletions
diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs index 4fc603b..2f522fe 100644 --- a/CSharp/Ivy/Ivy/Ivy.cs +++ b/CSharp/Ivy/Ivy/Ivy.cs @@ -52,7 +52,33 @@ namespace IvyBus public event ClientAddBindingHandler addBinding;
/// <summary>fires when a client receive a remove binding from another client</summary>
public event ClientRemoveBindingHandler removeBinding;
-
+
+
+ public bool Debug
+ {
+ get
+ {
+ return debug;
+ }
+ set
+ {
+ debug = value;
+ }
+
+ }
+
+ public CultureInfo Culture
+ {
+ get
+ {
+ return culture;
+ }
+ set
+ {
+ culture = value;
+ }
+
+ }
/// <summary>IvyClients accesses the list of the connected clients</summary>
public List<IvyClient> IvyClients
@@ -63,18 +89,6 @@ namespace IvyBus }
}
- public bool Debug
- {
- get
- {
- return debug;
- }
- set
- {
- debug = value;
- }
-
- }
/// <summary>ClientNames accesses the name list of the connected clients</summary>
private string ClientNames
{
@@ -201,6 +215,7 @@ namespace IvyBus internal string applicationUniqueId; /* identifier Application unique timestamp-ipaddress-port */
internal ushort applicationPriority = DEFAULT_PRIORITY;
internal string ready_message = null;
+ internal CultureInfo culture = new CultureInfo("en-us");
// for synchronous event
private Control syncControl = null;
@@ -419,34 +434,6 @@ namespace IvyBus }
- /// <summary> Send a message to someone on the bus
- /// </summary>
- /// <remarks>
- /// Performs a pattern matching according to everyone's regexps, and sends
- /// the results to the relevant ivy agents.
- /// There is one thread for each client connected, we could also
- /// create another thread each time we send a message.
- /// </remarks>
- /// <param name='message'>A message which will be compared to the regular
- /// expressions of the different clients
- /// </param>
- /// <returns>the number of messages actually sent
- ///
- /// </returns>
- public int sendMsg(string message)
- {
- int count = 0;
- // an alternate implementation would one sender thread per client
- // instead of one for all the clients. It might be a performance issue
- lock ( clients )
- {
- foreach (IvyClient client in clients )
- {
- count += client.sendMsg(message);
- }
- }
- return count;
- }
/// <summary> Send a formated message to someone on the bus
/// </summary>
/// <remarks>
@@ -463,25 +450,18 @@ namespace IvyBus /// </returns>
public int sendMsg(string format, params object[] args )
{
- return sendMsg( string.Format( format, args ) );
- }
- /// <summary> Send a formated message to someone on the bus
- /// </summary>
- /// <remarks>
- /// Performs a pattern matching according to everyone's regexps, and sends
- /// the results to the relevant ivy agents.
- /// There is one thread for each client connected, we could also
- /// create another thread each time we send a message.
- /// </remarks>
- /// <param name='format'>A string message format to build the message
- /// <param name='args'>args used in message format
- /// </param>
- /// <returns>the number of messages actually sent
- ///
- /// </returns>
- public int sendMsg(CultureInfo culture, string format, params object[] args )
- {
- return sendMsg( string.Format( culture, format, args ) );
+ string msg = string.Format( culture, format, args );
+ int count = 0;
+ // an alternate implementation would one sender thread per client
+ // instead of one for all the clients. It might be a performance issue
+ lock (clients)
+ {
+ foreach (IvyClient client in clients)
+ {
+ count += client.sendMsg(msg);
+ }
+ }
+ return count;
}
/// <summary> Subscribes to a regular expression.
@@ -750,7 +730,7 @@ namespace IvyBus {
throw new IvyException("(callCallback) Not regexp matching id " + key);
}
- if ( syncControl != null )
+ if ( syncControl != null && syncControl.Created )
syncControl.Invoke(bind.callback, new object[] { client, arg });
else bind.callback(client, arg);
}
|