-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVaultCode.cs
More file actions
70 lines (55 loc) · 1.68 KB
/
VaultCode.cs
File metadata and controls
70 lines (55 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
namespace VaultExceptionParser2023
{
using System.ComponentModel;
internal class VaultCode : ICode
{
public VaultCode(int code, string name, string description)
{
Code = code;
Name = name;
Description = description;
}
#region enumeration
/// <summary>
/// The type of Code returned from Vault.
/// </summary>
public enum eCodeType
{
/// <summary>
/// The Code is an Error returned from Vault.
/// </summary>
[FieldStringValue("Error")]
Error,
/// <summary>
/// The code is related to a Restriction (Failed permission to do something in Vault).
/// </summary>
[FieldStringValue("Restriction")]
Restriction
}
#endregion
/// <summary>
/// Vault Error Code.
/// </summary>
public int Code { get; }
/// <summary>
/// Vault Error Name.
/// </summary>
public string Name { get; } = string.Empty;
/// <summary>
/// Vault Error Description.
/// </summary>
public string Description { get; } = string.Empty ;
/// <summary>
/// The type of code, Error or Restriction.
/// </summary>
public eCodeType Type { get; }
/// <summary>
/// The Vault Year Version of the Error or Restriction code.
/// </summary>
public int Year { get; }
public override string ToString()
{
return $"{Type.GetCodeTypeString()}: {Name} ({Code}) - {Description.EndWithPeriod()}";
}
}
}