| | 1 | | using SharpHoundCommonLib.Enums; |
| | 2 | |
|
| | 3 | | namespace SharpHoundCommonLib.OutputTypes |
| | 4 | | { |
| | 5 | | public class TypedPrincipal |
| | 6 | | { |
| 35 | 7 | | public TypedPrincipal() |
| 35 | 8 | | { |
| 35 | 9 | | } |
| | 10 | |
|
| 164 | 11 | | public TypedPrincipal(string objectIdentifier, Label type) |
| 164 | 12 | | { |
| 164 | 13 | | ObjectIdentifier = objectIdentifier; |
| 164 | 14 | | ObjectType = type; |
| 164 | 15 | | } |
| | 16 | |
|
| 372 | 17 | | public string ObjectIdentifier { get; set; } |
| 376 | 18 | | public Label ObjectType { get; set; } |
| | 19 | |
|
| | 20 | | public override string ToString() |
| 8 | 21 | | { |
| 8 | 22 | | return $"{ObjectIdentifier} - {ObjectType}"; |
| 8 | 23 | | } |
| | 24 | |
|
| | 25 | | protected bool Equals(TypedPrincipal other) |
| 21 | 26 | | { |
| 21 | 27 | | return ObjectIdentifier == other.ObjectIdentifier && ObjectType == other.ObjectType; |
| 21 | 28 | | } |
| | 29 | |
|
| | 30 | | public override bool Equals(object obj) |
| 21 | 31 | | { |
| 21 | 32 | | if (ReferenceEquals(null, obj)) return false; |
| 21 | 33 | | if (ReferenceEquals(this, obj)) return true; |
| 21 | 34 | | if (obj.GetType() != GetType()) return false; |
| 21 | 35 | | return Equals((TypedPrincipal) obj); |
| 21 | 36 | | } |
| | 37 | |
|
| | 38 | | public override int GetHashCode() |
| 11 | 39 | | { |
| | 40 | | unchecked |
| 11 | 41 | | { |
| 11 | 42 | | return ((ObjectIdentifier != null ? ObjectIdentifier.GetHashCode() : 0) * 397) ^ (int) ObjectType; |
| | 43 | | } |
| 11 | 44 | | } |
| | 45 | | } |
| | 46 | | } |