mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Darthification - Added missing file
Data model paths - Fixed null ref in DisplayPath
This commit is contained in:
parent
ae64db8a13
commit
b5473cfb2c
@ -111,24 +111,24 @@ namespace Artemis.Core
|
|||||||
|
|
||||||
private void Initialize(string path)
|
private void Initialize(string path)
|
||||||
{
|
{
|
||||||
var startSegment = new DataModelPathSegment(this, "target", "target");
|
DataModelPathSegment startSegment = new DataModelPathSegment(this, "target", "target");
|
||||||
startSegment.Node = _segments.AddFirst(startSegment);
|
startSegment.Node = _segments.AddFirst(startSegment);
|
||||||
|
|
||||||
var segments = path.Split(".");
|
string[] segments = path.Split(".");
|
||||||
for (var index = 0; index < segments.Length; index++)
|
for (int index = 0; index < segments.Length; index++)
|
||||||
{
|
{
|
||||||
var identifier = segments[index];
|
string identifier = segments[index];
|
||||||
var node = _segments.AddLast(new DataModelPathSegment(this, identifier, string.Join('.', segments.Take(index + 1))));
|
LinkedListNode<DataModelPathSegment> node = _segments.AddLast(new DataModelPathSegment(this, identifier, string.Join('.', segments.Take(index + 1))));
|
||||||
node.Value.Node = node;
|
node.Value.Node = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parameter = Expression.Parameter(typeof(object), "t");
|
ParameterExpression parameter = Expression.Parameter(typeof(object), "t");
|
||||||
Expression expression = Expression.Convert(parameter, Target.GetType());
|
Expression expression = Expression.Convert(parameter, Target.GetType());
|
||||||
Expression nullCondition = null;
|
Expression nullCondition = null;
|
||||||
|
|
||||||
foreach (var segment in _segments)
|
foreach (DataModelPathSegment segment in _segments)
|
||||||
{
|
{
|
||||||
var notNull = Expression.NotEqual(expression, Expression.Default(expression.Type));
|
BinaryExpression notNull = Expression.NotEqual(expression, Expression.Default(expression.Type));
|
||||||
nullCondition = nullCondition != null ? Expression.AndAlso(nullCondition, notNull) : notNull;
|
nullCondition = nullCondition != null ? Expression.AndAlso(nullCondition, notNull) : notNull;
|
||||||
expression = segment.Initialize(parameter, expression, nullCondition);
|
expression = segment.Initialize(parameter, expression, nullCondition);
|
||||||
if (expression == null)
|
if (expression == null)
|
||||||
|
|||||||
@ -81,7 +81,7 @@ namespace Artemis.UI.Shared
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual string DisplayPath => Path.Replace(".", " › ");
|
public virtual string DisplayPath => Path?.Replace(".", " › ");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the datamodel and if in an parent, any children
|
/// Updates the datamodel and if in an parent, any children
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user