| 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.Harvesters.Data |
| 4 | { |
| 5 | using System; |
| 6 | using System.Resources; |
| 7 | using WixToolset.Data; |
| 8 | |
| 9 | #pragma warning disable 1591 // TODO: add documentation |
| 10 | public static class HarvesterWarnings |
| 11 | { |
| 12 | public static Message AssemblyHarvestFailed(string file, string message) |
| 13 | { |
| 14 | return Message(null, Ids.AssemblyHarvestFailed, "Could not harvest data from a file that was expected to be an assembly: {0}. If this file is not an assembly you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: {1}", file, message); |
| 15 | } |
| 16 | |
| 17 | public static Message DuplicateDllRegistryEntry(string registryKey, string componentId) |
| 18 | { |
| 19 | return Message(null, Ids.DuplicateDllRegistryEntry, "Ignoring the registry key '{0}', it has already been added to the component '{1}'.", registryKey, componentId); |
| 20 | } |
| 21 | |
| 22 | public static Message DuplicateDllRegistryEntry(string registryKey, string registryKeyValue, string componentId) |
| 23 | { |
| 24 | return Message(null, Ids.DuplicateDllRegistryEntry, "Ignoring the registry key '{0}', it has already been added to the component '{2}'. The registry key value '{1}' will not be harvested.", registryKey, registryKeyValue, componentId); |
| 25 | } |
| 26 | |
| 27 | public static Message EncounteredNullDirectoryForWebSite(string directory) |
| 28 | { |
| 29 | return Message(null, Ids.EncounteredNullDirectoryForWebSite, "Could not harvest website directory: {0}. Please update the output with the appropriate directory ID before using.", directory); |
| 30 | } |
| 31 | |
| 32 | public static Message NoLogger(string exceptionMessage) |
| 33 | { |
| 34 | return Message(null, Ids.NoLogger, "Failed to set loggers: {0}", exceptionMessage); |
| 35 | } |
| 36 | |
| 37 | public static Message NoProjectConfiguration(string exceptionMessage) |
| 38 | { |
| 39 | return Message(null, Ids.NoProjectConfiguration, "Failed to set project configuration and platform: {0}", exceptionMessage); |
| 40 | } |
| 41 | |
| 42 | public static Message SelfRegHarvestFailed(string file, string message) |
| 43 | { |
| 44 | return Message(null, Ids.SelfRegHarvestFailed, "Could not harvest data from a file that was expected to be a SelfReg DLL: {0}. If this file does not support SelfReg you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: {1}", file, message); |
| 45 | } |
| 46 | |
| 47 | public static Message TypeLibLoadFailed(string file, string message) |
| 48 | { |
| 49 | return Message(null, Ids.TypeLibLoadFailed, "Could not load file that was expected to be a type library based off of file extension: {0}. If this file is not a type library you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the load failure: {1}", file, message); |
| 50 | } |
| 51 | |
| 52 | public static Message UnsupportedRegistryType(string registryValue, int regFileLineNumber, string unsupportedType) |
| 53 | { |
| 54 | return Message(null, Ids.UnsupportedRegistryType, "Ignoring the registry value '{0}' found on line {1}, because it is of a type unsupported by Windows Installer ({2}).", registryValue, regFileLineNumber, unsupportedType); |
| 55 | } |
| 56 | |
| 57 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) |
| 58 | { |
| 59 | return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); |
| 60 | } |
| 61 | |
| 62 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) |
| 63 | { |
| 64 | return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, resourceManager, resourceName, args); |
| 65 | } |
| 66 | |
| 67 | public enum Ids |
| 68 | { |
| 69 | SelfRegHarvestFailed = 5150, |
| 70 | AssemblyHarvestFailed = 5151, |
| 71 | TypeLibLoadFailed = 5152, |
| 72 | DuplicateDllRegistryEntry = 5156, |
| 73 | UnsupportedRegistryType = 5157, |
| 74 | NoProjectConfiguration = 5398, |
| 75 | NoLogger = 5399, |
| 76 | EncounteredNullDirectoryForWebSite = 5400, |
| 77 | } |
| 78 | } |
| 79 | } |