| | 1 | | using System.Globalization; |
| | 2 | | using System.Resources; |
| | 3 | |
|
| | 4 | | namespace ValidateLib.ErrorsAndWarnings.Warnings |
| | 5 | | { |
| | 6 | | public class Warning : ErrorOrWarning |
| | 7 | | { |
| 1 | 8 | | public string? AdditionalInfo { get; set; } |
| 1 | 9 | | public static ResourceManager WarningManager = new ResourceManager(EWConstants.WarningResources, typeof(Warning) |
| 0 | 10 | | static ResourceManager _ResourceManager { get; set; } = |
| 1 | 11 | | new ResourceManager(EWConstants.PathToResources, typeof(Warning).Assembly); |
| | 12 | | /// <summary> |
| | 13 | | /// Prefix of warning message. Currently empty. |
| | 14 | | /// </summary> |
| 1 | 15 | | protected string WarningMessagePrefix { get; set; } = ""; |
| | 16 | | /// <summary> |
| | 17 | | /// Returns localized error message with parameters formated in the string. |
| | 18 | | /// </summary> |
| | 19 | | /// <param name="className"> Name of the class that is index in the .resx file.</param> |
| | 20 | | /// <param name="cultureInfo"> Culture in which we want to have localized the message.</param> |
| | 21 | | /// <param name="stringArgs"> Arguments of the message. </param> |
| | 22 | | /// <returns> Localized error message. </returns> |
| | 23 | | protected string GetMessageWithParams(string className, CultureInfo cultureInfo, params object?[] stringArgs) |
| | 24 | | { |
| 1 | 25 | | string message = WarningMessagePrefix + WarningManager.GetString(className, cultureInfo)!; |
| 1 | 26 | | return string.Format(message, stringArgs); |
| | 27 | | } |
| | 28 | | public override ErrorType GetErrorType() |
| | 29 | | { |
| 1 | 30 | | return ErrorType.WARNING; |
| | 31 | | } |
| | 32 | |
|
| | 33 | |
|
| | 34 | | } |
| | 35 | | } |