示例#1
0
        public EditorField(EditorSession session, FieldInformation field, JProperty json)
        {
            Session = session;
            Field   = field;

            if (field.Type != "JObject")
            {
                FieldType = session.Manifest.GetTypeInformation(field.Type);
                if (FieldType == null)
                {
                    throw new InvalidOperationException($"Failed to find type for {field.Type}");
                }
            }
            else
            {
                string typeName = json.Parent["Type"].ToString();
                FieldType = session.Manifest.GetTypeInformation(typeName);
                if (FieldType == null)
                {
                    throw new InvalidOperationException($"Failed to find type for {typeName}");
                }
            }

            this.json = json;
            features  = new List <object>();

            valueInternal = session.CreateValue(FieldType, field.Wrapper, json.Value);
        }
示例#2
0
        public EditorKeyValuePair(EditorSession session, TypeInformation valueType, JProperty json)
        {
            Session   = session;
            ValueType = valueType;

            this.json = json;

            Value = session.CreateValue(valueType, null, json.Value);
        }
示例#3
0
        public EditorList(EditorSession session, TypeInformation elementType, JToken json)
        {
            Session     = session;
            ElementType = elementType;
            this.json   = json;

            Elements = new List <IEditorValue>();

            foreach (var element in json)
            {
                Elements.Add(Session.CreateValue(elementType, null, element));
            }
        }