Factories for templates and objects, Sztl parsing
This commit is contained in:
19
SessionZero/Data/SzDataObjectTemplate.cs
Normal file
19
SessionZero/Data/SzDataObjectTemplate.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using Tomlyn.Model;
|
||||
|
||||
namespace SessionZero.Data;
|
||||
|
||||
public class SzDataObjectTemplate : SzTemplate
|
||||
{
|
||||
public string DataType { get; set; }
|
||||
|
||||
public override void ParseAdditionalMetaData(TomlTable table)
|
||||
{
|
||||
if (!table.ContainsKey("metadata") || table["metadata"] is not TomlTable metadata) return;
|
||||
|
||||
if (metadata.TryGetValue("data_type", out var tempTypeVal))
|
||||
{
|
||||
DataType = tempTypeVal?.ToString() ?? throw new Exception("Template missing type metadata");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user