summaryrefslogtreecommitdiff
path: root/CSharp/Ivy/IvyPPC
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:55:04 +0000
committerfcolin2007-02-01 09:55:04 +0000
commit6e3ecf34f1bf10dcfda57a80308ff1fcfccad682 (patch)
treec987fda0122cfde3042fc0d335580a6bd85af632 /CSharp/Ivy/IvyPPC
parentcfdcf876085efaebe90001dcf86b8db46102ebf1 (diff)
downloadivy-csharp-6e3ecf34f1bf10dcfda57a80308ff1fcfccad682.zip
ivy-csharp-6e3ecf34f1bf10dcfda57a80308ff1fcfccad682.tar.gz
ivy-csharp-6e3ecf34f1bf10dcfda57a80308ff1fcfccad682.tar.bz2
ivy-csharp-6e3ecf34f1bf10dcfda57a80308ff1fcfccad682.tar.xz
Utilisateur : Fcolin Date : 13/01/06 Heure : 16:28 Archivé dans $/CSharp/Ivy/Ivy Commentaire: (vss 34)
Diffstat (limited to 'CSharp/Ivy/IvyPPC')
-rw-r--r--CSharp/Ivy/IvyPPC/Ivy.cs29
1 files changed, 26 insertions, 3 deletions
diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs
index d99942b..46ce746 100644
--- a/CSharp/Ivy/IvyPPC/Ivy.cs
+++ b/CSharp/Ivy/IvyPPC/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