Added VDF Generator
This commit is contained in:
36
007SaveTool/VdfGenerator/KeyValue/Models/KeyValueGroup.cs
Normal file
36
007SaveTool/VdfGenerator/KeyValue/Models/KeyValueGroup.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using EonaCat.FirstLight.SaveTransfer.VdfGenerator.KeyValue.Interfaces;
|
||||
|
||||
namespace EonaCat.FirstLight.SaveTransfer.VdfGenerator.KeyValue.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a hierarchical group of key-value nodes, allowing organization of nested key-value pairs and groups.
|
||||
/// </summary>
|
||||
/// <param name="key">The key that identifies this group. Cannot be null.</param>
|
||||
public class KeyValueGroup(string key) : IKeyValueNode
|
||||
{
|
||||
public string Key { get; } = key;
|
||||
public List<IKeyValueNode> Nodes { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new key-value pair to the group.
|
||||
/// </summary>
|
||||
/// <param name="key">The key to associate with the value. Cannot be null.</param>
|
||||
/// <param name="value">The value to associate with the key. Cannot be null.</param>
|
||||
/// <returns>The current instance with the new key-value pair added.</returns>
|
||||
public KeyValueGroup Add(string key, string value)
|
||||
{
|
||||
Nodes.Add(new KeyValuePair(key, value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the specified group to the collection of nodes.
|
||||
/// </summary>
|
||||
/// <param name="group">The group to add to the collection. Cannot be null.</param>
|
||||
/// <returns>The current instance with the added group, enabling method chaining.</returns>
|
||||
public KeyValueGroup Add(KeyValueGroup group)
|
||||
{
|
||||
Nodes.Add(group);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user