/// <summary> /// Main running method for the application. /// </summary> /// <param name="args">Commandline arguments to the application.</param> /// <returns>Returns the application error code.</returns> private int Run(string[] args) { StringCollection extensionList = new StringCollection(); ClickThroughConsoleExtension extension = null; try { // parse the command line this.ParseCommandLine(args); // load the extension if (null != this.extensionType) { extension = ClickThroughConsoleExtension.Load(this.extensionType); extension.Fabricator.Message += new MessageEventHandler(this.messageHandler.Display); // parse the extension's command line arguments string[] extensionOptionsArray = new string[this.extensionOptions.Count]; this.extensionOptions.CopyTo(extensionOptionsArray, 0); extension.ParseOptions(extensionOptionsArray); // exit if there was an error parsing the command line (otherwise the logo appears after error messages) if (this.messageHandler.EncounteredError) { return(this.messageHandler.LastErrorNumber); } } if (this.showLogo) { AppCommon.DisplayToolHeader(); } if (this.showHelp) { Console.WriteLine(CTStrings.HelpMessage1); // output the builder types alphabetically if (null != extension) { SortedList builderTypes = new SortedList(); foreach (CommandLineOption commandLineOption in extension.CommandLineTypes) { builderTypes.Add(commandLineOption.Option, commandLineOption); } foreach (CommandLineOption commandLineOption in builderTypes.Values) { Console.WriteLine(String.Format(CultureInfo.CurrentUICulture, CTStrings.OptionFormat, commandLineOption.Option, commandLineOption.Description)); } } Console.WriteLine(CTStrings.HelpMessage2); AppCommon.DisplayToolFooter(); return(this.messageHandler.LastErrorNumber); } // build the output if (!extension.Fabricator.Fabricate(this.outputFile)) { return(this.messageHandler.LastErrorNumber); } } catch (WixException we) { this.messageHandler.Display(this, we.Error); } catch (Exception e) { this.messageHandler.Display(this, WixErrors.UnexpectedException(e.Message, e.GetType().ToString(), e.StackTrace)); if (e is NullReferenceException || e is SEHException) { throw; } } return(this.messageHandler.LastErrorNumber); }
/// <summary> /// Main running method for the application. /// </summary> /// <param name="args">Commandline arguments to the application.</param> /// <returns>Returns the application error code.</returns> private int Run(string[] args) { StringCollection extensionList = new StringCollection(); ClickThroughConsoleExtension extension = null; try { // parse the command line this.ParseCommandLine(args); // load the extension if (null != this.extensionType) { extension = ClickThroughConsoleExtension.Load(this.extensionType); extension.Fabricator.Message += new MessageEventHandler(this.messageHandler.Display); // parse the extension's command line arguments string[] extensionOptionsArray = new string[this.extensionOptions.Count]; this.extensionOptions.CopyTo(extensionOptionsArray, 0); extension.ParseOptions(extensionOptionsArray); // exit if there was an error parsing the command line (otherwise the logo appears after error messages) if (this.messageHandler.EncounteredError) { return(this.messageHandler.LastErrorNumber); } } if (this.showLogo) { Assembly clickThroughBuilderAssembly = Assembly.GetExecutingAssembly(); Console.WriteLine("Microsoft (R) Windows Installer XML Toolset Builder version {0}", clickThroughBuilderAssembly.GetName().Version.ToString()); Console.WriteLine("Copyright (C) Microsoft Corporation 2006. All rights reserved."); Console.WriteLine(); } if (this.showHelp) { Console.WriteLine(" usage: ct.exe builderType <builder arguments> -out appfeed.rss"); Console.WriteLine(); Console.WriteLine("Supported builder types (use \"ct.exe <type> -?\" for more info):"); // output the builder types alphabetically if (null != extension) { SortedList builderTypes = new SortedList(); foreach (CommandLineOption commandLineOption in extension.CommandLineTypes) { builderTypes.Add(commandLineOption.Option, commandLineOption); } foreach (CommandLineOption commandLineOption in builderTypes.Values) { Console.WriteLine(" {0,-7} {1}", commandLineOption.Option, commandLineOption.Description); } } Console.WriteLine(); Console.WriteLine(" -nologo skip printing candle logo information"); Console.WriteLine(" -out specify output file (default: write to current directory\\feed.rss)"); Console.WriteLine(" -sw<N> suppress warning with specific message ID"); Console.WriteLine(" -v verbose output"); Console.WriteLine(" -? this help information"); Console.WriteLine(""); Console.WriteLine("For more information see: http://wix.sourceforge.net"); return(this.messageHandler.LastErrorNumber); } // build the output if (!extension.Fabricator.Fabricate(this.outputFile)) { return(this.messageHandler.LastErrorNumber); } } catch (WixException we) { this.messageHandler.Display(this, we.Error); } catch (Exception e) { this.messageHandler.Display(this, WixErrors.UnexpectedException(e.Message, e.GetType().ToString(), e.StackTrace)); if (e is NullReferenceException || e is SEHException) { throw; } } return(this.messageHandler.LastErrorNumber); }