summaryrefslogtreecommitdiff
path: root/src/tools/heat/IIsHeatExtension.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/heat/IIsHeatExtension.cs')
-rw-r--r--src/tools/heat/IIsHeatExtension.cs80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/tools/heat/IIsHeatExtension.cs b/src/tools/heat/IIsHeatExtension.cs
new file mode 100644
index 00000000..be998370
--- /dev/null
+++ b/src/tools/heat/IIsHeatExtension.cs
@@ -0,0 +1,80 @@
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 WixToolset.Harvesters
4{
5 using WixToolset.Harvesters.Data;
6 using WixToolset.Harvesters.Extensibility;
7
8 /// <summary>
9 /// An IIS harvesting extension for the WiX Toolset Harvester application.
10 /// </summary>
11 public sealed class IIsHeatExtension : BaseHeatExtension
12 {
13 /// <summary>
14 /// Gets the supported command line types for this extension.
15 /// </summary>
16 /// <value>The supported command line types for this extension.</value>
17 public override HeatCommandLineOption[] CommandLineTypes
18 {
19 get
20 {
21 return new HeatCommandLineOption[]
22 {
23 new HeatCommandLineOption("website", "harvest an IIS web site"),
24 };
25 }
26 }
27
28 /// <summary>
29 /// Parse the command line options for this extension.
30 /// </summary>
31 /// <param name="type">The active harvester type.</param>
32 /// <param name="args">The option arguments.</param>
33 public override void ParseOptions(string type, string[] args)
34 {
35 bool active = false;
36 IHarvesterExtension harvesterExtension = null;
37 IIsHarvesterMutator iisHarvesterMutator = new IIsHarvesterMutator();
38
39 // select the harvester
40 switch (type)
41 {
42 case "website":
43 harvesterExtension = new IIsWebSiteHarvester();
44 active = true;
45 break;
46 }
47
48 // set default settings
49 iisHarvesterMutator.SetUniqueIdentifiers = true;
50
51 // parse the options
52 foreach (string arg in args)
53 {
54 if (null == arg || 0 == arg.Length) // skip blank arguments
55 {
56 continue;
57 }
58
59 if ('-' == arg[0] || '/' == arg[0])
60 {
61 string parameter = arg.Substring(1);
62
63 if ("suid" == parameter)
64 {
65 iisHarvesterMutator.SetUniqueIdentifiers = false;
66 }
67 }
68 }
69
70 // set the appropriate harvester extension
71 if (active)
72 {
73 this.Core.Harvester.Extension = harvesterExtension;
74 this.Core.Mutator.AddExtension(iisHarvesterMutator);
75 this.Core.Mutator.AddExtension(new IIsFinalizeHarvesterMutator());
76 this.Core.Mutator.AddExtension(new UtilFinalizeHarvesterMutator());
77 }
78 }
79 }
80}