From 229242cf7c328b89b5aa65ed7a04e33c8b93b393 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 14 Jul 2022 15:19:53 -0700 Subject: Rename "samples" segment to "tools" This segment is a bit of a "miscellaneous section" in the WiX repo. As such it has been difficult to name. I originally eschewed the name "tools" because what is in the "wix" segment was once called "tools". However, now that wix.exe is firmly established as the entry point for WiX operations, I've become comfortable with its segment being named "wix". That meant "tools" was again available and "tools" better describes the content of this section. --- src/tools/burn/runbundle/Program.cs | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/tools/burn/runbundle/Program.cs (limited to 'src/tools/burn/runbundle/Program.cs') diff --git a/src/tools/burn/runbundle/Program.cs b/src/tools/burn/runbundle/Program.cs new file mode 100644 index 00000000..fd36c2ca --- /dev/null +++ b/src/tools/burn/runbundle/Program.cs @@ -0,0 +1,47 @@ +// 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 +{ + using System; + using System.Linq; + using WixToolset.Tools; + + /// + /// Example executable that installs then immediately uninstalls a bundle showing progress. + /// + class Program + { + static int Main(string[] args) + { + if (args.Length == 0) + { + Console.WriteLine("Must provide the path to the bundle to install then uninstall."); + return -1; + } + + BundleRunner runner = new BundleRunner(args[0]); + runner.Error += Program.OnError; + runner.Progress += Program.OnProgress; + + Console.WriteLine("Installing: {0}", runner.Path); + int exitCode = runner.Run(String.Join(" ", args.Skip(1).ToArray())); + if (0 == exitCode) + { + Console.WriteLine("\r\nUninstalling: {0}", runner.Path); + exitCode = runner.Run("-uninstall"); + } + + return exitCode; + } + + static void OnError(object sender, BundleErrorEventArgs e) + { + Console.WriteLine("error: {0}, uiHint: {1}, message: {2}", e.Code, e.UIHint, e.Message); + } + + static void OnProgress(object sender, BundleProgressEventArgs e) + { + Console.WriteLine("progresss: {0}%", e.Progress); + } + } +} -- cgit v1.2.3-55-g6feb