summaryrefslogtreecommitdiff
path: root/src/samples/burn/runbundle/Program.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-04-22 17:06:54 -0700
committerRob Mensching <rob@firegiant.com>2021-04-29 16:36:06 -0700
commitaf10c45d7b3a44af0b461a557847fe03263dcc10 (patch)
tree6a5c1532304782c36ffe4200b38f3afb76789a43 /src/samples/burn/runbundle/Program.cs
parent9c2aed97299fb96aeee3f1471ce40225437aaecf (diff)
downloadwix-af10c45d7b3a44af0b461a557847fe03263dcc10.tar.gz
wix-af10c45d7b3a44af0b461a557847fe03263dcc10.tar.bz2
wix-af10c45d7b3a44af0b461a557847fe03263dcc10.zip
Move burn into burn
Diffstat (limited to 'src/samples/burn/runbundle/Program.cs')
-rw-r--r--src/samples/burn/runbundle/Program.cs47
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
3namespace 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}