// Copyright (c) 2025-2026 GeWuYou // SPDX-License-Identifier: Apache-2.0 namespace GFramework.Game.Config; /// /// 表示一个节点上声明的 const 约束。 /// 该模型同时保留稳定比较键与原始 JSON 文本,分别供运行时匹配和诊断输出复用。 /// internal sealed class YamlConfigConstantValue { /// /// 初始化常量约束模型。 /// /// 用于与 YAML 节点比较的稳定键。 /// 用于诊断输出的原始常量文本。 /// 时抛出。 /// 虽然非空但仅包含空白字符,或 为空或仅包含空白字符时抛出。 public YamlConfigConstantValue(string comparableValue, string displayValue) { ArgumentNullException.ThrowIfNull(comparableValue); ArgumentException.ThrowIfNullOrWhiteSpace(displayValue); if (comparableValue.Length > 0 && string.IsNullOrWhiteSpace(comparableValue)) { throw new ArgumentException("The value cannot be composed entirely of whitespace.", nameof(comparableValue)); } ComparableValue = comparableValue; DisplayValue = displayValue; } /// /// 获取用于运行时比较的稳定键。 /// public string ComparableValue { get; } /// /// 获取用于诊断输出的原始 JSON 常量文本。 /// public string DisplayValue { get; } }