From 6e9efca5094c57f6322a8b66dcdf556d64dc6077 Mon Sep 17 00:00:00 2001
From: fcolin
Date: Fri, 9 Nov 2007 08:54:21 +0000
Subject:
---
Ivy/Ivy.cs | 142 ++++---------------------------------------------------------
1 file changed, 8 insertions(+), 134 deletions(-)
(limited to 'Ivy/Ivy.cs')
diff --git a/Ivy/Ivy.cs b/Ivy/Ivy.cs
index d8e84ce..14a3918 100644
--- a/Ivy/Ivy.cs
+++ b/Ivy/Ivy.cs
@@ -20,49 +20,25 @@ namespace IvyBus
using System.Text.RegularExpressions;
using System.Text;
using System.Reflection;
- using System.ComponentModel;
using System.Diagnostics;
-#if (!PocketPC)
- using System.ComponentModel.Design;
-#endif
-// using System.Drawing.Design;
-
-
/// The Main bus Class
///
///
-#if (!PocketPC)
- // Show this property in the property grid.
- [ToolboxItemFilter("System.Windows.Forms.Form", ToolboxItemFilterType.Allow)]
- [Description("IVY Main API")]
-#endif
- [DesignerCategory("Component")]
- public class Ivy : System.ComponentModel.Component, ISupportInitialize
+
+ public class Ivy
{
/* Event */
- [Description("Occurs when a new client connect to the bus")]
public event EventHandler ClientConnected;
- [Description("Occurs when a client discconnect from the bus")]
public event EventHandler ClientDisconnected;
- [Description("Occurs when a client receive a direct message from another client")]
public event EventHandler DirectMessageReceived;
- [Description("Occurs when somebody ask for killing every client on the bus")]
public event EventHandler DieReceived;
- [Description("Occurs when a client receive a add binding from another client")]
public event EventHandler BindingAdd;
- [Description("Occurs when a client receive a remove binding from another client")]
public event EventHandler BindingRemove;
- [Description("Occurs when a client receive a binding from another client and it as been filtered ")]
public event EventHandler BindingFilter;
- [Description("Occurs when a client receive a remove binding from another client")]
public event EventHandler ErrorMessage;
-#if (!PocketPC)
- [Bindable(true)]
- [Category("Ivy")]
-#endif
- [DefaultValue(false)]
+
public static bool DebugProtocol
{
get
@@ -75,9 +51,7 @@ namespace IvyBus
}
}
-#if (!PocketPC)
- [Category("Ivy")]
-#endif
+
public CultureInfo Culture
{
get
@@ -92,9 +66,7 @@ namespace IvyBus
}
/// IvyClients accesses the list of the connected clients
-#if (!PocketPC)
- [Browsable(false)]
-#endif
+
public List IvyClients
{
get
@@ -106,11 +78,6 @@ namespace IvyBus
/// AppName the application name
-#if (!PocketPC)
- [Category("Ivy")]
- [Bindable(true)]
-#endif
- [DefaultValue(null)]
public string AppName
{
set
@@ -125,9 +92,6 @@ namespace IvyBus
}
/// AppId the Application Unique ID
-#if (!PocketPC)
- [Browsable(false)]
-#endif
public string AppId
{
get
@@ -137,10 +101,7 @@ namespace IvyBus
}
/// AppPriority the Application Priority: the clients list is sorted against priority
-#if (!PocketPC)
- [Category("Ivy")]
-#endif
- [DefaultValue(DEFAULT_PRIORITY)]
+
public ushort AppPriority
{
set
@@ -162,9 +123,6 @@ namespace IvyBus
}
-#if (!PocketPC)
- [Browsable(false)]
-#endif
public int ProtocolVersion
{
get
@@ -176,9 +134,6 @@ namespace IvyBus
/// IsRunning is the bus Started and connected ?
-#if (!PocketPC)
- [Browsable(false)]
-#endif
public bool IsRunning
{
get
@@ -190,13 +145,7 @@ namespace IvyBus
///SentMessageClasses the first word token of sent messages
/// optimise the parsing process when sending messages
///
-#if (!PocketPC)
- [Category("Ivy")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- // sinon bug System.String constructor not found !
- [Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design", "System.Drawing.Design.UITypeEditor, System.Drawing")]
-#endif
public List SentMessageFilter
{
get
@@ -206,43 +155,12 @@ namespace IvyBus
}
/// ReadyMessage message send when Application receive all the regexp at the connection of the client
-#if (!PocketPC)
- [Bindable(true)]
- [Category("Ivy")]
-#endif
- [DefaultValue(null)]
public string ReadyMessage
{
get { return ready_message; }
set { ready_message = value; }
}
-
-
-
-#if (PocketPC)
-#if (!PocketPC)
- [Category("Ivy")]
-#endif
- [DefaultValue(null)]
- public System.Windows.Forms.ContainerControl ContainerControl
- {
- get { return parentControl; }
- set
- {
- parentControl = value;
- }
- }
-#endif
-#if (!PocketPC)
- [Category("Ivy")]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
-#endif
- public List Bindings
- {
- get { return app_bindings; }
- }
-
internal class MyTcpListener : TcpListener
{
public MyTcpListener(IPAddress address, int port)
@@ -259,7 +177,7 @@ namespace IvyBus
/// the port for the UDP rendez vous, if none is supplied
internal const ushort DEFAULT_PORT = 2010;
// client default priority
- internal const ushort DEFAULT_PRIORITY = 100;
+ public const ushort DEFAULT_PRIORITY = 100;
/// the domain for the UDP rendez vous
private static readonly string DEFAULT_DOMAIN = "127.255.255.255:" + DEFAULT_PORT;
internal int protocolVersion = 3;
@@ -270,8 +188,6 @@ namespace IvyBus
private volatile Thread serverThread; // to ensure quick communication of the end
internal Dictionary bindings;
- //TODO should be remove same as above
- private List app_bindings;
private List clients;
private List sent_messageFilter;
private bool stopped = true;
@@ -301,7 +217,6 @@ namespace IvyBus
#endif
clients = new List();
bindings = new Dictionary();
- app_bindings = new List();
sent_messageFilter = new List();
#if (!PocketPC)
debugProtocol = Properties.Settings.Default.IvyDebug;
@@ -317,16 +232,7 @@ namespace IvyBus
if ( assembly != this.GetType().Assembly )
BindAttibute(assembly);
}
- public Ivy(IContainer container)
- : this()
- {
- container.Add(this);
- // get binding from Attribute IvyBinding
- //TODO Autobinding attribute
- Assembly assembly = Assembly.GetCallingAssembly();
- if (assembly != this.GetType().Assembly)
- BindAttibute(assembly);
- }
+
///
/// Readies the structures for the software bus connexion.
///
@@ -362,20 +268,6 @@ namespace IvyBus
BindAttibute(assembly);
}
- protected override void Dispose(bool disposing)
- {
- try
- {
- if (disposing)
- {
- Stop();
- }
- }
- finally
- {
- base.Dispose(disposing);
- }
- }
// Autobinding on static method
public void BindAttibute(Type type)
@@ -1163,23 +1055,5 @@ namespace IvyBus
return Regex.IsMatch(p, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+");
}
- #region ISupportInitialize Members
-
- public void BeginInit()
- {
-
- }
-
- public void EndInit()
- {
- // TODO ugly should be added directly the bindings Dictionary !
- foreach (IvyApplicationBinding bind in app_bindings)
- {
- BindMsg(bind);
- }
- }
-
- #endregion
-
}
}
\ No newline at end of file
--
cgit v1.1