| 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.Util |
| 4 | { |
| 5 | using System; |
| 6 | using System.Resources; |
| 7 | using WixToolset.Data; |
| 8 | |
| 9 | public static class UtilErrors |
| 10 | { |
| 11 | public static Message IllegalAttributeWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName) |
| 12 | { |
| 13 | 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); |
| 14 | } |
| 15 | |
| 16 | public static Message IllegalElementWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName) |
| 17 | { |
| 18 | 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); |
| 19 | } |
| 20 | |
| 21 | public static Message IllegalFileValueInPerfmonOrManifest(string file, string table) |
| 22 | { |
| 23 | return Message(null, Ids.IllegalFileValueInPerfmonOrManifest, "The value '{0}' in the File column, {1} table is invalid. It should be in the form of '[#file]' or '[!file]'.", file, table); |
| 24 | } |
| 25 | |
| 26 | public static Message InvalidRegistryObject(SourceLineNumber sourceLineNumbers, string registryElementName) |
| 27 | { |
| 28 | return Message(sourceLineNumbers, Ids.InvalidRegistryObject, "The {0} element has no id and cannot have its permissions set. If you want to set permissions on a 'placeholder' registry key, force its creation by setting the ForceCreateOnInstall attribute to yes.", registryElementName); |
| 29 | } |
| 30 | |
| 31 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) |
| 32 | { |
| 33 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); |
| 34 | } |
| 35 | |
| 36 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) |
| 37 | { |
| 38 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, resourceManager, resourceName, args); |
| 39 | } |
| 40 | |
| 41 | public enum Ids |
| 42 | { |
| 43 | IllegalAttributeWithoutComponent = 5050, |
| 44 | IllegalElementWithoutComponent = 5051, |
| 45 | IllegalFileValueInPerfmonOrManifest = 5054, |
| 46 | InvalidRegistryObject = 5063, |
| 47 | } |
| 48 | } |
| 49 | } |