コード例 #1
0
        /// <summary>
        /// Parses a SupportTask 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="componentId">The component identifier of the game executable.</param>
        /// <param name="taskOrder">The order this support task should appear in Game Explorer.</param>
        private void ParseSupportTaskElement(Intermediate intermediate, IntermediateSection section, XElement node, string gameId, string componentId, int taskOrder)
        {
            var    sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
            string name    = null;
            string address = null;

            foreach (var attrib in node.Attributes())
            {
                if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
                {
                    switch (attrib.Name.LocalName)
                    {
                    case "Name":
                        name = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
                        break;

                    case "Address":
                        address = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
                        break;

                    default:
                        this.ParseHelper.UnexpectedAttribute(node, attrib);
                        break;
                    }
                }
                else
                {
                    this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib);
                }
            }

            this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node);

            if (null == name)
            {
                this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name"));
            }

            if (null == address)
            {
                this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Address"));
            }

            if (!this.Messaging.EncounteredError)
            {
                // create support shortcuts as WixUtilExtension's WixInternetShortcut rows;
                // use the directory ID as the shortcut ID because Game Explorer wants one
                // shortcut per directory, so that makes the directory ID unique
                var directoryId = this.CreateTaskDirectoryRow(section, sourceLineNumbers, componentId, TaskType.Support, taskOrder);
#if TODO_CREATE_SHORTCUT
                UtilCompiler.CreateWixInternetShortcut(this.Core, sourceLineNumbers, componentId, directoryId, directoryId, name, address, UtilCompiler.InternetShortcutType.Link, null, 0);
#endif
                throw new NotImplementedException();
            }
        }
コード例 #2
0
        /// <summary>
        /// Parses a SupportTask 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="componentId">The component identifier of the game executable.</param>
        /// <param name="taskOrder">The order this support task should appear in Game Explorer.</param>
        private void ParseSupportTaskElement(XElement node, string gameId, string componentId, int taskOrder)
        {
            SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
            string           name    = null;
            string           address = 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);
                        break;

                    case "Address":
                        address = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
                        break;

                    default:
                        this.Core.UnexpectedAttribute(node, 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 (null == address)
            {
                this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Address"));
            }

            if (!this.Core.EncounteredError)
            {
                // create support shortcuts as WixUtilExtension's WixInternetShortcut rows;
                // use the directory ID as the shortcut ID because Game Explorer wants one
                // shortcut per directory, so that makes the directory ID unique
                string directoryId = this.CreateTaskDirectoryRow(sourceLineNumbers, componentId, TaskType.Support, taskOrder);
                UtilCompiler.CreateWixInternetShortcut(this.Core, sourceLineNumbers, componentId, directoryId, directoryId, name, address, UtilCompiler.InternetShortcutType.Link, null, 0);
            }
        }