From 3c9d0c18a19de1f1ec1c4e77f6b89fdf84d39605 Mon Sep 17 00:00:00 2001 From: fcolin Date: Fri, 10 Oct 2008 15:45:54 +0000 Subject: Ajout de commentaire sur les menbres public --- Ivy/Ivy.cs | 121 ++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 91 insertions(+), 30 deletions(-) (limited to 'Ivy/Ivy.cs') diff --git a/Ivy/Ivy.cs b/Ivy/Ivy.cs index bfef8ab..1946133 100644 --- a/Ivy/Ivy.cs +++ b/Ivy/Ivy.cs @@ -30,17 +30,46 @@ namespace IvyBus public class Ivy { /* Event */ + /// + /// raise when an new IvyClient is connected + /// public event EventHandler ClientConnected; + /// + /// raise when an new IvyClient is disconnected + /// public event EventHandler ClientDisconnected; + /// + /// raise when a direct message is received + /// public event EventHandler DirectMessageReceived; + /// + /// raise when some IvyClient ask me to die + /// public event EventHandler DieReceived; + /// + /// raise when an IvyClient register a binding + /// public event EventHandler BindingAdd; + /// + /// raise when an IvyClient unregister a binding + /// public event EventHandler BindingRemove; + /// + /// raise when an IvyClient binding is filteredout + /// public event EventHandler BindingFilter; + /// + /// raise when an IvyClient changer a binding + /// public event EventHandler BindingChange; + /// + /// raise when an error message is received + /// public event EventHandler ErrorMessage; - + /// + /// Flag for displaying internal debug message of the protocol intrinsics + /// public static bool DebugProtocol { get @@ -53,7 +82,10 @@ namespace IvyBus } } - + /// + /// Language for the Ivy SendMsg formating default en-US + /// ie: send point on float value sent + /// public CultureInfo Culture { get @@ -92,7 +124,9 @@ namespace IvyBus } } - /// AppId the Application Unique ID + /// + /// AppId the Application Unique ID + /// public string AppId { @@ -103,7 +137,9 @@ namespace IvyBus } - + /// + /// the Ivy Protocol version + /// public int ProtocolVersion { get @@ -113,8 +149,9 @@ namespace IvyBus } - /// IsRunning is the bus Started and connected ? - + /// + /// IsRunning is the bus Started and connected ? + /// public bool IsRunning { get @@ -167,6 +204,9 @@ namespace IvyBus private Thread serverThread; // to ensure quick communication of the end private AutoResetEvent tcplistener_running; + /// + /// the Ivy Assembly version + /// static public Version Version { get { return Assembly.GetExecutingAssembly().GetName().Version; } @@ -200,7 +240,8 @@ namespace IvyBus /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the Ivy Bus. + /// Readies the structures for the software bus connexion. /// public Ivy() { @@ -351,7 +392,10 @@ namespace IvyBus OnClientRemoveBinding(new IvyEventArgs(clnt, id, clientbind.binding.Expression)); } - // Autobinding on static method + /// + /// Automatic binding on static method of a Type + /// + /// public void BindAttribute(Type type) { if (type == null) return; @@ -374,7 +418,12 @@ namespace IvyBus } } } - // Autobinding on instance method + + + /// + /// Autobinding on instance method + /// + /// public void BindAttribute(object target) { if (target == null) return; @@ -398,6 +447,10 @@ namespace IvyBus } // Autobinding on IvyBindingAttribute method + /// + /// Automatic binding of IvyBindAttribute in an assembly + /// + /// public void BindAttribute(Assembly target) { if (target != null) @@ -477,22 +530,7 @@ namespace IvyBus clients.Sort(); } } - /* a small private method for debbugging purposes */ - - public static string Domains(string toParse) - { - string domainbus = GetDomain(toParse); - StringBuilder s = new StringBuilder("broadcasting on "); - Ivy.Domain[] d = parseDomains(domainbus); - for (int index = 0; index < d.Length; index++) - { - s.Append(d[index].Domainaddr); - s.Append(":"); - s.Append(d[index].Port); - s.Append(" "); - } - return s.ToString(); - } + internal static Domain[] parseDomains(string domainbus) { @@ -584,6 +622,7 @@ namespace IvyBus { this.Join(Timeout.Infinite); } + /// /// Send a formated message to someone on the bus /// @@ -673,7 +712,11 @@ namespace IvyBus return count; } - // + /// + /// Make a binding to a message using regular expresssion + /// + /// + /// public int BindMsg(IvyApplicationBinding newBinding) { newBinding.Key = Interlocked.Increment(ref serial); @@ -729,7 +772,8 @@ namespace IvyBus { try { - c.stream.TokenDelBinding(id); + if ( c.stream != null ) + c.stream.TokenDelBinding(id); } catch (IOException) { @@ -739,6 +783,12 @@ namespace IvyBus } lock (bindings) bindings.Remove(id); } + /// + /// Change a binding already registred + /// + /// + /// + /// public int ChangeMsg(int id, string expression) { IvyApplicationBinding newbind; @@ -1048,7 +1098,10 @@ namespace IvyBus } - + /// + /// return the first non loopback adress + /// on a one network interface machine it will be my IP adresse + /// public static IPAddress LocalIP { get @@ -1065,7 +1118,11 @@ namespace IvyBus return returnaddr; } } - + /// + /// Get the FDQN Domain from a string + /// + /// + /// public static string GetDomain(string domainBus) { #if (PocketPC) // TODO integrate in normal version @@ -1264,7 +1321,11 @@ namespace IvyBus } } - + /// + /// check Validity of Ivy Bus Domain + /// + /// + /// public static bool ValidatingDomain(string domain) { // domain if of the form ip1[:port][,ip2[:port]] with ip of the form n1.n2.n3.n4 -- cgit v1.1