From 0ec925dbf8359629e6d4f71fb142118a05f07298 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 7 Jun 2020 08:14:46 -0700 Subject: Move WixCop to "wix.exe convert" command --- src/wixcop/Program.cs | 79 --------------------------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 src/wixcop/Program.cs (limited to 'src/wixcop/Program.cs') 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 @@ -// 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. - -namespace WixToolset.Tools.WixCop -{ - using System; - using System.Diagnostics; - using WixToolset.Core; - using WixToolset.Extensibility; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - using WixToolset.Tools.Core; - using WixToolset.Tools.WixCop.CommandLine; - using WixToolset.Tools.WixCop.Interfaces; - - /// - /// Wix source code style inspector and converter. - /// - public sealed class Program - { - /// - /// The main entry point for the application. - /// - /// The commandline arguments. - /// The number of errors that were found. - [STAThread] - public static int Main(string[] args) - { - var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); - var listener = new ConsoleMessageListener("WXCP", "wixcop.exe"); - - serviceProvider.AddService((x, y) => listener); - serviceProvider.AddService((x, y) => new WixCopCommandLineParser(x)); - - var program = new Program(); - return program.Run(serviceProvider, args); - } - - /// - /// Run the application with the given arguments. - /// - /// Service provider to use throughout this execution. - /// The commandline arguments. - /// The number of errors that were found. - public int Run(IWixToolsetServiceProvider serviceProvider, string[] args) - { - try - { - var listener = serviceProvider.GetService(); - var messaging = serviceProvider.GetService(); - messaging.SetListener(listener); - - var arguments = serviceProvider.GetService(); - arguments.Populate(args); - - var commandLine = serviceProvider.GetService(); - commandLine.Arguments = arguments; - var command = commandLine.ParseWixCopCommandLine(); - - if (command.ShowLogo) - { - var wixcopAssembly = this.GetType().Assembly; - var fv = FileVersionInfo.GetVersionInfo(wixcopAssembly.Location); - - Console.WriteLine("WiX Cop version {0}", fv.FileVersion); - Console.WriteLine("Copyright (C) .NET Foundation and contributors. All rights reserved."); - Console.WriteLine(); - } - - return command?.Execute() ?? 1; - } - catch (Exception e) - { - Console.Error.WriteLine("wixcop.exe : fatal error WXCP0001 : {0}\r\n\n\nStack Trace:\r\n{1}", e.Message, e.StackTrace); - - return 1; - } - } - } -} -- cgit v1.2.3-55-g6feb