Class AttachmentInfo
References a piece of data or file attached to a crash.
Implements
Inherited Members
Namespace: CrashCABN.Metadata
Assembly: CrashCABN.Metadata.Abstractions.dll
Syntax
public sealed record AttachmentInfo : IEquatable<AttachmentInfo>
Constructors
View SourceAttachmentInfo(string, object, AttachmentType, bool)
References a piece of data or file attached to a crash.
Declaration
public AttachmentInfo(string Name, object Source, AttachmentType Type = AttachmentType.Constant, bool Custom = false)
Parameters
Type | Name | Description |
---|---|---|
string | Name | The attachment name. |
object | Source | The attachment value or location. |
AttachmentType | Type | The attachment type, a constant value by default. |
bool | Custom | Whether or not the attachment is a custom (or title-specific) one. |
Properties
View SourceCustom
Whether or not the attachment is a custom (or title-specific) one.
Declaration
public bool Custom { get; init; }
Property Value
Type | Description |
---|---|
bool |
Name
The attachment name.
Declaration
public string Name { get; init; }
Property Value
Type | Description |
---|---|
string |
Size
Declaration
[JsonIgnore]
public int? Size { get; }
Property Value
Type | Description |
---|---|
int? |
Source
The attachment value or location.
Declaration
public object Source { get; init; }
Property Value
Type | Description |
---|---|
object |
Type
The attachment type, a constant value by default.
Declaration
public AttachmentType Type { get; init; }
Property Value
Type | Description |
---|---|
AttachmentType |
Methods
View SourceGetStringValue()
Gets the attachment value as a string.
Declaration
public string GetStringValue()
Returns
Type | Description |
---|---|
string | The typed attachment value. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | If the type was incorrect. |
GetUriValue()
Gets the attachment value as a URL.
Declaration
public Uri GetUriValue()
Returns
Type | Description |
---|---|
Uri | The typed attachment value. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | If the type was incorrect. |
GetValue<T>()
Gets the attachment value or location as the given type.
Declaration
public T GetValue<T>() where T : class
Returns
Type | Description |
---|---|
T | The typed attachment value or location. |
Type Parameters
Name | Description |
---|---|
T | The type to cast to. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the type was incorrect. |
TryGetUriValue()
Attempt to get the attachment value as a URL.
Declaration
public Uri? TryGetUriValue()
Returns
Type | Description |
---|---|
Uri | The typed attachment value, or null if it could not be converted. |