| 1234567891011121314151617181920212223242526272829303132 |
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace InABox.Core
- {
- public class ExpressionEditor : BaseEditor
- {
- /// <summary>
- /// The <see cref="IExpressionModel"/> to use for this expression; if set to null, the variables must be manually set for the editor.
- /// </summary>
- public Type? ModelType { get; set; }
- [DoNotSerialize]
- [JsonIgnore]
- public List<string>? VariableNames { get; set; }
- public ExpressionEditor(Type? modelType)
- {
- if (modelType != null && !typeof(IExpressionModel).IsAssignableFrom(modelType))
- throw new Exception($"Expression type must be a {nameof(IExpressionModel)}");
- ModelType = modelType;
- }
- protected override BaseEditor DoClone()
- {
- return new ExpressionEditor(ModelType);
- }
- }
- }
|