Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new melter object.
        /// </summary>
        /// <param name="decompiler">The decompiler to use during the melting process.</param>
        /// <param name="id">The Id to use for the ComponentGroup, DirectoryRef, and WixVariables. If null, defaults to the Module's Id</param>
        public Melter(Decompiler decompiler, string id)
        {
            this.core = new MelterCore();

            this.componentGroup      = new Wix.ComponentGroup();
            this.fragment            = new Wix.Fragment();
            this.primaryDirectoryRef = new Wix.DirectoryRef();

            this.decompiler = decompiler;
            this.id         = id;

            if (null == this.decompiler)
            {
                this.core.OnMessage(WixErrors.ExpectedDecompiler("The melting process"));
            }
        }
        /// <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 });
        }