示例#1
0
        /// <summary>
        /// Processes a child element of a Component for the Compiler.
        /// </summary>
        /// <param name="parentElement">Parent element of element to process.</param>
        /// <param name="element">Element to process.</param>
        /// <param name="context">Extra information about the context in which this element is being parsed.</param>
        /// <returns>The component key path type if set.</returns>
        public override ComponentKeyPath ParsePossibleKeyPathElement(XElement parentElement, XElement element, IDictionary <string, string> context)
        {
            SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement);
            ComponentKeyPath keyPath           = null;

            switch (parentElement.Name.LocalName)
            {
            case "Component":
                string componentId = context["ComponentId"];

                // 64-bit components may cause issues downlevel.
                bool win64 = false;
                Boolean.TryParse(context["Win64"], out win64);

                switch (element.Name.LocalName)
                {
                case "Provides":
                    if (win64)
                    {
                        this.Core.OnMessage(DependencyWarnings.Win64Component(sourceLineNumbers, componentId));
                    }

                    keyPath = this.ParseProvidesElement(element, PackageType.None, componentId);
                    break;

                default:
                    this.Core.UnexpectedElement(parentElement, element);
                    break;
                }
                break;

            default:
                this.Core.UnexpectedElement(parentElement, element);
                break;
            }

            return(keyPath);
        }
        /// <summary>
        /// Processes a child element of a Component for the Compiler.
        /// </summary>
        /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
        /// <param name="parentElement">Parent element of element to process.</param>
        /// <param name="element">Element to process.</param>
        /// <param name="keyPath">Explicit key path.</param>
        /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
        /// <returns>The component key path type if set.</returns>
        public override CompilerExtension.ComponentKeypathType ParseElement(SourceLineNumberCollection sourceLineNumbers, XmlElement parentElement, XmlElement element, ref string keyPath, params string[] contextValues)
        {
            CompilerExtension.ComponentKeypathType keyPathType = CompilerExtension.ComponentKeypathType.None;

            switch (parentElement.LocalName)
            {
            case "Component":
                string componentId = contextValues[0];

                // 64-bit components may cause issues downlevel.
                bool win64 = false;
                Boolean.TryParse(contextValues[2], out win64);

                switch (element.LocalName)
                {
                case "Provides":
                    if (win64)
                    {
                        this.Core.OnMessage(DependencyWarnings.Win64Component(sourceLineNumbers, componentId));
                    }

                    keyPathType = this.ParseProvidesElement(element, PackageType.None, ref keyPath, componentId);
                    break;

                default:
                    this.Core.UnexpectedElement(parentElement, element);
                    break;
                }
                break;

            default:
                this.Core.UnexpectedElement(parentElement, element);
                break;
            }

            return(keyPathType);
        }