From ec0a81c0cfc3bf0a2a7c81163ca8afd378d65c7a Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 09:43:24 +0000 Subject: Utilisateur : Fcolin Date : 6/02/06 Heure : 16:24 Archivé dans $/CSharp/Ivy/IvyPPC Commentaire: (vss 44) --- CSharp/Ivy/Ivy/Ivy.cs | 60 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs index 7ca7592..c8bf9d2 100644 --- a/CSharp/Ivy/Ivy/Ivy.cs +++ b/CSharp/Ivy/Ivy/Ivy.cs @@ -3,6 +3,8 @@ /// * /// (C) CENA /// * +/// + namespace IvyBus { using System; @@ -20,13 +22,19 @@ namespace IvyBus using System.Text; using System.Reflection; using System.ComponentModel; + using System.Diagnostics; /// The Main bus Class /// /// + + + +#if (!PocketPC) [ToolboxItemFilter("System.Windows.Forms.Form",ToolboxItemFilterType.Allow)] [DesignerCategory("Component")] [Description("IVY Main API")] +#endif public class Ivy : System.ComponentModel.Component { /* Event handler */ @@ -58,10 +66,12 @@ namespace IvyBus /// fires when a client receive a remove binding from another client public event ClientRemoveBindingHandler BindingRemove; +#if (!PocketPC) [Category("Ivy")] [Bindable(true)] [DefaultValue(false)] - public bool Debug +#endif + public bool VerboseDebug { get { @@ -73,7 +83,10 @@ namespace IvyBus } } + +#if (!PocketPC) [Category("Ivy")] +#endif public CultureInfo Culture { get @@ -88,7 +101,10 @@ namespace IvyBus } /// IvyClients accesses the list of the connected clients + +#if (!PocketPC) [Browsable(false)] +#endif public List IvyClients { get @@ -118,9 +134,12 @@ namespace IvyBus } /// AppName the application name + +#if (!PocketPC) [Category("Ivy")] [Bindable(true)] [DefaultValue(null)] +#endif public string AppName { set @@ -134,7 +153,10 @@ namespace IvyBus } /// AppId the Application Unique ID + +#if (!PocketPC) [Browsable(false)] +#endif public string AppId { get @@ -144,8 +166,11 @@ namespace IvyBus } /// AppPriority the Application Priority: the clients list is sorted against priority + +#if (!PocketPC) [Category("Ivy")] [DefaultValue(DEFAULT_PRIORITY)] +#endif public ushort AppPriority { set @@ -166,7 +191,10 @@ namespace IvyBus } } + +#if (!PocketPC) [Browsable(false)] +#endif public int ProtocolVersion { get @@ -178,8 +206,11 @@ namespace IvyBus ///SentMessageClasses the first word token of sent messages /// optimise the parsing process when sending messages /// + +#if (!PocketPC) [Category("Ivy")] [DefaultValue(null)] +#endif public string[] SentMessageClasses { get @@ -193,18 +224,22 @@ namespace IvyBus } /// ReadyMessage message send when Application receive all the regexp at the connection of the client + +#if (!PocketPC) [Category("Ivy")] [Bindable(true)] [DefaultValue(null)] +#endif public string ReadyMessage { get { return ready_message; } set { ready_message = value; } } - - [Category("Ivy")] +#if (!PocketPC) + [CategoryAttibute("Ivy")] [DefaultValue(null)] +#endif public Control SyncControl { get { return syncControl; } @@ -320,8 +355,10 @@ namespace IvyBus foreach (IvyBindingAttribute attr in Attribute.GetCustomAttributes(m, typeof(IvyBindingAttribute))) { //TODO check paramater type MessageHandler - Console.WriteLine("IvyBinding '" + attr.GetExpression(null) + "' to Method " + m.Name); - bindMsg(attr.GetExpression(null), (MessageHandler)Delegate.CreateDelegate(typeof(MessageHandler), m)); + Debug.WriteLine("IvyBinding '" + attr.GetExpression(null) + "' to Method " + m.Name); +#if (!PocketPC) + bindMsg(attr.GetExpression(null), (MessageHandler)Delegate.CreateDelegate(typeof(MessageHandler),m)); +#endif } } } @@ -335,8 +372,10 @@ namespace IvyBus foreach (IvyBindingAttribute attr in Attribute.GetCustomAttributes(m, typeof(IvyBindingAttribute))) { //TODO check paramater type MessageHandler - Console.WriteLine("IvyBinding '" + attr.GetExpression(obj) + "' to Method " + m.Name); + traceDebug("IvyBinding '" + attr.GetExpression(obj) + "' to Method " + m.Name); +#if (!PocketPC) bindMsg(attr.GetExpression(obj), (MessageHandler)Delegate.CreateDelegate(typeof(MessageHandler), obj, m)); +#endif } } @@ -362,6 +401,7 @@ namespace IvyBus try { //IPAddress localaddr = Dns.Resolve(Dns.GetHostName()).AddressList[0]; + //TODO remove ALL reverse DNS search !!!! IPAddress localaddr = Dns.GetHostEntry(Dns.GetHostName()).AddressList[0]; app = new MyTcpListener(IPAddress.Any, 0); app.Start(); @@ -398,11 +438,11 @@ namespace IvyBus // Wait for readyness while ( serverThread.ThreadState != ThreadState.Running || !app.IsActive()) { - traceDebug( " Ivy Threading start in progress..." ); + traceDebug( " Ivy Threading start in progress..." ); Thread.Sleep( 100 ); } #endif - // sends the broadcasts and listen to incoming connexions + // sends the broadcasts and listen to incoming connexions for (int i = 0; i < watchers.Count; i++) { watchers[i].start(); @@ -452,7 +492,7 @@ namespace IvyBus if (stopped) return ; stopped = true; - traceDebug("beginning stopping the bus"); + traceDebug("beginning stopping the bus"); try { // stopping the serverThread @@ -490,7 +530,7 @@ namespace IvyBus } catch (IOException e) { - traceDebug("IOexception Stop "+e.Message); + traceDebug("IOexception Stop " + e.Message); } traceDebug("the bus should have stopped so far"); } -- cgit v1.1