Kit.Core/LibCommon/Kit.Core.Helpers/Exception/XmlFormatException.cs

53 lines
1.7 KiB
C#

using System;
namespace Kit.Helpers
{
public class XmlFormatExceptionItem
{
public string Type { get; set; }
public int Line { get; set; }
public int Position { get; set; }
public string Message { get; set; }
}
public class XmlFormatException : Exception
{
public IEnumerable<XmlFormatExceptionItem> Errors { get; set; }
public XmlFormatException() { }
public XmlFormatException(IEnumerable<XmlFormatExceptionItem> errors)
{
Errors = errors;
}
}
public enum ValidateMessageType { Info = 1, Warning = 2, Error = 3 }
public class XmlValidateMessage
{
private static IDictionary<Enum, string> MessageTypeDecoding = new Dictionary<Enum, string>()
{
{ValidateMessageType.Info, "Информация"},
{ValidateMessageType.Warning, "Предупреждение"},
{ValidateMessageType.Error, "Ошибка"}
};
public string DecodedMessageType
{
get
{
string value;
if (MessageTypeDecoding.TryGetValue(MessageType, out value)) return value;
else throw new ArgumentOutOfRangeException("MessageType");
}
}
public ValidateMessageType MessageType { get; set; }
public string ValidatorName { get; set; }
public string Message { get; set; }
public IEnumerable<ParameterValue> Parameters { get; set; }
}
public class ParameterValue
{
public string Title { get; set; }
public string Name { get; set; }
public string Value { get; set; }
}
}