From cbf0054b86c62894dd49d4465ace40b69b3b8df0 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 12:07:02 +0000 Subject: modification structure svn --- IvyProbeConsole/App.ico | Bin 0 -> 1078 bytes IvyProbeConsole/IvyProbeConsole.cs | 373 +++++++++++++++++++++ IvyProbeConsole/IvyProbeConsole.csproj | 158 +++++++++ IvyProbeConsole/IvyProbeConsole.csproj.vspscc | 10 + IvyProbeConsole/IvyProbe_TemporaryKey.pfx | Bin 0 -> 1676 bytes IvyProbeConsole/Properties/AssemblyInfo.cs | 59 ++++ IvyProbeConsole/Properties/Settings.Designer.cs | 71 ++++ IvyProbeConsole/Properties/Settings.settings | 21 ++ IvyProbeConsole/Properties/app.manifest | 11 + IvyProbeConsole/Settings.cs | 28 ++ IvyProbeConsole/app.config | 27 ++ IvyToDel/IvyProbeConsole/App.ico | Bin 1078 -> 0 bytes IvyToDel/IvyProbeConsole/IvyProbeConsole.cs | 373 --------------------- IvyToDel/IvyProbeConsole/IvyProbeConsole.csproj | 158 --------- .../IvyProbeConsole/IvyProbeConsole.csproj.vspscc | 10 - IvyToDel/IvyProbeConsole/IvyProbe_TemporaryKey.pfx | Bin 1676 -> 0 bytes .../IvyProbeConsole/Properties/AssemblyInfo.cs | 59 ---- .../Properties/Settings.Designer.cs | 71 ---- .../IvyProbeConsole/Properties/Settings.settings | 21 -- IvyToDel/IvyProbeConsole/Properties/app.manifest | 11 - IvyToDel/IvyProbeConsole/Settings.cs | 28 -- IvyToDel/IvyProbeConsole/app.config | 27 -- 22 files changed, 758 insertions(+), 758 deletions(-) create mode 100644 IvyProbeConsole/App.ico create mode 100644 IvyProbeConsole/IvyProbeConsole.cs create mode 100644 IvyProbeConsole/IvyProbeConsole.csproj create mode 100644 IvyProbeConsole/IvyProbeConsole.csproj.vspscc create mode 100644 IvyProbeConsole/IvyProbe_TemporaryKey.pfx create mode 100644 IvyProbeConsole/Properties/AssemblyInfo.cs create mode 100644 IvyProbeConsole/Properties/Settings.Designer.cs create mode 100644 IvyProbeConsole/Properties/Settings.settings create mode 100644 IvyProbeConsole/Properties/app.manifest create mode 100644 IvyProbeConsole/Settings.cs create mode 100644 IvyProbeConsole/app.config delete mode 100644 IvyToDel/IvyProbeConsole/App.ico delete mode 100644 IvyToDel/IvyProbeConsole/IvyProbeConsole.cs delete mode 100644 IvyToDel/IvyProbeConsole/IvyProbeConsole.csproj delete mode 100644 IvyToDel/IvyProbeConsole/IvyProbeConsole.csproj.vspscc delete mode 100644 IvyToDel/IvyProbeConsole/IvyProbe_TemporaryKey.pfx delete mode 100644 IvyToDel/IvyProbeConsole/Properties/AssemblyInfo.cs delete mode 100644 IvyToDel/IvyProbeConsole/Properties/Settings.Designer.cs delete mode 100644 IvyToDel/IvyProbeConsole/Properties/Settings.settings delete mode 100644 IvyToDel/IvyProbeConsole/Properties/app.manifest delete mode 100644 IvyToDel/IvyProbeConsole/Settings.cs delete mode 100644 IvyToDel/IvyProbeConsole/app.config diff --git a/IvyProbeConsole/App.ico b/IvyProbeConsole/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/IvyProbeConsole/App.ico differ diff --git a/IvyProbeConsole/IvyProbeConsole.cs b/IvyProbeConsole/IvyProbeConsole.cs new file mode 100644 index 0000000..516d702 --- /dev/null +++ b/IvyProbeConsole/IvyProbeConsole.cs @@ -0,0 +1,373 @@ +/// François-Régis Colin +/// http://www.tls.cena.fr/products/ivy/ +/// * +/// (C) CENA +/// * +namespace IvyProbeConsole +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Text.RegularExpressions; + using System.IO; + using System.Configuration; + using System.Diagnostics; + using IvyBus; + using Gnu; + + /// Console implementation of the ivyprobe test program. + /// + /// Mainly used for testing and debugging purpose + public class IvyProbeConsole + { + public virtual bool ExitOnDie + { + set + { + exitOnDie = value; + } + + } + public void BindFromFile(string name) + { + string line; + try + { + FileStream file = new FileStream(name, FileMode.Open, FileAccess.Read); + TextReader reader = new StreamReader(file); + while ((line = reader.ReadLine()) != null) + { + bus.BindMsg(line, receive); + } + } + catch (FileNotFoundException e) + { + Console.WriteLine(e.Message); + } + } + public const string helpCommands = + "Available commands:\n"+ + ".die CLIENTNAME sends a die message\n" + + ".direct CLIENTNAME ID MESSAGE sends the direct message to the client, with a message id set to the numerical ID\n" + + ".bye quits the application\n" + + ".quit idem\n" + + ".list lists the available clients\n" + + ".ping sends a ping request if IVY_PING is enabled\n" + + ".bind REGEXP binds to a regexp at runtime\n" + + ".unbind REGEXP unbinds to a regexp at runtime"; + + public const String helpmsg = + "usage: IvyProbe [options] [regexp]\n" + + "\t-b BUS\tspecifies the Ivy bus domain\n" + + "\t-n ivyname (default JPROBE)\n" + + "\t-q\tquiet, no tty output\n" + + "\t-d\tdebug\n" + + "\t-t\ttime stamp each message\n" + + "\t-h\thelp\n\n" + + "\t regexp is a Perl5 compatible regular expression"; + + private TextReader in_Renamed; + private volatile Thread looperThread; + private Ivy bus; + private bool timestamp, quiet, debug, exitOnDie = false; + enum Command { + direct, + die, + unbind, + bind, + ping, + quit, + bye, + list, + help}; + const string reg_parse = + @"^\.(?direct) (?[^ ]*) (?[0-9]+) (?.*)$|" + + @"^\.(?die) (?.*)$|" + + @"^\.(?unbind) (?.*)$|" + + @"^\.(?bind) (?.*)$|" + + @"^\.(?ping) (?.*)$|" + + @"^\.(?quit)$|" + + @"^\.(?bye)$|" + + @"^\.(?list)$|" + + @"^\.(?help)$|"; + private Regex cmd_regexp; + + [STAThread] + public static void Main(String[] args) + { + string name = "C#PROBE"; + string fname = null; + bool quiet = false; + bool timestamp = false; + string domain = Ivy.GetDomain(null); + bool debug = false; + + domain = Properties.Settings.Default.domain; + name = Properties.Settings.Default.name; + quiet = Properties.Settings.Default.quiet; + timestamp = Properties.Settings.Default.timestamp; + debug = Properties.Settings.Default.IvyDebug; + + + GetOpt opt = new GetOpt(args, "f:n:b:dqht"); + Arg a; + while ((a = opt.NextArg()) != null) + { + switch (a.Flag) + { + case 'd': + debug = true; + break; + + case 'b': + domain = a.Parameter; + break; + + case 'n': + name = a.Parameter; + break; + case 'f': + fname = a.Parameter; + break; + + case 'q': + quiet = true; + break; + + case 't': + timestamp = true; + break; + + case 'h': default: + System.Console.Out.WriteLine(helpmsg); + System.Environment.Exit(0); + break; + + } + } + + + IvyProbeConsole p = new IvyProbeConsole(System.Console.In, timestamp, quiet, debug ); + p.ExitOnDie = true; + Ivy bus = new Ivy(name, name + " ready"); + p.start(bus); + + if (fname != null) + p.BindFromFile(fname); + + foreach(string ex in opt.Extras) + { + if (!quiet) + System.Console.Out.WriteLine("you want to subscribe to " + ex); + bus.BindMsg(ex, p.receive); + } + + if (!quiet) + System.Console.Out.WriteLine(Ivy.Domains(domain)); + + bus.Start(domain); + + } + + + + + public IvyProbeConsole(TextReader in_Renamed, bool timestamp, bool quiet, bool debug) + { + this.in_Renamed = in_Renamed; + this.timestamp = timestamp; + this.quiet = quiet; + this.debug = debug; + try + { + cmd_regexp = new Regex(reg_parse, RegexOptions.IgnoreCase); + } + catch (ArgumentException ree) + { + System.Console.Error.WriteLine("Regexp fatal error in the Probe program."); + System.Console.Error.WriteLine(ree.StackTrace); + System.Environment.Exit(0); + } + } + + public virtual void start(Ivy bus) + { + if (looperThread != null) + throw new IvyException("Probe already started"); + this.bus = bus; + + bus.ClientConnected += connect; + bus.ClientDisconnected += disconnect; + bus.DieReceived += die ; + bus.DirectMessageReceived += directMessage; + bus.BindingAdd += new EventHandler(bus_BindingAdd); + bus.BindingRemove += new EventHandler(bus_BindingRemove); + bus.BindingFilter += new EventHandler(bus_BindingFilter); + + looperThread = new Thread(new ThreadStart(Run)); + looperThread.Name = "Keyboard Input Thread"; + looperThread.Start(); + } + + void bus_BindingFilter(object sender, IvyEventArgs e) + { + println("filtred regexp {0} from {1}", e.Argument, e.Client.ApplicationName); + } + + void bus_BindingRemove(object sender, IvyEventArgs e) + { + println("Removed regexp {0} from {1}", e.Argument, e.Client.ApplicationName); + } + + void bus_BindingAdd(object sender, IvyEventArgs e) + { + println("Added regexp {0} from {1}", e.Argument, e.Client.ApplicationName); + } + + + public void Run() + { + traceDebug("Thread started"); + Thread thisThread = Thread.CurrentThread; + String s; + // "infinite" loop on keyboard input + while (looperThread == thisThread) + { + s = in_Renamed.ReadLine(); + if (s == null) + break; + if (s.Length == 0) continue; + if ( s.StartsWith( ".") ) + parseCommand(s); + else + { + println("-> Sent to " + bus.SendMsg(s) + " peers"); + } + } + println("End of input. Good bye !"); + bus.Stop(); + traceDebug("Probe Thread stopped"); + } + + internal void parseCommand(string s) + { + Match result; + traceDebug("parsing the [" + s + "] (length " + s.Length + ") string"); + + result = cmd_regexp.Match(s); + + + if (result.Success) + { + string cmd = result.Groups["cmd"].Value; + string target; + try + { + Command TheCommand = (Command)Enum.Parse(typeof(Command), cmd); + + switch ( TheCommand ) + { + case Command.direct: + { + target = result.Groups["target"].Value; + ushort id = ushort.Parse(result.Groups["id"].Value); + string message = result.Groups["message"].Value; + List v = bus.GetClientsByName(target); + if (v.Count == 0) + println("no Ivy client with the name \"" + target + "\""); + for (int i = 0; i < v.Count; i++) + v[i].SendDirectMsg(id, message); + } + break; + case Command.die: + target = result.Groups["target"].Value; + if (bus.Die(target, ".die command") == 0) + println("no Ivy client with the name \"" + target + "\""); + break; + case Command.unbind: + target = result.Groups["target"].Value; + if (bus.UnbindMsg(target)) + println("you want to unsubscribe to " + target); + else + println("you can't unsubscribe to " + target + ", your're not subscribed to it"); + break; + case Command.bind: + target = result.Groups["target"].Value; + println("you want to subscribe to " + target); + bus.BindMsg(target, receive); + break; + case Command.ping: + target = result.Groups["target"].Value; + if (bus.Ping(target, "test") == 0) + println("no Ivy client with the name \"" + target + "\""); + break; + case Command.quit: + case Command.bye: + bus.Stop(); + System.Environment.Exit(0); + break; + case Command.list: + println(bus.IvyClients.Count + " clients on the bus"); + foreach (IvyClient client in bus.IvyClients ) + println("-> " + client.ApplicationName); + break; + case Command.help: + println(helpCommands); + break; + } + } + catch (ArgumentException) + { + Console.WriteLine("manque de la commande dans l'enum"); + } + } + + } + // parseCommand + + private void connect(object sender, IvyEventArgs e) + { + println(e.Client.ApplicationName + " connected from "+e.Client.RemoteAddress+":"+e.Client.RemotePort); + } + + private void disconnect(object sender, IvyEventArgs e) + { + println(e.Client.ApplicationName + " disconnected "); + } + + private void die(object sender, IvyDieEventArgs e) + { + println("received die msg from " + e.Client.ApplicationName + " good bye cause: "+e.Argument); + /* I cannot stop the readLine(), because it is native code */ + if (exitOnDie) + System.Environment.Exit(0); + } + + private void directMessage(object sender, IvyEventArgs e) + { + println(e.Client.ApplicationName + " direct Message " + e.Id + e.Argument); + } + + private void receive(object sender, IvyMessageEventArgs e) + { + String s = e.Client.ApplicationName + " sent "; + s += string.Join(",", e.Arguments); + println(s); + } + [Conditional("DEBUG")] + private void traceDebug(String s) + { + Trace.WriteLineIf(debug, "-->Probe<-- " + s); + } + private void println(string format, params object[] args) + { + if (!quiet) + { + if (timestamp) System.Console.Out.Write(string.Format("[ {0|HH:mm:ss.fff} ]",System.DateTime.Now )); + System.Console.Out.WriteLine(string.Format(format,args)); + } + } + + } +} \ No newline at end of file diff --git a/IvyProbeConsole/IvyProbeConsole.csproj b/IvyProbeConsole/IvyProbeConsole.csproj new file mode 100644 index 0000000..4551387 --- /dev/null +++ b/IvyProbeConsole/IvyProbeConsole.csproj @@ -0,0 +1,158 @@ + + + Local + 8.0.50727 + 2.0 + {19023DE7-AAD8-4EC4-8FAF-D793868F8861} + SAK + SAK + SAK + SAK + Debug + AnyCPU + App.ico + + + IvyProbeConsole + + + JScript + Grid + IE50 + false + Exe + IvyProbeConsole + OnBuildSuccess + + + + + + + true + 85867DC3A6B10DFCF74BB49E782A1BC517B0086D + IvyProbe_TemporaryKey.pfx + true + true + LocalIntranet + \\samba\fcolin\public_html\ClickOnce\IvyProbeConsole\ + true + Web + false + Foreground + 7 + Days + false + false + true + http://www.tls.cena.fr/~fcolin/ClickOnce/IvyProbeConsole/ + 1.0.0.%2a + true + + + bin\Debug\ + false + 285212672 + false + + + DEBUG;TRACE + + + true + 4096 + false + + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + + TRACE + + + false + 4096 + false + + + true + false + false + false + 4 + none + prompt + + + + System + + + + System.Data + + + System.XML + + + + + + Code + + + Code + + + True + True + Settings.settings + + + + + + False + .NET Framework 2.0 + true + + + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {228B5F0B-31AE-488F-A916-B7CBB269D25F} + getopt + + + {F2F03CF7-0087-4EDB-AD15-80C9E8DA2617} + Ivy + + + + + + + + + + \ No newline at end of file diff --git a/IvyProbeConsole/IvyProbeConsole.csproj.vspscc b/IvyProbeConsole/IvyProbeConsole.csproj.vspscc new file mode 100644 index 0000000..62ab500 --- /dev/null +++ b/IvyProbeConsole/IvyProbeConsole.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "relative:IvyProbe" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/IvyProbeConsole/IvyProbe_TemporaryKey.pfx b/IvyProbeConsole/IvyProbe_TemporaryKey.pfx new file mode 100644 index 0000000..0aaa160 Binary files /dev/null and b/IvyProbeConsole/IvyProbe_TemporaryKey.pfx differ diff --git a/IvyProbeConsole/Properties/AssemblyInfo.cs b/IvyProbeConsole/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2661a2b --- /dev/null +++ b/IvyProbeConsole/Properties/AssemblyInfo.cs @@ -0,0 +1,59 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// Les informations générales relatives à un assembly dépendent de +// l'ensemble d'attributs suivant. Pour modifier les informations +// associées à un assembly, changez les valeurs de ces attributs. +// +[assembly: AssemblyTitle("IvyProbeConsole")] +[assembly: AssemblyDescription("IvyProbe Console mode")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("DTI/SDER")] +[assembly: AssemblyProduct("Ivy")] +[assembly: AssemblyCopyright("DTI/SDER 205")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Les informations de version pour un assembly se composent des quatre valeurs suivantes : +// +// Version principale +// Version secondaire +// Numéro de build +// Révision +// +// Vous pouvez spécifier toutes les valeurs ou indiquer des numéros de révision et de build par défaut +// en utilisant '*', comme ci-dessous : + +[assembly: AssemblyVersion("2.0.*")] + +// +// Pour signer votre assembly, vous devez spécifier la clé à utiliser. Consultez +// la documentation Microsoft .NET Framework pour plus d'informations sur la signature d'un assembly. +// +// Utilisez les attributs ci-dessous pour contrôler la clé utilisée lors de la signature. +// +// Remarques : +// (*) Si aucune clé n'est spécifiée, l'assembly n'est pas signé. +// (*) KeyName fait référence à une clé installée dans le fournisseur de +// services cryptographiques (CSP) de votre ordinateur. KeyFile fait référence à un fichier qui contient +// une clé. +// (*) Si les valeurs de KeyFile et de KeyName sont spécifiées, le +// traitement suivant se produit : +// (1) Si KeyName se trouve dans le CSP, la clé est utilisée. +// (2) Si KeyName n'existe pas mais que KeyFile existe, la clé +// de KeyFile est installée dans le CSP et utilisée. +// (*) Pour créer KeyFile, vous pouvez utiliser l'utilitaire sn.exe (Strong Name, Nom fort). +// Lors de la spécification de KeyFile, son emplacement doit être +// relatif au répertoire de sortie du projet qui est +// %Project Directory%\obj\. Par exemple, si votre KeyFile se trouve +// dans le répertoire du projet, vous devez spécifier l'attribut +// AssemblyKeyFile sous la forme [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) DelaySign (signature différée) est une option avancée. Pour plus d'informations, consultez la +// documentation Microsoft .NET Framework. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] +[assembly: AssemblyFileVersionAttribute("1.0.0.0")] diff --git a/IvyProbeConsole/Properties/Settings.Designer.cs b/IvyProbeConsole/Properties/Settings.Designer.cs new file mode 100644 index 0000000..4d05e34 --- /dev/null +++ b/IvyProbeConsole/Properties/Settings.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace IvyProbeConsole.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string domain { + get { + return ((string)(this["domain"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("C#ProbeConsole")] + public string name { + get { + return ((string)(this["name"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool quiet { + get { + return ((bool)(this["quiet"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool timestamp { + get { + return ((bool)(this["timestamp"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool IvyDebug { + get { + return ((bool)(this["IvyDebug"])); + } + } + } +} diff --git a/IvyProbeConsole/Properties/Settings.settings b/IvyProbeConsole/Properties/Settings.settings new file mode 100644 index 0000000..b0c75fd --- /dev/null +++ b/IvyProbeConsole/Properties/Settings.settings @@ -0,0 +1,21 @@ + + + + + + + + + C#ProbeConsole + + + False + + + False + + + False + + + \ No newline at end of file diff --git a/IvyProbeConsole/Properties/app.manifest b/IvyProbeConsole/Properties/app.manifest new file mode 100644 index 0000000..ec82d19 --- /dev/null +++ b/IvyProbeConsole/Properties/app.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/IvyProbeConsole/Settings.cs b/IvyProbeConsole/Settings.cs new file mode 100644 index 0000000..e0f5232 --- /dev/null +++ b/IvyProbeConsole/Settings.cs @@ -0,0 +1,28 @@ +namespace IvyProbeConsole.Properties { + + + // This class allows you to handle specific events on the settings class: + // The SettingChanging event is raised before a setting's value is changed. + // The PropertyChanged event is raised after a setting's value is changed. + // The SettingsLoaded event is raised after the setting values are loaded. + // The SettingsSaving event is raised before the setting values are saved. + internal sealed partial class Settings { + + public Settings() { + // // To add event handlers for saving and changing settings, uncomment the lines below: + // + // this.SettingChanging += this.SettingChangingEventHandler; + // + // this.SettingsSaving += this.SettingsSavingEventHandler; + // + } + + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { + // Add code to handle the SettingChangingEvent event here. + } + + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { + // Add code to handle the SettingsSaving event here. + } + } +} diff --git a/IvyProbeConsole/app.config b/IvyProbeConsole/app.config new file mode 100644 index 0000000..fef7919 --- /dev/null +++ b/IvyProbeConsole/app.config @@ -0,0 +1,27 @@ + + + + +
+ + + + + + + + + C#ProbeConsole + + + False + + + False + + + False + + + + \ No newline at end of file diff --git a/IvyToDel/IvyProbeConsole/App.ico b/IvyToDel/IvyProbeConsole/App.ico deleted file mode 100644 index 3a5525f..0000000 Binary files a/IvyToDel/IvyProbeConsole/App.ico and /dev/null differ diff --git a/IvyToDel/IvyProbeConsole/IvyProbeConsole.cs b/IvyToDel/IvyProbeConsole/IvyProbeConsole.cs deleted file mode 100644 index 516d702..0000000 --- a/IvyToDel/IvyProbeConsole/IvyProbeConsole.cs +++ /dev/null @@ -1,373 +0,0 @@ -/// François-Régis Colin -/// http://www.tls.cena.fr/products/ivy/ -/// * -/// (C) CENA -/// * -namespace IvyProbeConsole -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Text.RegularExpressions; - using System.IO; - using System.Configuration; - using System.Diagnostics; - using IvyBus; - using Gnu; - - /// Console implementation of the ivyprobe test program. - /// - /// Mainly used for testing and debugging purpose - public class IvyProbeConsole - { - public virtual bool ExitOnDie - { - set - { - exitOnDie = value; - } - - } - public void BindFromFile(string name) - { - string line; - try - { - FileStream file = new FileStream(name, FileMode.Open, FileAccess.Read); - TextReader reader = new StreamReader(file); - while ((line = reader.ReadLine()) != null) - { - bus.BindMsg(line, receive); - } - } - catch (FileNotFoundException e) - { - Console.WriteLine(e.Message); - } - } - public const string helpCommands = - "Available commands:\n"+ - ".die CLIENTNAME sends a die message\n" + - ".direct CLIENTNAME ID MESSAGE sends the direct message to the client, with a message id set to the numerical ID\n" + - ".bye quits the application\n" + - ".quit idem\n" + - ".list lists the available clients\n" + - ".ping sends a ping request if IVY_PING is enabled\n" + - ".bind REGEXP binds to a regexp at runtime\n" + - ".unbind REGEXP unbinds to a regexp at runtime"; - - public const String helpmsg = - "usage: IvyProbe [options] [regexp]\n" + - "\t-b BUS\tspecifies the Ivy bus domain\n" + - "\t-n ivyname (default JPROBE)\n" + - "\t-q\tquiet, no tty output\n" + - "\t-d\tdebug\n" + - "\t-t\ttime stamp each message\n" + - "\t-h\thelp\n\n" + - "\t regexp is a Perl5 compatible regular expression"; - - private TextReader in_Renamed; - private volatile Thread looperThread; - private Ivy bus; - private bool timestamp, quiet, debug, exitOnDie = false; - enum Command { - direct, - die, - unbind, - bind, - ping, - quit, - bye, - list, - help}; - const string reg_parse = - @"^\.(?direct) (?[^ ]*) (?[0-9]+) (?.*)$|" + - @"^\.(?die) (?.*)$|" + - @"^\.(?unbind) (?.*)$|" + - @"^\.(?bind) (?.*)$|" + - @"^\.(?ping) (?.*)$|" + - @"^\.(?quit)$|" + - @"^\.(?bye)$|" + - @"^\.(?list)$|" + - @"^\.(?help)$|"; - private Regex cmd_regexp; - - [STAThread] - public static void Main(String[] args) - { - string name = "C#PROBE"; - string fname = null; - bool quiet = false; - bool timestamp = false; - string domain = Ivy.GetDomain(null); - bool debug = false; - - domain = Properties.Settings.Default.domain; - name = Properties.Settings.Default.name; - quiet = Properties.Settings.Default.quiet; - timestamp = Properties.Settings.Default.timestamp; - debug = Properties.Settings.Default.IvyDebug; - - - GetOpt opt = new GetOpt(args, "f:n:b:dqht"); - Arg a; - while ((a = opt.NextArg()) != null) - { - switch (a.Flag) - { - case 'd': - debug = true; - break; - - case 'b': - domain = a.Parameter; - break; - - case 'n': - name = a.Parameter; - break; - case 'f': - fname = a.Parameter; - break; - - case 'q': - quiet = true; - break; - - case 't': - timestamp = true; - break; - - case 'h': default: - System.Console.Out.WriteLine(helpmsg); - System.Environment.Exit(0); - break; - - } - } - - - IvyProbeConsole p = new IvyProbeConsole(System.Console.In, timestamp, quiet, debug ); - p.ExitOnDie = true; - Ivy bus = new Ivy(name, name + " ready"); - p.start(bus); - - if (fname != null) - p.BindFromFile(fname); - - foreach(string ex in opt.Extras) - { - if (!quiet) - System.Console.Out.WriteLine("you want to subscribe to " + ex); - bus.BindMsg(ex, p.receive); - } - - if (!quiet) - System.Console.Out.WriteLine(Ivy.Domains(domain)); - - bus.Start(domain); - - } - - - - - public IvyProbeConsole(TextReader in_Renamed, bool timestamp, bool quiet, bool debug) - { - this.in_Renamed = in_Renamed; - this.timestamp = timestamp; - this.quiet = quiet; - this.debug = debug; - try - { - cmd_regexp = new Regex(reg_parse, RegexOptions.IgnoreCase); - } - catch (ArgumentException ree) - { - System.Console.Error.WriteLine("Regexp fatal error in the Probe program."); - System.Console.Error.WriteLine(ree.StackTrace); - System.Environment.Exit(0); - } - } - - public virtual void start(Ivy bus) - { - if (looperThread != null) - throw new IvyException("Probe already started"); - this.bus = bus; - - bus.ClientConnected += connect; - bus.ClientDisconnected += disconnect; - bus.DieReceived += die ; - bus.DirectMessageReceived += directMessage; - bus.BindingAdd += new EventHandler(bus_BindingAdd); - bus.BindingRemove += new EventHandler(bus_BindingRemove); - bus.BindingFilter += new EventHandler(bus_BindingFilter); - - looperThread = new Thread(new ThreadStart(Run)); - looperThread.Name = "Keyboard Input Thread"; - looperThread.Start(); - } - - void bus_BindingFilter(object sender, IvyEventArgs e) - { - println("filtred regexp {0} from {1}", e.Argument, e.Client.ApplicationName); - } - - void bus_BindingRemove(object sender, IvyEventArgs e) - { - println("Removed regexp {0} from {1}", e.Argument, e.Client.ApplicationName); - } - - void bus_BindingAdd(object sender, IvyEventArgs e) - { - println("Added regexp {0} from {1}", e.Argument, e.Client.ApplicationName); - } - - - public void Run() - { - traceDebug("Thread started"); - Thread thisThread = Thread.CurrentThread; - String s; - // "infinite" loop on keyboard input - while (looperThread == thisThread) - { - s = in_Renamed.ReadLine(); - if (s == null) - break; - if (s.Length == 0) continue; - if ( s.StartsWith( ".") ) - parseCommand(s); - else - { - println("-> Sent to " + bus.SendMsg(s) + " peers"); - } - } - println("End of input. Good bye !"); - bus.Stop(); - traceDebug("Probe Thread stopped"); - } - - internal void parseCommand(string s) - { - Match result; - traceDebug("parsing the [" + s + "] (length " + s.Length + ") string"); - - result = cmd_regexp.Match(s); - - - if (result.Success) - { - string cmd = result.Groups["cmd"].Value; - string target; - try - { - Command TheCommand = (Command)Enum.Parse(typeof(Command), cmd); - - switch ( TheCommand ) - { - case Command.direct: - { - target = result.Groups["target"].Value; - ushort id = ushort.Parse(result.Groups["id"].Value); - string message = result.Groups["message"].Value; - List v = bus.GetClientsByName(target); - if (v.Count == 0) - println("no Ivy client with the name \"" + target + "\""); - for (int i = 0; i < v.Count; i++) - v[i].SendDirectMsg(id, message); - } - break; - case Command.die: - target = result.Groups["target"].Value; - if (bus.Die(target, ".die command") == 0) - println("no Ivy client with the name \"" + target + "\""); - break; - case Command.unbind: - target = result.Groups["target"].Value; - if (bus.UnbindMsg(target)) - println("you want to unsubscribe to " + target); - else - println("you can't unsubscribe to " + target + ", your're not subscribed to it"); - break; - case Command.bind: - target = result.Groups["target"].Value; - println("you want to subscribe to " + target); - bus.BindMsg(target, receive); - break; - case Command.ping: - target = result.Groups["target"].Value; - if (bus.Ping(target, "test") == 0) - println("no Ivy client with the name \"" + target + "\""); - break; - case Command.quit: - case Command.bye: - bus.Stop(); - System.Environment.Exit(0); - break; - case Command.list: - println(bus.IvyClients.Count + " clients on the bus"); - foreach (IvyClient client in bus.IvyClients ) - println("-> " + client.ApplicationName); - break; - case Command.help: - println(helpCommands); - break; - } - } - catch (ArgumentException) - { - Console.WriteLine("manque de la commande dans l'enum"); - } - } - - } - // parseCommand - - private void connect(object sender, IvyEventArgs e) - { - println(e.Client.ApplicationName + " connected from "+e.Client.RemoteAddress+":"+e.Client.RemotePort); - } - - private void disconnect(object sender, IvyEventArgs e) - { - println(e.Client.ApplicationName + " disconnected "); - } - - private void die(object sender, IvyDieEventArgs e) - { - println("received die msg from " + e.Client.ApplicationName + " good bye cause: "+e.Argument); - /* I cannot stop the readLine(), because it is native code */ - if (exitOnDie) - System.Environment.Exit(0); - } - - private void directMessage(object sender, IvyEventArgs e) - { - println(e.Client.ApplicationName + " direct Message " + e.Id + e.Argument); - } - - private void receive(object sender, IvyMessageEventArgs e) - { - String s = e.Client.ApplicationName + " sent "; - s += string.Join(",", e.Arguments); - println(s); - } - [Conditional("DEBUG")] - private void traceDebug(String s) - { - Trace.WriteLineIf(debug, "-->Probe<-- " + s); - } - private void println(string format, params object[] args) - { - if (!quiet) - { - if (timestamp) System.Console.Out.Write(string.Format("[ {0|HH:mm:ss.fff} ]",System.DateTime.Now )); - System.Console.Out.WriteLine(string.Format(format,args)); - } - } - - } -} \ No newline at end of file diff --git a/IvyToDel/IvyProbeConsole/IvyProbeConsole.csproj b/IvyToDel/IvyProbeConsole/IvyProbeConsole.csproj deleted file mode 100644 index 4551387..0000000 --- a/IvyToDel/IvyProbeConsole/IvyProbeConsole.csproj +++ /dev/null @@ -1,158 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {19023DE7-AAD8-4EC4-8FAF-D793868F8861} - SAK - SAK - SAK - SAK - Debug - AnyCPU - App.ico - - - IvyProbeConsole - - - JScript - Grid - IE50 - false - Exe - IvyProbeConsole - OnBuildSuccess - - - - - - - true - 85867DC3A6B10DFCF74BB49E782A1BC517B0086D - IvyProbe_TemporaryKey.pfx - true - true - LocalIntranet - \\samba\fcolin\public_html\ClickOnce\IvyProbeConsole\ - true - Web - false - Foreground - 7 - Days - false - false - true - http://www.tls.cena.fr/~fcolin/ClickOnce/IvyProbeConsole/ - 1.0.0.%2a - true - - - bin\Debug\ - false - 285212672 - false - - - DEBUG;TRACE - - - true - 4096 - false - - - false - false - false - false - 4 - full - prompt - - - bin\Release\ - false - 285212672 - false - - - TRACE - - - false - 4096 - false - - - true - false - false - false - 4 - none - prompt - - - - System - - - - System.Data - - - System.XML - - - - - - Code - - - Code - - - True - True - Settings.settings - - - - - - False - .NET Framework 2.0 - true - - - - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - {228B5F0B-31AE-488F-A916-B7CBB269D25F} - getopt - - - {F2F03CF7-0087-4EDB-AD15-80C9E8DA2617} - Ivy - - - - - - - - - - \ No newline at end of file diff --git a/IvyToDel/IvyProbeConsole/IvyProbeConsole.csproj.vspscc b/IvyToDel/IvyProbeConsole/IvyProbeConsole.csproj.vspscc deleted file mode 100644 index 62ab500..0000000 --- a/IvyToDel/IvyProbeConsole/IvyProbeConsole.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "relative:IvyProbe" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/IvyToDel/IvyProbeConsole/IvyProbe_TemporaryKey.pfx b/IvyToDel/IvyProbeConsole/IvyProbe_TemporaryKey.pfx deleted file mode 100644 index 0aaa160..0000000 Binary files a/IvyToDel/IvyProbeConsole/IvyProbe_TemporaryKey.pfx and /dev/null differ diff --git a/IvyToDel/IvyProbeConsole/Properties/AssemblyInfo.cs b/IvyToDel/IvyProbeConsole/Properties/AssemblyInfo.cs deleted file mode 100644 index 2661a2b..0000000 --- a/IvyToDel/IvyProbeConsole/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// Les informations générales relatives à un assembly dépendent de -// l'ensemble d'attributs suivant. Pour modifier les informations -// associées à un assembly, changez les valeurs de ces attributs. -// -[assembly: AssemblyTitle("IvyProbeConsole")] -[assembly: AssemblyDescription("IvyProbe Console mode")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("DTI/SDER")] -[assembly: AssemblyProduct("Ivy")] -[assembly: AssemblyCopyright("DTI/SDER 205")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// Les informations de version pour un assembly se composent des quatre valeurs suivantes : -// -// Version principale -// Version secondaire -// Numéro de build -// Révision -// -// Vous pouvez spécifier toutes les valeurs ou indiquer des numéros de révision et de build par défaut -// en utilisant '*', comme ci-dessous : - -[assembly: AssemblyVersion("2.0.*")] - -// -// Pour signer votre assembly, vous devez spécifier la clé à utiliser. Consultez -// la documentation Microsoft .NET Framework pour plus d'informations sur la signature d'un assembly. -// -// Utilisez les attributs ci-dessous pour contrôler la clé utilisée lors de la signature. -// -// Remarques : -// (*) Si aucune clé n'est spécifiée, l'assembly n'est pas signé. -// (*) KeyName fait référence à une clé installée dans le fournisseur de -// services cryptographiques (CSP) de votre ordinateur. KeyFile fait référence à un fichier qui contient -// une clé. -// (*) Si les valeurs de KeyFile et de KeyName sont spécifiées, le -// traitement suivant se produit : -// (1) Si KeyName se trouve dans le CSP, la clé est utilisée. -// (2) Si KeyName n'existe pas mais que KeyFile existe, la clé -// de KeyFile est installée dans le CSP et utilisée. -// (*) Pour créer KeyFile, vous pouvez utiliser l'utilitaire sn.exe (Strong Name, Nom fort). -// Lors de la spécification de KeyFile, son emplacement doit être -// relatif au répertoire de sortie du projet qui est -// %Project Directory%\obj\. Par exemple, si votre KeyFile se trouve -// dans le répertoire du projet, vous devez spécifier l'attribut -// AssemblyKeyFile sous la forme [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) DelaySign (signature différée) est une option avancée. Pour plus d'informations, consultez la -// documentation Microsoft .NET Framework. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] -[assembly: AssemblyFileVersionAttribute("1.0.0.0")] diff --git a/IvyToDel/IvyProbeConsole/Properties/Settings.Designer.cs b/IvyToDel/IvyProbeConsole/Properties/Settings.Designer.cs deleted file mode 100644 index 4d05e34..0000000 --- a/IvyToDel/IvyProbeConsole/Properties/Settings.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace IvyProbeConsole.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string domain { - get { - return ((string)(this["domain"])); - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("C#ProbeConsole")] - public string name { - get { - return ((string)(this["name"])); - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool quiet { - get { - return ((bool)(this["quiet"])); - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool timestamp { - get { - return ((bool)(this["timestamp"])); - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool IvyDebug { - get { - return ((bool)(this["IvyDebug"])); - } - } - } -} diff --git a/IvyToDel/IvyProbeConsole/Properties/Settings.settings b/IvyToDel/IvyProbeConsole/Properties/Settings.settings deleted file mode 100644 index b0c75fd..0000000 --- a/IvyToDel/IvyProbeConsole/Properties/Settings.settings +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - C#ProbeConsole - - - False - - - False - - - False - - - \ No newline at end of file diff --git a/IvyToDel/IvyProbeConsole/Properties/app.manifest b/IvyToDel/IvyProbeConsole/Properties/app.manifest deleted file mode 100644 index ec82d19..0000000 --- a/IvyToDel/IvyProbeConsole/Properties/app.manifest +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/IvyToDel/IvyProbeConsole/Settings.cs b/IvyToDel/IvyProbeConsole/Settings.cs deleted file mode 100644 index e0f5232..0000000 --- a/IvyToDel/IvyProbeConsole/Settings.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace IvyProbeConsole.Properties { - - - // This class allows you to handle specific events on the settings class: - // The SettingChanging event is raised before a setting's value is changed. - // The PropertyChanged event is raised after a setting's value is changed. - // The SettingsLoaded event is raised after the setting values are loaded. - // The SettingsSaving event is raised before the setting values are saved. - internal sealed partial class Settings { - - public Settings() { - // // To add event handlers for saving and changing settings, uncomment the lines below: - // - // this.SettingChanging += this.SettingChangingEventHandler; - // - // this.SettingsSaving += this.SettingsSavingEventHandler; - // - } - - private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { - // Add code to handle the SettingChangingEvent event here. - } - - private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { - // Add code to handle the SettingsSaving event here. - } - } -} diff --git a/IvyToDel/IvyProbeConsole/app.config b/IvyToDel/IvyProbeConsole/app.config deleted file mode 100644 index fef7919..0000000 --- a/IvyToDel/IvyProbeConsole/app.config +++ /dev/null @@ -1,27 +0,0 @@ - - - - -
- - - - - - - - - C#ProbeConsole - - - False - - - False - - - False - - - - \ No newline at end of file -- cgit v1.1