SessionZeroWasm/SessionZero/Data/SzfObjectAttribute.cs

27 lines
947 B
C#

using System;
namespace SessionZero.Data;
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class SzfObjectAttribute : Attribute
{
/// <summary>
/// The unique string identifier for the SzfObject type (e.g., "dataset", "character_template", "character").
/// This is used in the `!type:` header of .szf files.
/// </summary>
public string TypeIdentifier { get; }
/// <summary>
/// Initializes a new instance of the <see cref="SzfObjectAttribute"/> class.
/// </summary>
/// <param name="typeIdentifier">The unique string identifier for the SzfObject type.</param>
public SzfObjectAttribute(string typeIdentifier)
{
if (string.IsNullOrWhiteSpace(typeIdentifier))
{
throw new ArgumentException("Type identifier cannot be null or whitespace.", nameof(typeIdentifier));
}
TypeIdentifier = typeIdentifier;
}
}