summaryrefslogtreecommitdiff
path: root/CSharp/Ivy
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:43:24 +0000
committerfcolin2007-02-01 09:43:24 +0000
commitec0a81c0cfc3bf0a2a7c81163ca8afd378d65c7a (patch)
tree90aad7666aa3d212415210006038a0f5d29ba9a5 /CSharp/Ivy
parent36ba341e1e44da3ec11014643e3b8d32fdb060c8 (diff)
downloadivy-csharp-ec0a81c0cfc3bf0a2a7c81163ca8afd378d65c7a.zip
ivy-csharp-ec0a81c0cfc3bf0a2a7c81163ca8afd378d65c7a.tar.gz
ivy-csharp-ec0a81c0cfc3bf0a2a7c81163ca8afd378d65c7a.tar.bz2
ivy-csharp-ec0a81c0cfc3bf0a2a7c81163ca8afd378d65c7a.tar.xz
Utilisateur : Fcolin Date : 6/02/06 Heure : 16:24 Archivé dans $/CSharp/Ivy/IvyPPC Commentaire: (vss 44)
Diffstat (limited to 'CSharp/Ivy')
-rw-r--r--CSharp/Ivy/Ivy/Ivy.cs60
1 files 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;
/// <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");
}