Working on data and sztl
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using SessionZero.Data.Sztl;
|
||||
|
||||
namespace SessionZero.Data;
|
||||
|
||||
public class Dataset
|
||||
{
|
||||
public required DatasetMetadata Metadata { get; set; }
|
||||
public Dictionary<string, SztlField> Fields { get; set; } = [];
|
||||
public Dictionary<string, SztlFieldGroup> Groups { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Returns an SzfField from a string path (use dot notation, eg 'stats.damage')
|
||||
/// </summary>
|
||||
/// <param name="fieldPath"></param>
|
||||
/// <returns></returns>
|
||||
public SztlField? GetField(string fieldPath)
|
||||
{
|
||||
var split = fieldPath.Split('.');
|
||||
var fieldName = split[0];
|
||||
|
||||
if (split.Length == 1)
|
||||
{
|
||||
return Fields.GetValueOrDefault(fieldName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Todo: Recurse into Groups.Fields to find the path
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user