diff options
Diffstat (limited to 'src/wixext/UtilErrors.cs')
-rw-r--r-- | src/wixext/UtilErrors.cs | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/src/wixext/UtilErrors.cs b/src/wixext/UtilErrors.cs new file mode 100644 index 00000000..988b8321 --- /dev/null +++ b/src/wixext/UtilErrors.cs | |||
@@ -0,0 +1,109 @@ | |||
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 ArgumentRequiresValue(string argument) | ||
12 | { | ||
13 | return Message(null, Ids.ArgumentRequiresValue, "The argument '{0}' does not have a value specified and it is required.", argument); | ||
14 | } | ||
15 | |||
16 | public static Message CircularSearchReference(string chain) | ||
17 | { | ||
18 | return Message(null, Ids.CircularSearchReference, "A circular reference of search ordering constraints was detected: {0}. Search ordering references must form a directed acyclic graph.", chain); | ||
19 | } | ||
20 | |||
21 | public static Message DirectoryNotFound(string directory) | ||
22 | { | ||
23 | return Message(null, Ids.DirectoryNotFound, "The directory '{0}' could not be found.", directory); | ||
24 | } | ||
25 | |||
26 | public static Message EmptyDirectory(string directory) | ||
27 | { | ||
28 | return Message(null, Ids.EmptyDirectory, "The directory '{0}' did not contain any files or sub-directories and since empty directories are not being kept, there was nothing to harvest.", directory); | ||
29 | } | ||
30 | |||
31 | public static Message ErrorTransformingHarvestedWiX(string transform, string message) | ||
32 | { | ||
33 | return Message(null, Ids.ErrorTransformingHarvestedWiX, "Error applying transform {0} to harvested WiX: {1}", transform, message); | ||
34 | } | ||
35 | |||
36 | public static Message FileNotFound(string file) | ||
37 | { | ||
38 | return Message(null, Ids.FileNotFound, "The file '{0}' cannot be found.", file); | ||
39 | } | ||
40 | |||
41 | public static Message IllegalAttributeWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName) | ||
42 | { | ||
43 | 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); | ||
44 | } | ||
45 | |||
46 | public static Message IllegalElementWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName) | ||
47 | { | ||
48 | 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); | ||
49 | } | ||
50 | |||
51 | public static Message IllegalFileValueInPerfmonOrManifest(string file, string table) | ||
52 | { | ||
53 | 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); | ||
54 | } | ||
55 | |||
56 | public static Message InvalidRegistryObject(SourceLineNumber sourceLineNumbers, string registryElementName) | ||
57 | { | ||
58 | 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); | ||
59 | } | ||
60 | |||
61 | public static Message PerformanceCategoryNotFound(string key) | ||
62 | { | ||
63 | return Message(null, Ids.PerformanceCategoryNotFound, "Performance category '{0}' not found.", key); | ||
64 | } | ||
65 | |||
66 | public static Message SpacesNotAllowedInArgumentValue(string arg, string value) | ||
67 | { | ||
68 | return Message(null, Ids.SpacesNotAllowedInArgumentValue, "The switch '{0}' does not allow the spaces from the value. Please remove the spaces in from the value: {1}", arg, value); | ||
69 | } | ||
70 | |||
71 | public static Message UnableToOpenRegistryKey(string key) | ||
72 | { | ||
73 | return Message(null, Ids.UnableToOpenRegistryKey, "Unable to open registry key '{0}'.", key); | ||
74 | } | ||
75 | |||
76 | public static Message UnsupportedPerformanceCounterType(string key) | ||
77 | { | ||
78 | return Message(null, Ids.UnsupportedPerformanceCounterType, "Unsupported performance counter type '{0}'.", key); | ||
79 | } | ||
80 | |||
81 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) | ||
82 | { | ||
83 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); | ||
84 | } | ||
85 | |||
86 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) | ||
87 | { | ||
88 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, resourceManager, resourceName, args); | ||
89 | } | ||
90 | |||
91 | public enum Ids | ||
92 | { | ||
93 | IllegalAttributeWithoutComponent = 5050, | ||
94 | IllegalElementWithoutComponent = 5051, | ||
95 | DirectoryNotFound = 5052, | ||
96 | EmptyDirectory = 5053, | ||
97 | IllegalFileValueInPerfmonOrManifest = 5054, | ||
98 | ErrorTransformingHarvestedWiX = 5055, | ||
99 | UnableToOpenRegistryKey = 5056, | ||
100 | SpacesNotAllowedInArgumentValue = 5057, | ||
101 | ArgumentRequiresValue = 5058, | ||
102 | FileNotFound = 5059, | ||
103 | PerformanceCategoryNotFound = 5060, | ||
104 | UnsupportedPerformanceCounterType = 5061, | ||
105 | CircularSearchReference = 5062, | ||
106 | InvalidRegistryObject = 5063, | ||
107 | } | ||
108 | } | ||
109 | } | ||