using System; using Bugzproxy; class ServerInfoClass { static public int Main( string[] args ) { //////////////////////////////////////////////////////////// // Use common class to get all arguments SimpleAppArgs argParser = new SimpleAppArgs( "ServerInfo.exe", "Program to list basic information about a server" ); // If parsing fails, bail out if ( ! argParser.Parse( args ) ) { return 1; } Console.WriteLine( "Using server {0}:{1}/{2}", argParser.Host, argParser.Port, argParser.Path ); // Construct server, based on arguments, setup tracer if user set option Server server = new Server( argParser.Host, argParser.Port, argParser.Path ); if ( argParser.Trace ) { server.TraceWriter = System.Console.Out; } //////////////////////////////////////////////////////////// // Real program starts here Console.WriteLine( "Version\tTimezone" ); // todo: Is this right?: Login is never needed to get the version or the timezone. try { Console.WriteLine( server.GetVersion() + "\t" + server.GetTimezone() ); } catch (Exception e) { Console.WriteLine( "An exception occured. Try running with --trace? Exception follows"); Console.WriteLine( e ); return 1; } return 0; } }