diff options
author | Mark Spruiell <mes@zeroc.com> | 2008-02-08 16:57:37 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2008-02-08 16:57:37 -0800 |
commit | e754cd9f687138f7d58b477718bf061801f68d95 (patch) | |
tree | 1ee35e6203ca8538bb30311d8e987eec56b205d3 /cs/demo/IceBox/hello/Client.cs | |
parent | cleaning up enum mapping (diff) | |
download | ice-e754cd9f687138f7d58b477718bf061801f68d95.tar.bz2 ice-e754cd9f687138f7d58b477718bf061801f68d95.tar.xz ice-e754cd9f687138f7d58b477718bf061801f68d95.zip |
bug 1960 - empty application name in Windows Firewall list
Diffstat (limited to 'cs/demo/IceBox/hello/Client.cs')
-rw-r--r-- | cs/demo/IceBox/hello/Client.cs | 252 |
1 files changed, 131 insertions, 121 deletions
diff --git a/cs/demo/IceBox/hello/Client.cs b/cs/demo/IceBox/hello/Client.cs index 3b88359433e..dc15991287f 100644 --- a/cs/demo/IceBox/hello/Client.cs +++ b/cs/demo/IceBox/hello/Client.cs @@ -7,165 +7,175 @@ // // ********************************************************************** -using System; using Demo; +using System; +using System.Reflection; -public class Client : Ice.Application -{ - private static void menu() - { - Console.Write( - "usage:\n" + - "t: send greeting as twoway\n" + - "o: send greeting as oneway\n" + - "O: send greeting as batch oneway\n" + - "d: send greeting as datagram\n" + - "D: send greeting as batch datagram\n" + - "f: flush all batch requests\n"); - if(_haveSSL) - { - Console.Write("\nS: switch secure mode on/off"); - } - Console.WriteLine( - "\nx: exit\n" + - "?: help\n"); - } - - public override int run(string[] args) - { - if(args.Length > 0) - { - Console.Error.WriteLine(appName() + ": too many arguments"); - return 1; - } +[assembly: CLSCompliant(true)] - try - { - communicator().getPluginManager().getPlugin("IceSSL"); - _haveSSL = true; - } - catch(Ice.NotRegisteredException) - { - } +[assembly: AssemblyTitle("IceBoxHelloClient")] +[assembly: AssemblyDescription("IceBox hello demo client")] +[assembly: AssemblyCompany("ZeroC, Inc.")] - HelloPrx twoway = HelloPrxHelper.checkedCast( - communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false)); - if(twoway == null) +public class Client +{ + public class App : Ice.Application + { + private static void menu() { - Console.Error.WriteLine("invalid proxy"); - return 1; + Console.Write( + "usage:\n" + + "t: send greeting as twoway\n" + + "o: send greeting as oneway\n" + + "O: send greeting as batch oneway\n" + + "d: send greeting as datagram\n" + + "D: send greeting as batch datagram\n" + + "f: flush all batch requests\n"); + if(_haveSSL) + { + Console.Write("\nS: switch secure mode on/off"); + } + Console.WriteLine( + "\nx: exit\n" + + "?: help\n"); } - HelloPrx oneway = HelloPrxHelper.uncheckedCast(twoway.ice_oneway()); - HelloPrx batchOneway = HelloPrxHelper.uncheckedCast(twoway.ice_batchOneway()); - HelloPrx datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram()); - HelloPrx batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram()); - - bool secure = false; - menu(); - - string line = null; - do + public override int run(string[] args) { + if(args.Length > 0) + { + Console.Error.WriteLine(appName() + ": too many arguments"); + return 1; + } + try { - Console.Out.Write("==> "); - Console.Out.Flush(); - line = Console.In.ReadLine(); - if(line == null) - { - break; - } - if(line.Equals("t")) - { - twoway.sayHello(); - } - else if(line.Equals("o")) - { - oneway.sayHello(); - } - else if(line.Equals("O")) - { - batchOneway.sayHello(); - } - else if(line.Equals("d")) + communicator().getPluginManager().getPlugin("IceSSL"); + _haveSSL = true; + } + catch(Ice.NotRegisteredException) + { + } + + HelloPrx twoway = HelloPrxHelper.checkedCast( + communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false)); + if(twoway == null) + { + Console.Error.WriteLine("invalid proxy"); + return 1; + } + HelloPrx oneway = HelloPrxHelper.uncheckedCast(twoway.ice_oneway()); + HelloPrx batchOneway = HelloPrxHelper.uncheckedCast(twoway.ice_batchOneway()); + HelloPrx datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram()); + HelloPrx batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram()); + + bool secure = false; + + menu(); + + string line = null; + do + { + try { - if(secure) + Console.Out.Write("==> "); + Console.Out.Flush(); + line = Console.In.ReadLine(); + if(line == null) { - Console.WriteLine("secure datagrams are not supported"); + break; } - else + if(line.Equals("t")) { - datagram.sayHello(); + twoway.sayHello(); } - } - else if(line.Equals("D")) - { - if(secure) + else if(line.Equals("o")) { - Console.WriteLine("secure datagrams are not supported"); + oneway.sayHello(); } - else + else if(line.Equals("O")) { - batchDatagram.sayHello(); + batchOneway.sayHello(); } - } - else if(line.Equals("f")) - { - communicator().flushBatchRequests(); - } - else if(_haveSSL && line.Equals("S")) - { - secure = !secure; + else if(line.Equals("d")) + { + if(secure) + { + Console.WriteLine("secure datagrams are not supported"); + } + else + { + datagram.sayHello(); + } + } + else if(line.Equals("D")) + { + if(secure) + { + Console.WriteLine("secure datagrams are not supported"); + } + else + { + batchDatagram.sayHello(); + } + } + else if(line.Equals("f")) + { + communicator().flushBatchRequests(); + } + else if(_haveSSL && line.Equals("S")) + { + secure = !secure; - twoway = HelloPrxHelper.uncheckedCast(twoway.ice_secure(secure)); - oneway = HelloPrxHelper.uncheckedCast(oneway.ice_secure(secure)); - batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_secure(secure)); - datagram = HelloPrxHelper.uncheckedCast(datagram.ice_secure(secure)); - batchDatagram = HelloPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure)); - - if(secure) + twoway = HelloPrxHelper.uncheckedCast(twoway.ice_secure(secure)); + oneway = HelloPrxHelper.uncheckedCast(oneway.ice_secure(secure)); + batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_secure(secure)); + datagram = HelloPrxHelper.uncheckedCast(datagram.ice_secure(secure)); + batchDatagram = HelloPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure)); + + if(secure) + { + Console.WriteLine("secure mode is now on"); + } + else + { + Console.WriteLine("secure mode is now off"); + } + } + else if(line.Equals("x")) + { + // Nothing to do + } + else if(line.Equals("?")) { - Console.WriteLine("secure mode is now on"); + menu(); } else { - Console.WriteLine("secure mode is now off"); + Console.WriteLine("unknown command `" + line + "'"); + menu(); } } - else if(line.Equals("x")) - { - // Nothing to do - } - else if(line.Equals("?")) - { - menu(); - } - else + catch(System.Exception ex) { - Console.WriteLine("unknown command `" + line + "'"); - menu(); + Console.Error.WriteLine(ex); } } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - } + while (!line.Equals("x")); + + return 0; } - while (!line.Equals("x")); - - return 0; + + private static bool _haveSSL = false; } public static void Main(string[] args) { - Client app = new Client(); + App app = new App(); int status = app.main(args, "config.client"); if(status != 0) { System.Environment.Exit(status); } } - - private static bool _haveSSL = false; } |