Exemple #1
0
        /// <summary>
        /// Walks a directory structure obtaining Component Id's and Standard Directory Id's.
        /// </summary>
        /// <param name="directory">The Directory to walk.</param>
        /// <returns>true if the directory is TARGETDIR.</returns>
        private bool WalkDirectory(Wix.Directory directory)
        {
            bool isTargetDir = false;

            if ("TARGETDIR" == directory.Id)
            {
                isTargetDir = true;
            }

            string standardDirectoryId = null;

            if (Melter.StartsWithStandardDirectoryId(directory.Id, out standardDirectoryId) && !isTargetDir)
            {
                this.AddSetPropertyCustomAction(directory.Id, String.Format(CultureInfo.InvariantCulture, "[{0}]", standardDirectoryId));
            }

            foreach (Wix.ISchemaElement child in directory.Children)
            {
                Wix.Directory childDir = child as Wix.Directory;
                if (null != childDir)
                {
                    if (isTargetDir)
                    {
                        this.primaryDirectoryRef.AddChild(child);
                    }
                    this.WalkDirectory(childDir);
                }
                else
                {
                    Wix.Component childComponent = child as Wix.Component;
                    if (null != childComponent)
                    {
                        if (isTargetDir)
                        {
                            this.primaryDirectoryRef.AddChild(child);
                        }
                        this.AddComponentRef(childComponent);
                    }
                }
            }

            return(isTargetDir);
        }
        /// <summary>
        /// Harvest a performance category.
        /// </summary>
        /// <param name="argument">The name of the performance category.</param>
        /// <returns>A harvested performance category.</returns>
        public override Wix.Fragment[] Harvest(string argument)
        {
            if (null == argument)
            {
                throw new ArgumentNullException("argument");
            }

            Util.PerformanceCategory perf = this.HarvestPerformanceCategory(argument);

            Wix.Component component = new Wix.Component();
            component.Id      = CompilerCore.GetIdentifierFromName(argument);
            component.KeyPath = Wix.YesNoType.yes;
            component.AddChild(perf);

            Wix.Directory directory = new Wix.Directory();
            directory.Id = "TARGETDIR";
            //directory.Name = directory.Id;
            directory.AddChild(component);

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

            return(new Wix.Fragment[] { fragment });
        }
Exemple #3
0
 /// <summary>
 /// Adds a ComponentRef to the main ComponentGroup.
 /// </summary>
 /// <param name="component">The component to add.</param>
 private void AddComponentRef(Wix.Component component)
 {
     Wix.ComponentRef componentRef = new Wix.ComponentRef();
     componentRef.Id = component.Id;
     this.componentGroup.AddChild(componentRef);
 }