diff options
Diffstat (limited to 'src/wixcop/Program.cs')
| -rw-r--r-- | src/wixcop/Program.cs | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/src/wixcop/Program.cs b/src/wixcop/Program.cs deleted file mode 100644 index 5e72f8ea..00000000 --- a/src/wixcop/Program.cs +++ /dev/null | |||
| @@ -1,79 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Tools.WixCop | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Diagnostics; | ||
| 7 | using WixToolset.Core; | ||
| 8 | using WixToolset.Extensibility; | ||
| 9 | using WixToolset.Extensibility.Data; | ||
| 10 | using WixToolset.Extensibility.Services; | ||
| 11 | using WixToolset.Tools.Core; | ||
| 12 | using WixToolset.Tools.WixCop.CommandLine; | ||
| 13 | using WixToolset.Tools.WixCop.Interfaces; | ||
| 14 | |||
| 15 | /// <summary> | ||
| 16 | /// Wix source code style inspector and converter. | ||
| 17 | /// </summary> | ||
| 18 | public sealed class Program | ||
| 19 | { | ||
| 20 | /// <summary> | ||
| 21 | /// The main entry point for the application. | ||
| 22 | /// </summary> | ||
| 23 | /// <param name="args">The commandline arguments.</param> | ||
| 24 | /// <returns>The number of errors that were found.</returns> | ||
| 25 | [STAThread] | ||
| 26 | public static int Main(string[] args) | ||
| 27 | { | ||
| 28 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); | ||
| 29 | var listener = new ConsoleMessageListener("WXCP", "wixcop.exe"); | ||
| 30 | |||
| 31 | serviceProvider.AddService<IMessageListener>((x, y) => listener); | ||
| 32 | serviceProvider.AddService<IWixCopCommandLineParser>((x, y) => new WixCopCommandLineParser(x)); | ||
| 33 | |||
| 34 | var program = new Program(); | ||
| 35 | return program.Run(serviceProvider, args); | ||
| 36 | } | ||
| 37 | |||
| 38 | /// <summary> | ||
| 39 | /// Run the application with the given arguments. | ||
| 40 | /// </summary> | ||
| 41 | /// <param name="serviceProvider">Service provider to use throughout this execution.</param> | ||
| 42 | /// <param name="args">The commandline arguments.</param> | ||
| 43 | /// <returns>The number of errors that were found.</returns> | ||
| 44 | public int Run(IWixToolsetServiceProvider serviceProvider, string[] args) | ||
| 45 | { | ||
| 46 | try | ||
| 47 | { | ||
| 48 | var listener = serviceProvider.GetService<IMessageListener>(); | ||
| 49 | var messaging = serviceProvider.GetService<IMessaging>(); | ||
| 50 | messaging.SetListener(listener); | ||
| 51 | |||
| 52 | var arguments = serviceProvider.GetService<ICommandLineArguments>(); | ||
| 53 | arguments.Populate(args); | ||
| 54 | |||
| 55 | var commandLine = serviceProvider.GetService<IWixCopCommandLineParser>(); | ||
| 56 | commandLine.Arguments = arguments; | ||
| 57 | var command = commandLine.ParseWixCopCommandLine(); | ||
| 58 | |||
| 59 | if (command.ShowLogo) | ||
| 60 | { | ||
| 61 | var wixcopAssembly = this.GetType().Assembly; | ||
| 62 | var fv = FileVersionInfo.GetVersionInfo(wixcopAssembly.Location); | ||
| 63 | |||
| 64 | Console.WriteLine("WiX Cop version {0}", fv.FileVersion); | ||
| 65 | Console.WriteLine("Copyright (C) .NET Foundation and contributors. All rights reserved."); | ||
| 66 | Console.WriteLine(); | ||
| 67 | } | ||
| 68 | |||
| 69 | return command?.Execute() ?? 1; | ||
| 70 | } | ||
| 71 | catch (Exception e) | ||
| 72 | { | ||
| 73 | Console.Error.WriteLine("wixcop.exe : fatal error WXCP0001 : {0}\r\n\n\nStack Trace:\r\n{1}", e.Message, e.StackTrace); | ||
| 74 | |||
| 75 | return 1; | ||
| 76 | } | ||
| 77 | } | ||
| 78 | } | ||
| 79 | } | ||
