/// <summary> /// Parses a PlayTask element for Game Explorer task registration. /// </summary> /// <param name="node">The element to parse.</param> /// <param name="gameId">The game's instance identifier.</param> /// <param name="fileId">The file identifier of the game executable.</param> /// <param name="componentId">The component identifier of the game executable.</param> /// <param name="taskOrder">The order this play task should appear in Game Explorer.</param> private void ParsePlayTaskElement(XElement node, string gameId, string fileId, string componentId, int taskOrder, string componentDirectoryId) { SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); string name = null; string arguments = null; foreach (XAttribute attrib in node.Attributes()) { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) { switch (attrib.Name.LocalName) { case "Name": name = this.Core.GetAttributeValue(sourceLineNumbers, attrib, false); break; case "Arguments": arguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib, false); break; default: this.Core.UnexpectedAttribute(sourceLineNumbers, attrib); break; } } else { this.Core.ParseExtensionAttribute(node, attrib); } } this.Core.ParseForExtensionElements(node); if (null == name) { this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); } if (!this.Core.EncounteredError) { // create Shortcut rows pointing to the parent File string directoryId = this.CreateTaskDirectoryRow(sourceLineNumbers, componentId, TaskType.Play, taskOrder); Row row = this.Core.CreateRow(sourceLineNumbers, "Shortcut"); row[0] = directoryId; // just need something unique-and-stable row[1] = directoryId; row[2] = CompilerCore.IsValidShortFilename(name, false) ? name : String.Concat(this.Core.GenerateShortName(name, true, false, directoryId, name), "|", name); row[3] = componentId; row[4] = String.Format(CultureInfo.InvariantCulture, "[#{0}]", fileId); row[5] = arguments; // skipping Description, Hotkey, Icon_, IconIndex, ShowCmd row[11] = componentDirectoryId; } }