// 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.Harvesters
{
using WixToolset.Harvesters.Data;
using WixToolset.Harvesters.Extensibility;
///
/// An IIS harvesting extension for the WiX Toolset Harvester application.
///
public sealed class IIsHeatExtension : BaseHeatExtension
{
///
/// Gets the supported command line types for this extension.
///
/// The supported command line types for this extension.
public override HeatCommandLineOption[] CommandLineTypes
{
get
{
return new HeatCommandLineOption[]
{
new HeatCommandLineOption("website", "harvest an IIS web site"),
};
}
}
///
/// Parse the command line options for this extension.
///
/// The active harvester type.
/// The option arguments.
public override void ParseOptions(string type, string[] args)
{
bool active = false;
IHarvesterExtension harvesterExtension = null;
IIsHarvesterMutator iisHarvesterMutator = new IIsHarvesterMutator();
// select the harvester
switch (type)
{
case "website":
harvesterExtension = new IIsWebSiteHarvester();
active = true;
break;
}
// set default settings
iisHarvesterMutator.SetUniqueIdentifiers = true;
// parse the options
foreach (string arg in args)
{
if (null == arg || 0 == arg.Length) // skip blank arguments
{
continue;
}
if ('-' == arg[0] || '/' == arg[0])
{
string parameter = arg.Substring(1);
if ("suid" == parameter)
{
iisHarvesterMutator.SetUniqueIdentifiers = false;
}
}
}
// set the appropriate harvester extension
if (active)
{
this.Core.Harvester.Extension = harvesterExtension;
this.Core.Mutator.AddExtension(iisHarvesterMutator);
this.Core.Mutator.AddExtension(new IIsFinalizeHarvesterMutator());
this.Core.Mutator.AddExtension(new UtilFinalizeHarvesterMutator());
}
}
}
}