using System; using Bugzproxy; class AppendCommentClass { static public int Main( string[] args ) { //////////////////////////////////////////////////////////// // Use common class to get all arguments SimpleAppArgs argParser = new SimpleAppArgs( "AppendComment.exe", "Program to append a comment to a bug" ); // If parsing fails, bail out if ( ! argParser.Parse( args ) ) { return 1; } Console.WriteLine( "Using server {0}:{1}/{2}", argParser.Host, argParser.Port, argParser.Path ); Console.WriteLine( "Using username {0} and password {1}", argParser.User, argParser.Password ); // 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 // Note, appendcomment is supported by // landfill.bugzilla.org/bugzilla-tip as of jan 2008. // We probably need a login to append something. try { server.Login( argParser.User, argParser.Password, true ); server.GetBug( 1 ).AppendComment( "Hello World! Comment appended via WebService API, using bugzproxy from http://oss.dbc.dk/bugzproxy", null, null ); } catch (Exception e) { Console.WriteLine( "An exception occured. Try running with --trace? Exception follows"); Console.WriteLine( e ); return 1; } Console.WriteLine( "Appended comment!" ); return 0; } }