/// <summary> /// Adds a feature connection to the collection. /// </summary> /// <param name="connection">Feature connection to add.</param> public void Add(ConnectToFeature connection) { if (null == connection) { throw new ArgumentNullException("connection"); } this.collection.Add(connection.ChildId, connection); }
/// <summary> /// Adds a feature connection to the collection. /// </summary> /// <param name="connection">Feature connection to add.</param> public void Add(ConnectToFeature connection) { if (null == connection) { throw new ArgumentNullException("connection"); } this.collection.Add(connection.ChildId, connection); }
/// <summary> /// Reads all of the component to features entries out of the xml. /// </summary> /// <param name="output">Output object to add the connection.</param> /// <param name="reader">Xml reader.</param> private static void ParseConnectToFeatures(Output output, XmlReader reader) { Debug.Assert("componentsToFeatures" == reader.LocalName || "featuresToFeatures" == reader.LocalName || "modulesToFeatures" == reader.LocalName); string elementLocalName = reader.LocalName; bool empty = reader.IsEmptyElement; if (!empty) { bool done = false; // loop through all the fields in a row while (!done && reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case "connectToFeature": switch (elementLocalName) { case "componentsToFeatures": output.componentsToFeatures.Add(ConnectToFeature.Parse(reader)); break; case "featuresToFeatures": output.featuresToFeatures.Add(ConnectToFeature.Parse(reader)); break; case "modulesToFeatures": output.modulesToFeatures.Add(ConnectToFeature.Parse(reader)); break; } break; default: throw new WixParseException(String.Format("The {0} element contains an unexpected child element {1}.", elementLocalName, reader.Name)); } break; case XmlNodeType.EndElement: done = true; break; } } if (!done) { throw new WixParseException(String.Format("Missing end element while processing the {0} element.", elementLocalName)); } } }
/// <summary> /// Processes an XmlReader and builds up the feature connection object. /// </summary> /// <param name="reader">Reader to get data from.</param> /// <returns>ConnectToFeature object.</returns> internal static ConnectToFeature Parse(XmlReader reader) { Debug.Assert("connectToFeature" == reader.LocalName); string childId = null; string primaryFeature = null; bool explicitPrimaryFeature = false; bool empty = reader.IsEmptyElement; while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "childId": childId = reader.Value; break; case "primaryFeature": primaryFeature = reader.Value; break; case "explicitPrimaryFeature": explicitPrimaryFeature = Common.IsYes(reader.Value, null, "connectToFeature", reader.Name, childId); break; default: throw new WixParseException(String.Format("The connectToFeature element contains an unexpected attribute {0}.", reader.Name)); } } if (null == childId) { throw new WixParseException(String.Format("The connectToFeature/@childId attribute was not found; it is required.")); } if (null == primaryFeature) { throw new WixParseException(String.Format("The connectToFeature/@primaryFeature attribute was not found; it is required.")); } ConnectToFeature ctf = new ConnectToFeature(null, childId, primaryFeature, explicitPrimaryFeature); if (!empty) { bool done = false; // loop through all the fields in a row while (!done && reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case "feature": ctf.connectFeatures.Add(reader.ReadString()); break; default: throw new WixParseException(String.Format("The connectToFeature element contains an unexpected child element {0}.", reader.Name)); } break; case XmlNodeType.EndElement: done = true; break; } } if (!done) { throw new WixParseException("Missing end element while processing the connectToFeature element."); } } return(ctf); }
/// <summary> /// Processes an XmlReader and builds up the feature connection object. /// </summary> /// <param name="reader">Reader to get data from.</param> /// <returns>ConnectToFeature object.</returns> internal static ConnectToFeature Parse(XmlReader reader) { Debug.Assert("connectToFeature" == reader.LocalName); string childId = null; string primaryFeature = null; bool explicitPrimaryFeature = false; bool empty = reader.IsEmptyElement; while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "childId": childId = reader.Value; break; case "primaryFeature": primaryFeature = reader.Value; break; case "explicitPrimaryFeature": explicitPrimaryFeature = Common.IsYes(reader.Value, null, "connectToFeature", reader.Name, childId); break; default: throw new WixParseException(String.Format("The connectToFeature element contains an unexpected attribute {0}.", reader.Name)); } } if (null == childId) { throw new WixParseException(String.Format("The connectToFeature/@childId attribute was not found; it is required.")); } if (null == primaryFeature) { throw new WixParseException(String.Format("The connectToFeature/@primaryFeature attribute was not found; it is required.")); } ConnectToFeature ctf = new ConnectToFeature(null, childId, primaryFeature, explicitPrimaryFeature); if (!empty) { bool done = false; // loop through all the fields in a row while (!done && reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case "feature": ctf.connectFeatures.Add(reader.ReadString()); break; default: throw new WixParseException(String.Format("The connectToFeature element contains an unexpected child element {0}.", reader.Name)); } break; case XmlNodeType.EndElement: done = true; break; } } if (!done) { throw new WixParseException("Missing end element while processing the connectToFeature element."); } } return ctf; }