summaryrefslogtreecommitdiff
path: root/Ivy/Ivy.cs
diff options
context:
space:
mode:
authorfcolin2008-10-10 15:45:54 +0000
committerfcolin2008-10-10 15:45:54 +0000
commit3c9d0c18a19de1f1ec1c4e77f6b89fdf84d39605 (patch)
treeb4c691f61e44c2310887ccb77b94a519a73a7fdb /Ivy/Ivy.cs
parent8d10e8bbd1e19adc7c70e1101dbb69c213c910dd (diff)
downloadivy-csharp-3c9d0c18a19de1f1ec1c4e77f6b89fdf84d39605.zip
ivy-csharp-3c9d0c18a19de1f1ec1c4e77f6b89fdf84d39605.tar.gz
ivy-csharp-3c9d0c18a19de1f1ec1c4e77f6b89fdf84d39605.tar.bz2
ivy-csharp-3c9d0c18a19de1f1ec1c4e77f6b89fdf84d39605.tar.xz
Ajout de commentaire sur les menbres public
Diffstat (limited to 'Ivy/Ivy.cs')
-rw-r--r--Ivy/Ivy.cs121
1 files changed, 91 insertions, 30 deletions
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 */
+ /// <summary>
+ /// raise when an new IvyClient is connected
+ /// </summary>
public event EventHandler<IvyEventArgs> ClientConnected;
+ /// <summary>
+ /// raise when an new IvyClient is disconnected
+ /// </summary>
public event EventHandler<IvyEventArgs> ClientDisconnected;
+ /// <summary>
+ /// raise when a direct message is received
+ /// </summary>
public event EventHandler<IvyEventArgs> DirectMessageReceived;
+ /// <summary>
+ /// raise when some IvyClient ask me to die
+ /// </summary>
public event EventHandler<IvyDieEventArgs> DieReceived;
+ /// <summary>
+ /// raise when an IvyClient register a binding
+ /// </summary>
public event EventHandler<IvyEventArgs> BindingAdd;
+ /// <summary>
+ /// raise when an IvyClient unregister a binding
+ /// </summary>
public event EventHandler<IvyEventArgs> BindingRemove;
+ /// <summary>
+ /// raise when an IvyClient binding is filteredout
+ /// </summary>
public event EventHandler<IvyEventArgs> BindingFilter;
+ /// <summary>
+ /// raise when an IvyClient changer a binding
+ /// </summary>
public event EventHandler<IvyEventArgs> BindingChange;
+ /// <summary>
+ /// raise when an error message is received
+ /// </summary>
public event EventHandler<IvyEventArgs> ErrorMessage;
-
+ /// <summary>
+ /// Flag for displaying internal debug message of the protocol intrinsics
+ /// </summary>
public static bool DebugProtocol
{
get
@@ -53,7 +82,10 @@ namespace IvyBus
}
}
-
+ /// <summary>
+ /// Language for the Ivy SendMsg formating default en-US
+ /// ie: send point on float value sent
+ /// </summary>
public CultureInfo Culture
{
get
@@ -92,7 +124,9 @@ namespace IvyBus
}
}
- /// <summary>AppId the Application Unique ID</summary>
+ /// <summary>
+ /// AppId the Application Unique ID
+ /// </summary>
public string AppId
{
@@ -103,7 +137,9 @@ namespace IvyBus
}
-
+ /// <summary>
+ /// the Ivy Protocol version
+ /// </summary>
public int ProtocolVersion
{
get
@@ -113,8 +149,9 @@ namespace IvyBus
}
- /// <summary>IsRunning is the bus Started and connected ?</summary>
-
+ /// <summary>
+ /// IsRunning is the bus Started and connected ?
+ /// </summary>
public bool IsRunning
{
get
@@ -167,6 +204,9 @@ namespace IvyBus
private Thread serverThread; // to ensure quick communication of the end
private AutoResetEvent tcplistener_running;
+ /// <summary>
+ /// the Ivy Assembly version
+ /// </summary>
static public Version Version
{
get { return Assembly.GetExecutingAssembly().GetName().Version; }
@@ -200,7 +240,8 @@ namespace IvyBus
/// <summary>
- /// Initializes a new instance of the <see cref="T:Ivy"/> class.
+ /// Initializes a new instance of the Ivy Bus.
+ /// Readies the structures for the software bus connexion.
/// </summary>
public Ivy()
{
@@ -351,7 +392,10 @@ namespace IvyBus
OnClientRemoveBinding(new IvyEventArgs(clnt, id, clientbind.binding.Expression));
}
- // Autobinding on static method
+ /// <summary>
+ /// Automatic binding on static method of a Type
+ /// </summary>
+ /// <param name="type"></param>
public void BindAttribute(Type type)
{
if (type == null) return;
@@ -374,7 +418,12 @@ namespace IvyBus
}
}
}
- // Autobinding on instance method
+
+
+ /// <summary>
+ /// Autobinding on instance method
+ /// </summary>
+ /// <param name="target"></param>
public void BindAttribute(object target)
{
if (target == null) return;
@@ -398,6 +447,10 @@ namespace IvyBus
}
// Autobinding on IvyBindingAttribute method
+ /// <summary>
+ /// Automatic binding of IvyBindAttribute in an assembly
+ /// </summary>
+ /// <param name="target"></param>
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);
}
+
/// <summary>
/// Send a formated message to someone on the bus
/// </summary>
@@ -673,7 +712,11 @@ namespace IvyBus
return count;
}
- //
+ /// <summary>
+ /// Make a binding to a message using regular expresssion
+ /// </summary>
+ /// <param name="newBinding"></param>
+ /// <returns></returns>
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);
}
+ /// <summary>
+ /// Change a binding already registred
+ /// </summary>
+ /// <param name="id"></param>
+ /// <param name="expression"></param>
+ /// <returns></returns>
public int ChangeMsg(int id, string expression)
{
IvyApplicationBinding newbind;
@@ -1048,7 +1098,10 @@ namespace IvyBus
}
-
+ /// <summary>
+ /// return the first non loopback adress
+ /// on a one network interface machine it will be my IP adresse
+ /// </summary>
public static IPAddress LocalIP
{
get
@@ -1065,7 +1118,11 @@ namespace IvyBus
return returnaddr;
}
}
-
+ /// <summary>
+ /// Get the FDQN Domain from a string
+ /// </summary>
+ /// <param name="domainBus"></param>
+ /// <returns></returns>
public static string GetDomain(string domainBus)
{
#if (PocketPC) // TODO integrate in normal version
@@ -1264,7 +1321,11 @@ namespace IvyBus
}
}
-
+ /// <summary>
+ /// check Validity of Ivy Bus Domain
+ /// </summary>
+ /// <param name="domain"></param>
+ /// <returns></returns>
public static bool ValidatingDomain(string domain)
{
// domain if of the form ip1[:port][,ip2[:port]] with ip of the form n1.n2.n3.n4