summaryrefslogtreecommitdiff
path: root/Ivy/Ivy.cs
diff options
context:
space:
mode:
authorfcolin2007-11-09 08:54:21 +0000
committerfcolin2007-11-09 08:54:21 +0000
commit6e9efca5094c57f6322a8b66dcdf556d64dc6077 (patch)
treecff4ee1d422b17fae5521fdc65bf59573fe2a662 /Ivy/Ivy.cs
parentec7f971102797bcc7133ec9ac4c6f7263c6b6d8b (diff)
downloadivy-csharp-6e9efca5094c57f6322a8b66dcdf556d64dc6077.zip
ivy-csharp-6e9efca5094c57f6322a8b66dcdf556d64dc6077.tar.gz
ivy-csharp-6e9efca5094c57f6322a8b66dcdf556d64dc6077.tar.bz2
ivy-csharp-6e9efca5094c57f6322a8b66dcdf556d64dc6077.tar.xz
Diffstat (limited to 'Ivy/Ivy.cs')
-rw-r--r--Ivy/Ivy.cs142
1 files changed, 8 insertions, 134 deletions
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;
-
-
/// <summary> The Main bus Class
/// </summary>
///
-#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<IvyEventArgs> ClientConnected;
- [Description("Occurs when a client discconnect from the bus")]
public event EventHandler<IvyEventArgs> ClientDisconnected;
- [Description("Occurs when a client receive a direct message from another client")]
public event EventHandler<IvyEventArgs> DirectMessageReceived;
- [Description("Occurs when somebody ask for killing every client on the bus")]
public event EventHandler<IvyDieEventArgs> DieReceived;
- [Description("Occurs when a client receive a add binding from another client")]
public event EventHandler<IvyEventArgs> BindingAdd;
- [Description("Occurs when a client receive a remove binding from another client")]
public event EventHandler<IvyEventArgs> BindingRemove;
- [Description("Occurs when a client receive a binding from another client and it as been filtered ")]
public event EventHandler<IvyEventArgs> BindingFilter;
- [Description("Occurs when a client receive a remove binding from another client")]
public event EventHandler<IvyEventArgs> 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
}
/// <summary>IvyClients accesses the list of the connected clients</summary>
-#if (!PocketPC)
- [Browsable(false)]
-#endif
+
public List<IvyClient> IvyClients
{
get
@@ -106,11 +78,6 @@ namespace IvyBus
/// <summary>AppName the application name</summary>
-#if (!PocketPC)
- [Category("Ivy")]
- [Bindable(true)]
-#endif
- [DefaultValue(null)]
public string AppName
{
set
@@ -125,9 +92,6 @@ namespace IvyBus
}
/// <summary>AppId the Application Unique ID</summary>
-#if (!PocketPC)
- [Browsable(false)]
-#endif
public string AppId
{
get
@@ -137,10 +101,7 @@ namespace IvyBus
}
/// <summary>AppPriority the Application Priority: the clients list is sorted against priority</summary>
-#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
/// <summary>IsRunning is the bus Started and connected ?</summary>
-#if (!PocketPC)
- [Browsable(false)]
-#endif
public bool IsRunning
{
get
@@ -190,13 +145,7 @@ 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")]
- [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<string> SentMessageFilter
{
get
@@ -206,43 +155,12 @@ namespace IvyBus
}
/// <summary>ReadyMessage message send when Application receive all the regexp at the connection of the client</summary>
-#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<IvyApplicationBinding> 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<int, IvyApplicationBinding> bindings;
- //TODO should be remove same as above
- private List<IvyApplicationBinding> app_bindings;
private List<IvyClient> clients;
private List<string> sent_messageFilter;
private bool stopped = true;
@@ -301,7 +217,6 @@ namespace IvyBus
#endif
clients = new List<IvyClient>();
bindings = new Dictionary<int, IvyApplicationBinding>();
- app_bindings = new List<IvyApplicationBinding>();
sent_messageFilter = new List<string>();
#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);
- }
+
/// <summary>
/// Readies the structures for the software bus connexion.
/// </summary>
@@ -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