| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Data |
| 4 | { |
| 5 | using System; |
| 6 | using System.Resources; |
| 7 | |
| 8 | public static class IIsErrors |
| 9 | { |
| 10 | public static Message DeprecatedBinaryChildElement(SourceLineNumber sourceLineNumbers, string elementName) |
| 11 | { |
| 12 | return Message(sourceLineNumbers, Ids.DeprecatedBinaryChildElement, "The {0} element contains a deprecated child Binary element. Please move the Binary element under a Fragment, Module, or Product element and set the {0}/@BinaryKey attribute to the value of the Binary/@Id attribute.", elementName); |
| 13 | } |
| 14 | |
| 15 | public static Message IllegalAttributeWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName) |
| 16 | { |
| 17 | return Message(sourceLineNumbers, Ids.IllegalAttributeWithoutComponent, "The {0}/@{1} attribute cannot be specified unless the element has a Component as an ancestor. A {0} that does not have a Component ancestor is not installed.", elementName, attributeName); |
| 18 | } |
| 19 | |
| 20 | public static Message IllegalCharacterInAttributeValue(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string value, Char illegalCharacter) |
| 21 | { |
| 22 | return Message(sourceLineNumbers, Ids.IllegalCharacterInAttributeValue, "The {0}/@{1} attribute's value, '{2}', is invalid. It cannot contain the character '{3}'.", elementName, attributeName, value, illegalCharacter); |
| 23 | } |
| 24 | |
| 25 | public static Message IllegalElementWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName) |
| 26 | { |
| 27 | return Message(sourceLineNumbers, Ids.IllegalElementWithoutComponent, "The {0} element cannot be specified unless the element has a Component as an ancestor. A {0} that does not have a Component ancestor is not installed.", elementName); |
| 28 | } |
| 29 | |
| 30 | public static Message MimeMapExtensionMissingPeriod(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string attributeValue) |
| 31 | { |
| 32 | return Message(sourceLineNumbers, Ids.MimeMapExtensionMissingPeriod, "The {0}/@{1} attribute's value, '{2}', is not a valid mime map extension. It must begin with a period.", elementName, attributeName, attributeValue); |
| 33 | } |
| 34 | |
| 35 | public static Message OneOfAttributesRequiredUnderComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName1, string attributeName2, string attributeName3, string attributeName4) |
| 36 | { |
| 37 | return Message(sourceLineNumbers, Ids.OneOfAttributesRequiredUnderComponent, "When nested under a Component, the {0} element must have one of the following attributes specified: {1}, {2}, {3} or {4}.", elementName, attributeName1, attributeName2, attributeName3, attributeName4); |
| 38 | } |
| 39 | |
| 40 | public static Message RequiredAttributeUnderComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName) |
| 41 | { |
| 42 | return Message(sourceLineNumbers, Ids.RequiredAttributeUnderComponent, "The {0}/@{1} attribute must be specified when the element has a Component as an ancestor.", elementName, attributeName); |
| 43 | } |
| 44 | |
| 45 | public static Message WebApplicationAlreadySpecified(SourceLineNumber sourceLineNumbers, string elementName) |
| 46 | { |
| 47 | return Message(sourceLineNumbers, Ids.WebApplicationAlreadySpecified, "The {0} element can have at most a single WebApplication specified. This can be either through the WebApplication attribute, or through a nested WebApplication element, but not both.", elementName); |
| 48 | } |
| 49 | |
| 50 | public static Message WebSiteAttributeUnderWebSite(SourceLineNumber sourceLineNumbers, string elementName) |
| 51 | { |
| 52 | return Message(sourceLineNumbers, Ids.WebSiteAttributeUnderWebSite, "The {0}/@WebSite attribute cannot be specified when the {0} element is nested under a WebSite element.", elementName); |
| 53 | } |
| 54 | |
| 55 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) |
| 56 | { |
| 57 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); |
| 58 | } |
| 59 | |
| 60 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) |
| 61 | { |
| 62 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, resourceManager, resourceName, args); |
| 63 | } |
| 64 | |
| 65 | public enum Ids |
| 66 | { |
| 67 | MimeMapExtensionMissingPeriod = 5150, |
| 68 | IllegalAttributeWithoutComponent = 5151, |
| 69 | IllegalElementWithoutComponent = 5152, |
| 70 | OneOfAttributesRequiredUnderComponent = 5153, |
| 71 | WebSiteAttributeUnderWebSite = 5154, |
| 72 | WebApplicationAlreadySpecified = 5155, |
| 73 | IllegalCharacterInAttributeValue = 5156, |
| 74 | DeprecatedBinaryChildElement = 5157, |
| 75 | RequiredAttributeUnderComponent = 5161, |
| 76 | } |
| 77 | } |
| 78 | } |