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 ++---------------------------------- Ivy/Ivy.csproj | 31 +------- Ivy/IvyApplicationBinding.cs | 50 ++----------- Ivy/Properties/AssemblyInfo.cs | 2 +- Ivy/Properties/Settings.Designer.cs | 8 +- 5 files changed, 23 insertions(+), 210 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; - - /// 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 diff --git a/Ivy/Ivy.csproj b/Ivy/Ivy.csproj index 1944b08..4977434 100644 --- a/Ivy/Ivy.csproj +++ b/Ivy/Ivy.csproj @@ -14,9 +14,8 @@ - Ivy - - + IvyBus.Ivy + IvySignKey.pfx JScript Grid IE50 @@ -30,6 +29,7 @@ + true bin\Debug\ @@ -108,29 +108,12 @@ System - - System.Design - - - - System.Management - - - System.Windows.Forms - - Component - - UserControl - - - IvyDomain.cs - @@ -139,7 +122,6 @@ Code - Component Code @@ -168,17 +150,12 @@ + SettingsSingleFileGenerator Settings.Designer.cs - - - Designer - IvyDomain.cs - - diff --git a/Ivy/IvyApplicationBinding.cs b/Ivy/IvyApplicationBinding.cs index 9183850..299f459 100644 --- a/Ivy/IvyApplicationBinding.cs +++ b/Ivy/IvyApplicationBinding.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; -using System.ComponentModel; using System.Threading; namespace IvyBus @@ -10,19 +9,11 @@ namespace IvyBus /* This is the Application side of binding storage */ /* association of a generated Key and a delegate and the expression */ /* this is SEND to other client */ -#if (!PocketPC) - [PropertyTab(typeof(System.Windows.Forms.Design.EventsTab), PropertyTabScope.Component)] - [DefaultEvent("Callback")] -#endif - [DesignerCategory("Component")] - [DesignTimeVisible(false)] /* should be added via Ivy component */ - public class IvyApplicationBinding : System.ComponentModel.Component + + public class IvyApplicationBinding { private BindingType binding; -#if (!PocketPC) - [Category("Ivy")] -#endif public BindingType Binding { get { return binding; } @@ -30,10 +21,7 @@ namespace IvyBus } private ushort key; - #if (!PocketPC) - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] -#endif + public ushort Key { get { return key; } @@ -41,20 +29,14 @@ namespace IvyBus } private object[] args; -#if (!PocketPC) - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] -#endif + public object[] Args { get { return args; } set { args = value; } } private string expression; -#if (!PocketPC) - [Category("Ivy")] -#endif - [DefaultValue(null)] + public string Expression { get { return expression; } @@ -74,19 +56,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, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", - "System.Drawing.Design.UITypeEditor,System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" - )] - - [Description("Arguments used when formating the expression")] -#endif public List Arguments { get @@ -95,21 +65,13 @@ namespace IvyBus } } -#if (!PocketPC) - [Category("Ivy")] - [Description("Event fired when Message Matching expression received")] -#endif public event EventHandler Callback; public IvyApplicationBinding() { arguments = new List(); } - public IvyApplicationBinding(IContainer container) - : this() - { - container.Add(this); - } + // translate part of expression to object property public void FormatExpression() { diff --git a/Ivy/Properties/AssemblyInfo.cs b/Ivy/Properties/AssemblyInfo.cs index a3ce834..96176ce 100644 --- a/Ivy/Properties/AssemblyInfo.cs +++ b/Ivy/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("Ivy")] [assembly: AssemblyDescription("Dll de communications sur le bus IVY")] -[assembly: AssemblyCompany("DTI/SDER PII")] +[assembly: AssemblyCompany("DTI/R&D PII")] [assembly: AssemblyProduct("Ivy")] [assembly: AssemblyCopyright("SDER")] [assembly: AssemblyTrademark("")] diff --git a/Ivy/Properties/Settings.Designer.cs b/Ivy/Properties/Settings.Designer.cs index 96b0f2d..3356385 100644 --- a/Ivy/Properties/Settings.Designer.cs +++ b/Ivy/Properties/Settings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:2.0.50727.42 +// Ce code a été généré par un outil. +// Version du runtime :2.0.50727.312 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si +// le code est régénéré. // //------------------------------------------------------------------------------ -- cgit v1.1