summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:55:24 +0000
committerfcolin2007-02-01 09:55:24 +0000
commit16a209be08cb27b14789a3abb5f88ef855ef2d0c (patch)
tree5249cb49acedfe297988989f72b051dfa685fd4d
parentb69768cba76749320741c42125844d9dc58307be (diff)
downloadivy-csharp-16a209be08cb27b14789a3abb5f88ef855ef2d0c.zip
ivy-csharp-16a209be08cb27b14789a3abb5f88ef855ef2d0c.tar.gz
ivy-csharp-16a209be08cb27b14789a3abb5f88ef855ef2d0c.tar.bz2
ivy-csharp-16a209be08cb27b14789a3abb5f88ef855ef2d0c.tar.xz
Utilisateur : Fcolin Date : 6/02/06 Heure : 16:24 Archivé dans $/CSharp/Ivy/IvyPPC Commentaire: (vss 44)
-rw-r--r--CSharp/Ivy/IvyPPC/Ivy.cs60
1 files changed, 50 insertions, 10 deletions
diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs
index 7ca7592..c8bf9d2 100644
--- a/CSharp/Ivy/IvyPPC/Ivy.cs
+++ b/CSharp/Ivy/IvyPPC/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;
/// <summary> The Main bus Class
/// </summary>
///
+
+
+
+#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
/// <summary>fires when a client receive a remove binding from another client</summary>
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
}
/// <summary>IvyClients accesses the list of the connected clients</summary>
+
+#if (!PocketPC)
[Browsable(false)]
+#endif
public List<IvyClient> IvyClients
{
get
@@ -118,9 +134,12 @@ namespace IvyBus
}
/// <summary>AppName the application name</summary>
+
+#if (!PocketPC)
[Category("Ivy")]
[Bindable(true)]
[DefaultValue(null)]
+#endif
public string AppName
{
set
@@ -134,7 +153,10 @@ namespace IvyBus
}
/// <summary>AppId the Application Unique ID</summary>
+
+#if (!PocketPC)
[Browsable(false)]
+#endif
public string AppId
{
get
@@ -144,8 +166,11 @@ namespace IvyBus
}
/// <summary>AppPriority the Application Priority: the clients list is sorted against priority</summary>
+
+#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
///<summary>SentMessageClasses the first word token of sent messages
///<remarks> optimise the parsing process when sending messages </remarks>
///</summary>
+
+#if (!PocketPC)
[Category("Ivy")]
[DefaultValue(null)]
+#endif
public string[] SentMessageClasses
{
get
@@ -193,18 +224,22 @@ namespace IvyBus
}
/// <summary>ReadyMessage message send when Application receive all the regexp at the connection of the client</summary>
+
+#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");
}