summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:43:04 +0000
committerfcolin2007-02-01 09:43:04 +0000
commit565567ff05922cdc26f5b4c7aac1f293853f2c47 (patch)
treee11b0bb2ed0956b421647dd0140c04958f666139
parent9e33528f6a819c037071563dfbadd58afe384589 (diff)
downloadivy-csharp-565567ff05922cdc26f5b4c7aac1f293853f2c47.zip
ivy-csharp-565567ff05922cdc26f5b4c7aac1f293853f2c47.tar.gz
ivy-csharp-565567ff05922cdc26f5b4c7aac1f293853f2c47.tar.bz2
ivy-csharp-565567ff05922cdc26f5b4c7aac1f293853f2c47.tar.xz
Utilisateur : Fcolin Date : 13/01/06 Heure : 16:28 Archivé dans $/CSharp/Ivy/Ivy Commentaire: (vss 34)
-rw-r--r--CSharp/Ivy/Ivy/Ivy.cs29
1 files changed, 26 insertions, 3 deletions
diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs
index d99942b..46ce746 100644
--- a/CSharp/Ivy/Ivy/Ivy.cs
+++ b/CSharp/Ivy/Ivy/Ivy.cs
@@ -18,6 +18,7 @@ namespace IvyBus
using System.Globalization;
using System.Text.RegularExpressions;
using System.Text;
+ using System.Reflection;
/// <summary> The Main bus Class
/// </summary>
@@ -237,12 +238,27 @@ namespace IvyBus
debug = Properties.Settings.Default.IvyDebug;
protocolVersion = Properties.Settings.Default.IvyProtocolVersion;
#endif
+
}
public Ivy(string name, string message, Control sync) :this( name, message )
{
syncControl = sync;
}
-
+ public void AutoBinding(Type type)
+ {
+ //Get instance of the IvyBindingAttribute.
+ foreach (MethodInfo m in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic))
+ {
+ Console.WriteLine("IvyBinding Method " + m.Name);
+ foreach (IvyBindingAttribute attr in Attribute.GetCustomAttributes(m, typeof(IvyBindingAttribute)))
+ {
+ //TODO check paramater type MessageHandler
+ Console.WriteLine("IvyBinding " + attr.Expression);
+ bindMsg(attr.Expression, (MessageHandler)Delegate.CreateDelegate(typeof(MessageHandler), m));
+ }
+ }
+
+ }
/// <summary> connects the Ivy bus to a domain or list of domains.
/// </summary>
/// <remarks>
@@ -481,6 +497,7 @@ namespace IvyBus
/// </returns>
//
// for compatibility raison with old IVY
+ [Obsolete("Will be removed in next version")]
public int bindMsg(string regexp, MessageHandler callback)
{
return bindMsg( regexp, callback, null);
@@ -864,6 +881,12 @@ namespace IvyBus
return domainaddr + ":" + port;
}
}
-
- }
+
+
+ public static bool ValidatingDomain(string p)
+ {
+ // domain if of the form ip1[:port][,ip2[:port]] with ip of the form n1.n2.n3.n4
+ return Regex.IsMatch(p, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+");
+ }
+ }
} \ No newline at end of file