Class AssetReference
An asset reference.
[DataContract("aref")]
[DataStyle(DataStyle.Compact)]
[DataSerializer(typeof(AssetReferenceDataSerializer))]
public sealed class AssetReference : IReference, IEquatable<AssetReference>
- Inheritance
-
AssetReference
- Implements
- Extension Methods
Constructors
AssetReference(AssetId, UFile)
Initializes a new instance of the AssetReference class.
public AssetReference(AssetId id, UFile location)
Parameters
id
AssetIdThe unique identifier of the asset.
location
UFileThe location.
Properties
Id
Gets or sets the unique identifier of the reference asset.
[DataMember(10)]
public AssetId Id { get; init; }
Property Value
- AssetId
The unique identifier of the reference asset..
Location
Gets or sets the location of the asset.
[DataMember(20)]
public string Location { get; init; }
Property Value
- string
The location.
Methods
Equals(AssetReference)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(AssetReference other)
Parameters
other
AssetReferenceAn object to compare with this object.
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
New(AssetId, UFile)
Tries to parse an asset reference in the format "GUID:Location".
public static AssetReference New(AssetId id, UFile location)
Parameters
id
AssetIdThe identifier.
location
UFileThe location.
Returns
- AssetReference
true
if parsing was successful,false
otherwise.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TryParse(string, out AssetId, out UFile)
Tries to parse an asset reference in the format "[GUID/]GUID:Location". The first GUID is optional and is used to store the ID of the reference.
public static bool TryParse(string assetReferenceText, out AssetId id, out UFile location)
Parameters
assetReferenceText
stringThe asset reference.
id
AssetIdThe unique identifier of asset pointed by this reference.
location
UFileThe location.
Returns
- bool
true
if parsing was successful,false
otherwise.
Exceptions
- ArgumentNullException
assetReferenceText
TryParse(string, out AssetReference)
Tries to parse an asset reference in the format "GUID:Location".
public static bool TryParse(string assetReferenceText, out AssetReference assetReference)
Parameters
assetReferenceText
stringThe asset reference.
assetReference
AssetReferenceThe reference.
Returns
- bool
true
if parsing was successful,false
otherwise.
Operators
operator ==(AssetReference, AssetReference)
Implements the ==.
public static bool operator ==(AssetReference left, AssetReference right)
Parameters
left
AssetReferenceThe left.
right
AssetReferenceThe right.
Returns
- bool
The result of the operator.
operator !=(AssetReference, AssetReference)
Implements the !=.
public static bool operator !=(AssetReference left, AssetReference right)
Parameters
left
AssetReferenceThe left.
right
AssetReferenceThe right.
Returns
- bool
The result of the operator.