diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-05-11 07:42:44 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-05-11 07:42:44 -0700 |
| commit | afc20ecb53ad3ade524aceefa30d98a3d84fd479 (patch) | |
| tree | 4fb762f65dc195ccb104a6c1fcce7c40e7693e98 /src/samples/burn/runbundle/Program.cs | |
| parent | 8e1207c4c5e451ba1a087f0fa11b63964ac35f3c (diff) | |
| parent | af10c45d7b3a44af0b461a557847fe03263dcc10 (diff) | |
| download | wix-afc20ecb53ad3ade524aceefa30d98a3d84fd479.tar.gz wix-afc20ecb53ad3ade524aceefa30d98a3d84fd479.tar.bz2 wix-afc20ecb53ad3ade524aceefa30d98a3d84fd479.zip | |
Merge burn
Diffstat (limited to 'src/samples/burn/runbundle/Program.cs')
| -rw-r--r-- | src/samples/burn/runbundle/Program.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/samples/burn/runbundle/Program.cs b/src/samples/burn/runbundle/Program.cs new file mode 100644 index 00000000..8edca5dc --- /dev/null +++ b/src/samples/burn/runbundle/Program.cs | |||
| @@ -0,0 +1,47 @@ | |||
| 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 Wix.Samples | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Linq; | ||
| 7 | using Wix.Samples; | ||
| 8 | |||
| 9 | /// <summary> | ||
| 10 | /// Example executable that installs then immediately uninstalls a bundle showing progress. | ||
| 11 | /// </summary> | ||
| 12 | class Program | ||
| 13 | { | ||
| 14 | static int Main(string[] args) | ||
| 15 | { | ||
| 16 | if (args.Length == 0) | ||
| 17 | { | ||
| 18 | Console.WriteLine("Must provide the path to the bundle to install then uninstall."); | ||
| 19 | return -1; | ||
| 20 | } | ||
| 21 | |||
| 22 | BundleRunner runner = new BundleRunner(args[0]); | ||
| 23 | runner.Error += Program.OnError; | ||
| 24 | runner.Progress += Program.OnProgress; | ||
| 25 | |||
| 26 | Console.WriteLine("Installing: {0}", runner.Path); | ||
| 27 | int exitCode = runner.Run(String.Join(" ", args.Skip(1).ToArray())); | ||
| 28 | if (0 == exitCode) | ||
| 29 | { | ||
| 30 | Console.WriteLine("\r\nUninstalling: {0}", runner.Path); | ||
| 31 | exitCode = runner.Run("-uninstall"); | ||
| 32 | } | ||
| 33 | |||
| 34 | return exitCode; | ||
| 35 | } | ||
| 36 | |||
| 37 | static void OnError(object sender, BundleErrorEventArgs e) | ||
| 38 | { | ||
| 39 | Console.WriteLine("error: {0}, uiHint: {1}, message: {2}", e.Code, e.UIHint, e.Message); | ||
| 40 | } | ||
| 41 | |||
| 42 | static void OnProgress(object sender, BundleProgressEventArgs e) | ||
| 43 | { | ||
| 44 | Console.WriteLine("progresss: {0}%", e.Progress); | ||
| 45 | } | ||
| 46 | } | ||
| 47 | } | ||
