1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Datamodel - Prepping for some API expansions

This commit is contained in:
Robert 2021-06-11 13:05:43 +02:00
parent 225b9752a8
commit 222fddd749

View File

@ -1,10 +1,9 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using Artemis.Core.Modules;
using Humanizer;
using Newtonsoft.Json;
using Module = Artemis.Core.Modules.Module;
@ -16,6 +15,7 @@ namespace Artemis.Core.DataModelExpansions
/// </summary>
public abstract class DataModel
{
private readonly List<DataModelPath> _activePaths = new();
private readonly Dictionary<string, DynamicChild> _dynamicChildren = new();
/// <summary>
@ -54,6 +54,11 @@ namespace Artemis.Core.DataModelExpansions
[DataModelIgnore]
public ReadOnlyDictionary<string, DynamicChild> DynamicChildren => new(_dynamicChildren);
/// <summary>
/// Gets a read-only list of <see cref="DataModelPath" />s targeting this data model
/// </summary>
public ReadOnlyCollection<DataModelPath> ActivePaths => _activePaths.AsReadOnly();
/// <summary>
/// Returns a read-only collection of all properties in this datamodel that are to be ignored
/// </summary>
@ -277,5 +282,20 @@ namespace Artemis.Core.DataModelExpansions
}
#endregion
#region Paths
internal void AddDataModelPath(DataModelPath path)
{
if (!_activePaths.Contains(path))
_activePaths.Add(path);
}
internal void RemoveDataModelPath(DataModelPath path)
{
_activePaths.Remove(path);
}
#endregion
}
}