Editor/Embedded/ValveResourceFormat/Serialization/KeyValues/KV3ID.cs

The KV3ID record struct stores a name and a unique identifier for resources in the editor. It implements a custom string representation that formats the name and GUID.

#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.Utils;
namespace HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.Serialization.KeyValues;

/// <summary>
/// Represents a <see cref="KeyValues3"/> identifier with a name and GUID.
/// </summary>
public readonly record struct KV3ID(string Name, Guid Id)
{
    /// <inheritdoc/>
    /// <remarks>
    /// Returns the <see cref="KV3ID"/> in the format "Name:version{Guid}".
    /// </remarks>
    public override string ToString()
    {
        return $"{Name}:version{{{Id}}}";
    }
}