Editor/Embedded/ValveResourceFormat/Blocks/ResourceEditInfoStructs/ArgumentDependency.cs

Data model type used by the editor resource parsing code. It represents an argument dependency with a parameter name, parameter type, and two 32-bit fingerprint fields, and provides constructors to read from a BinaryReader or from a KeyValues KVObject.

File Access
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.Utils;
using System.IO;
using System.Text;
using HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.Serialization.KeyValues;

namespace HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.Blocks.ResourceEditInfoStructs;

    /// <summary>
    /// Represents an argument dependency.
    /// </summary>
    public class ArgumentDependency
    {
        /// <summary>
        /// Gets or sets the parameter name.
        /// </summary>
        public string ParameterName { get; set; }

        /// <summary>
        /// Gets or sets the parameter type.
        /// </summary>
        public string ParameterType { get; set; }

        /// <summary>
        /// Gets or sets the fingerprint.
        /// </summary>
        public uint Fingerprint { get; set; }

        /// <summary>
        /// Gets or sets the default fingerprint.
        /// </summary>
        public uint FingerprintDefault { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ArgumentDependency"/> class from a binary reader.
        /// </summary>
        public ArgumentDependency(BinaryReader reader)
        {
            ParameterName = reader.ReadOffsetString(Encoding.UTF8);
            ParameterType = reader.ReadOffsetString(Encoding.UTF8);
            Fingerprint = reader.ReadUInt32();
            FingerprintDefault = reader.ReadUInt32();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ArgumentDependency"/> class from a KV object.
        /// </summary>
        public ArgumentDependency(KVObject data)
        {
            ParameterName = data.GetProperty<string>("m_ParameterName");
            ParameterType = data.GetProperty<string>("m_ParameterType");
            Fingerprint = data.GetUInt32Property("m_nFingerprint");
            FingerprintDefault = data.GetUInt32Property("m_nFingerprintDefault");
        }
    }