/// <summary>
        /// Harvest a WiX document.
        /// </summary>
        /// <param name="argument">The argument for harvesting.</param>
        /// <returns>The harvested Fragment.</returns>
        public override Wix.Fragment[] Harvest(string argument)
        {
            DirectoryHarvester directoryHarvester = new DirectoryHarvester();

            directoryHarvester.Core = this.Core;
            directoryHarvester.KeepEmptyDirectories = true;

            IIsWebSiteHarvester iisWebSiteHarvester = new IIsWebSiteHarvester();

            iisWebSiteHarvester.Core = this.Core;

            IIs.WebSite webSite = iisWebSiteHarvester.HarvestWebSite(argument);

            Wix.Component component = new Wix.Component();
            component.AddChild(new Wix.CreateFolder());
            component.AddChild(webSite);

            this.Core.RootDirectory = webSite.Directory;
            Wix.Directory directory = directoryHarvester.HarvestDirectory(webSite.Directory, true);
            directory.AddChild(component);

            Wix.Fragment fragment = new Wix.Fragment();
            fragment.AddChild(directory);

            return(new Wix.Fragment[] { fragment });
        }
예제 #2
0
        /// <summary>
        /// Parse the command line options for this extension.
        /// </summary>
        /// <param name="type">The active harvester type.</param>
        /// <param name="args">The option arguments.</param>
        public override void ParseOptions(string type, string[] args)
        {
            bool active = false;
            HarvesterExtension  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());
            }
        }