コード例 #1
0
        /// <summary>
        /// Parse a feature backlink from the xml.
        /// </summary>
        /// <param name="intermediate">Intermediate to populate with persisted data.</param>
        /// <param name="reader">XmlReader where the intermediate is persisted.</param>
        /// <param name="section">Section to populate with persisted data.</param>
        private static void ParseFeatureBacklink(Intermediate intermediate, XmlReader reader, Section section)
        {
            bool   empty             = reader.IsEmptyElement;
            string targetSymbol      = null;
            string component         = null;
            FeatureBacklinkType type = FeatureBacklinkType.Unknown;

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "targetSymbol":
                    targetSymbol = reader.Value;
                    break;

                case "component":
                    component = reader.Value;
                    break;

                case "type":
                    switch (reader.Value)
                    {
                    case "Class":
                        type = FeatureBacklinkType.Class;
                        break;

                    case "Extension":
                        type = FeatureBacklinkType.Extension;
                        break;

                    case "Shortcut":
                        type = FeatureBacklinkType.Shortcut;
                        break;

                    case "PublishComponent":
                        type = FeatureBacklinkType.PublishComponent;
                        break;

                    case "TypeLib":
                        type = FeatureBacklinkType.TypeLib;
                        break;

                    default:
                        throw new WixInvalidIntermediateException(SourceLineNumberCollection.FromFileName(intermediate.Path), "Invalid FeatureBacklinkType");
                    }
                    break;
                }
            }
            if (FeatureBacklinkType.Unknown == type)
            {
                throw new WixInvalidIntermediateException(SourceLineNumberCollection.FromFileName(intermediate.Path), "Unknown FeatureBackLink type");
            }
            if (null == component)
            {
                throw new WixInvalidIntermediateException(SourceLineNumberCollection.FromFileName(intermediate.Path), "FeatureBackLink missing required attribute: 'component'");
            }
            if (null == targetSymbol)
            {
                throw new WixInvalidIntermediateException(SourceLineNumberCollection.FromFileName(intermediate.Path), "FeatureBackLink missing required attribute: 'targetSymbol'");
            }

            if (!empty && reader.Read() && XmlNodeType.EndElement != reader.MoveToContent())
            {
                throw new WixInvalidIntermediateException(SourceLineNumberCollection.FromFileName(intermediate.Path), String.Format("Unexpected content while processing 'featureBacklink': {0}", reader.NodeType.ToString()));
            }

            section.FeatureBacklinks.Add(new FeatureBacklink(component, type, targetSymbol));
        }
コード例 #2
0
 /// <summary>
 /// Creates a feature back link to the specified
 /// </summary>
 /// <param name="componentId">Identifier of component to refer to </param>
 /// <param name="type">Type of feature backlink.</param>
 /// <param name="targetSymbol">Symbol of target that refers to the feature.</param>
 public FeatureBacklink(string componentId, FeatureBacklinkType type, string targetSymbol)
 {
     this.componentId  = componentId;
     this.type         = type;
     this.targetSymbol = targetSymbol;
 }
コード例 #3
0
 /// <summary>
 /// Creates a feature back link to the specified
 /// </summary>
 /// <param name="componentId">Identifier of component to refer to </param>
 /// <param name="type">Type of feature backlink.</param>
 /// <param name="targetSymbol">Symbol of target that refers to the feature.</param>
 public FeatureBacklink(string componentId, FeatureBacklinkType type, string targetSymbol)
 {
     this.componentId = componentId;
     this.type = type;
     this.targetSymbol = targetSymbol;
 }
コード例 #4
0
 /// <summary>
 /// Creates a feature back link to the specified
 /// </summary>
 /// <param name="componentId">Identifier of component to refer to </param>
 /// <param name="type">Type of feature backlink.</param>
 /// <param name="target">Symbol that refers to the feature.</param>
 public FeatureBacklink(string componentId, FeatureBacklinkType type, Symbol target) :
     this(componentId, type, target.RowId)
 {
 }
コード例 #5
0
 /// <summary>
 /// Creates a feature back link to the specified
 /// </summary>
 /// <param name="componentId">Identifier of component to refer to </param>
 /// <param name="type">Type of feature backlink.</param>
 /// <param name="target">Symbol that refers to the feature.</param>
 public FeatureBacklink(string componentId, FeatureBacklinkType type, Symbol target)
     : this(componentId, type, target.RowId)
 {
 }