diff --git a/ProjectObsidian/Elements/JsonTypes.cs b/ProjectObsidian/Elements/JsonTypes.cs index 108b605..158841d 100644 --- a/ProjectObsidian/Elements/JsonTypes.cs +++ b/ProjectObsidian/Elements/JsonTypes.cs @@ -23,15 +23,19 @@ public static class JsonTypeHelper typeof(long), typeof(ulong), typeof(float), typeof(double), typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), }; - public static readonly Type[] ValidValueGetTypes = + public static readonly Type[] ValidValueTypes = { typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double) }; - public static readonly Type[] ValidObjectTypes = + public static readonly Type[] ValidObjectGetTypes = { typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), }; + public static readonly Type[] ValidObjectSetTypes = + { + typeof(string), typeof(Uri), typeof(IJsonToken), typeof(JsonObject), typeof(JsonArray), + }; } [DataModelType] diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs new file mode 100644 index 0000000..e50f4a0 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs @@ -0,0 +1,34 @@ +using System; +using System.Linq; +using Newtonsoft.Json.Linq; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; +using Elements.Core; +using FrooxEngine; +using FrooxEngine.ProtoFlux; +using Obsidian.Elements; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; + +[NodeName("Add To Object")] +[NodeCategory("Obsidian/Json")] +[GenericTypes(typeof(string), typeof(Uri), typeof(IJsonToken), typeof(JsonObject), typeof(JsonArray))] +public class JsonAddObjectToObjectNode : ObjectFunctionNode where T : class +{ + public readonly ObjectInput Input; + public readonly ObjectInput Tag; + public readonly ObjectInput Object; + + public static bool IsValidGenericType => JsonTypeHelper.ValidObjectSetTypes.Contains(typeof(T)); + + protected override JsonObject Compute(FrooxEngineContext context) + { + var input = Input.Evaluate(context); + if (input == null) return null; + + var tag = Tag.Evaluate(context); + var obj = Object.Evaluate(context); + + return string.IsNullOrEmpty(tag) ? input : input.Add(tag, obj); + } +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAddToObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs similarity index 68% rename from ProjectObsidian/ProtoFlux/JSON/JsonAddToObjectNode.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs index 867e749..ddea561 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonAddToObjectNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using Newtonsoft.Json.Linq; using ProtoFlux.Core; @@ -13,15 +13,14 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; [NodeName("Add To Object")] [NodeCategory("Obsidian/Json")] [GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), - typeof(long), typeof(ulong), typeof(float), typeof(double), typeof(string), typeof(Uri), - typeof(IJsonToken), typeof(JsonObject), typeof(JsonArray))] -public class JsonAddToObjectNode : ObjectFunctionNode + typeof(long), typeof(ulong), typeof(float), typeof(double))] +public class JsonAddValueToObjectNode : ObjectFunctionNode where T : unmanaged { public readonly ObjectInput Input; public readonly ObjectInput Tag; - public readonly ObjectInput Object; + public readonly ValueInput Object; - public static bool IsValidGenericType => JsonTypeHelper.AllValidTypes.Contains(typeof(T)); + public static bool IsValidGenericType => JsonTypeHelper.ValidValueTypes.Contains(typeof(T)); protected override JsonObject Compute(FrooxEngineContext context) { @@ -33,4 +32,4 @@ protected override JsonObject Compute(FrooxEngineContext context) return string.IsNullOrEmpty(tag) ? input : input.Add(tag, obj); } -} \ No newline at end of file +} diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs new file mode 100644 index 0000000..dbdfdd2 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs @@ -0,0 +1,28 @@ +using System; +using System.Linq; +using Newtonsoft.Json.Linq; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; +using FrooxEngine; +using Elements.Core; +using FrooxEngine.ProtoFlux; +using Obsidian.Elements; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; + +[NodeName("Append To Array")] +[NodeCategory("Obsidian/Json")] +[GenericTypes(typeof(string), typeof(Uri), typeof(IJsonToken), typeof(JsonObject), typeof(JsonArray))] +public class JsonAppendObjectToArrayNode : ObjectFunctionNode where T : class +{ + public readonly ObjectInput Array; + public readonly ObjectInput Object; + + public static bool IsValidGenericType => JsonTypeHelper.ValidObjectSetTypes.Contains(typeof(T)); + protected override JsonArray Compute(FrooxEngineContext context) + { + var array = Array.Evaluate(context); + var obj = Object.Evaluate(context); + return array?.Append(obj); + } +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAppendToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs similarity index 62% rename from ProjectObsidian/ProtoFlux/JSON/JsonAppendToArrayNode.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs index d5d3781..c4b499c 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonAppendToArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using Newtonsoft.Json.Linq; using ProtoFlux.Core; @@ -10,16 +10,16 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; +[NodeName("Append To Array")] [NodeCategory("Obsidian/Json")] [GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), - typeof(ulong), typeof(float), typeof(double), typeof(string), typeof(Uri), typeof(IJsonToken), typeof(JsonObject), - typeof(JsonArray))] -public class JsonAppendToArrayNode : ObjectFunctionNode + typeof(ulong), typeof(float), typeof(double))] +public class JsonAppendValueToArrayNode : ObjectFunctionNode where T : unmanaged { public readonly ObjectInput Array; - public readonly ObjectInput Object; - - public static bool IsValidGenericType => JsonTypeHelper.AllValidTypes.Contains(typeof(T)); + public readonly ValueInput Object; + + public static bool IsValidGenericType => JsonTypeHelper.ValidValueTypes.Contains(typeof(T)); protected override JsonArray Compute(FrooxEngineContext context) { var array = Array.Evaluate(context); diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs index 21d25ec..8ca21a0 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonCountArrayChildrenNode.cs @@ -7,6 +7,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { + [NodeName("Count")] [NodeCategory("Obsidian/Json")] public class JsonCountArrayChildrenNode : ValueFunctionNode { diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs index 0002bdf..33b374e 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonCountObjectChildrenNode.cs @@ -6,6 +6,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json { + [NodeName("Count")] [NodeCategory("Obsidian/Json")] public class JsonCountObjectChildrenNode : ValueFunctionNode { diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonEmptyArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonEmptyArrayNode.cs new file mode 100644 index 0000000..33d3cb3 --- /dev/null +++ b/ProjectObsidian/ProtoFlux/JSON/JsonEmptyArrayNode.cs @@ -0,0 +1,14 @@ +using FrooxEngine.ProtoFlux; +using Newtonsoft.Json.Linq; +using Obsidian.Elements; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; + +[NodeName("Empty JsonArray")] +[NodeCategory("Obsidian/Json")] +public class JsonEmptyArrayNode : ObjectFunctionNode +{ + protected override JsonArray Compute(FrooxEngineContext context) => new(new JArray()); +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonEmpty.cs b/ProjectObsidian/ProtoFlux/JSON/JsonEmptyObjectNode.cs similarity index 66% rename from ProjectObsidian/ProtoFlux/JSON/JsonEmpty.cs rename to ProjectObsidian/ProtoFlux/JSON/JsonEmptyObjectNode.cs index 9b1de8b..15182d1 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonEmpty.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonEmptyObjectNode.cs @@ -6,14 +6,9 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; +[NodeName("Empty JsonObject")] [NodeCategory("Obsidian/Json")] public class JsonEmptyObjectNode : ObjectFunctionNode { protected override JsonObject Compute(FrooxEngineContext context) => new(new JObject()); -} - -[NodeCategory("Obsidian/Json")] -public class JsonEmptyArrayNode : ObjectFunctionNode -{ - protected override JsonArray Compute(FrooxEngineContext context) => new(new JArray()); } \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs index 180061f..caf3b75 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs @@ -10,13 +10,14 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; +[NodeName("Get From Array")] [NodeCategory("Obsidian/Json")] [GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray))] public class JsonGetObjectFromArrayNode : ObjectFunctionNode where T : class { public readonly ObjectInput Input; public readonly ObjectInput Index; - public static bool IsValidGenericType => JsonTypeHelper.ValidObjectTypes.Contains(typeof(T)); + public static bool IsValidGenericType => JsonTypeHelper.ValidObjectGetTypes.Contains(typeof(T)); protected override T Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs index 48a3cfe..f3b6f79 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs @@ -10,13 +10,14 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; +[NodeName("Get From Object")] [NodeCategory("Obsidian/Json")] [GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray))] public class JsonGetObjectFromObjectNode : ObjectFunctionNode where T : class { public readonly ObjectInput Input; public readonly ObjectInput Tag; - public static bool IsValidGenericType => JsonTypeHelper.ValidObjectTypes.Contains(typeof(T)); + public static bool IsValidGenericType => JsonTypeHelper.ValidObjectGetTypes.Contains(typeof(T)); protected override T Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs index 5fbe8f2..686f570 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs @@ -7,6 +7,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; +[NodeName("Get From Array")] [NodeCategory("Obsidian/Json")] [GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))] @@ -14,7 +15,7 @@ public class JsonGetValueFromArrayNode : ValueFunctionNode Input; public readonly ObjectInput Index; - public static bool IsValidGenericType => JsonTypeHelper.ValidValueGetTypes.Contains(typeof(T)); + public static bool IsValidGenericType => JsonTypeHelper.ValidValueTypes.Contains(typeof(T)); protected override T Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs index 9a5f4a4..4d03085 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs @@ -10,6 +10,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; +[NodeName("Get From Object")] [NodeCategory("Obsidian/Json")] [GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))] @@ -17,7 +18,7 @@ public class JsonGetValueFromObjectNode : ValueFunctionNode Input; public readonly ObjectInput Tag; - public static bool IsValidGenericType => JsonTypeHelper.ValidValueGetTypes.Contains(typeof(T)); + public static bool IsValidGenericType => JsonTypeHelper.ValidValueTypes.Contains(typeof(T)); protected override T Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs new file mode 100644 index 0000000..6401c9a --- /dev/null +++ b/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs @@ -0,0 +1,33 @@ +using System; +using System.Linq; +using Newtonsoft.Json.Linq; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; +using Elements.Core; +using FrooxEngine; +using FrooxEngine.ProtoFlux; +using Obsidian.Elements; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; + +[NodeName("Insert To Array")] +[NodeCategory("Obsidian/Json")] +[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), + typeof(long), typeof(ulong), typeof(float), typeof(double))] +public class JsonInsertObjectToArrayNode : ObjectFunctionNode +{ + public readonly ObjectInput Array; + public readonly ObjectInput Object; + public readonly ObjectInput Index; + public static bool IsValidGenericType => JsonTypeHelper.ValidObjectSetTypes.Contains(typeof(T)); + protected override JsonArray Compute(FrooxEngineContext context) + { + var array = Array.Evaluate(context); + var obj = Object.Evaluate(context); + var index = Index.Evaluate(context); + if (array == null || index < 0 || index > array.Count) + return null; + + return array.Insert(index, obj); + } +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs deleted file mode 100644 index abf4660..0000000 --- a/ProjectObsidian/ProtoFlux/JSON/JsonInsertToArrayNode.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Linq; -using Newtonsoft.Json.Linq; -using ProtoFlux.Core; -using ProtoFlux.Runtimes.Execution; -using Elements.Core; -using FrooxEngine; -using FrooxEngine.ProtoFlux; -using Obsidian.Elements; - -namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json -{ - [NodeCategory("Obsidian/Json")] - [GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), - typeof(ulong), typeof(float), typeof(double), typeof(string), typeof(Uri), - typeof(IJsonToken), typeof(JsonObject), typeof(JsonArray))] - public class JsonInsertToArrayNode : ObjectFunctionNode - { - public readonly ObjectInput Array; - public readonly ObjectInput Object; - public readonly ObjectInput Index; - public static bool IsValidGenericType => JsonTypeHelper.AllValidTypes.Contains(typeof(T)); - protected override JsonArray Compute(FrooxEngineContext context) - { - var array = Array.Evaluate(context); - var obj = Object.Evaluate(context); - var index = Index.Evaluate(context); - if (array == null || index < 0 || index > array.Count) - return null; - - return array.Insert(index, obj); - } - } -} diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs new file mode 100644 index 0000000..e25794f --- /dev/null +++ b/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs @@ -0,0 +1,32 @@ +using System; +using System.Linq; +using Newtonsoft.Json.Linq; +using ProtoFlux.Core; +using ProtoFlux.Runtimes.Execution; +using Elements.Core; +using FrooxEngine; +using FrooxEngine.ProtoFlux; +using Obsidian.Elements; + +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; + +[NodeName("Insert To Array")] +[NodeCategory("Obsidian/Json")] +[GenericTypes(typeof(string), typeof(Uri), typeof(IJsonToken), typeof(JsonObject), typeof(JsonArray))] +public class JsonInsertValueToArrayNode : ObjectFunctionNode +{ + public readonly ObjectInput Array; + public readonly ObjectInput Object; + public readonly ValueInput Index; + public static bool IsValidGenericType => JsonTypeHelper.ValidValueTypes.Contains(typeof(T)); + protected override JsonArray Compute(FrooxEngineContext context) + { + var array = Array.Evaluate(context); + var obj = Object.Evaluate(context); + var index = Index.Evaluate(context); + if (array == null || index < 0 || index > array.Count) + return null; + + return array.Insert(index, obj); + } +} diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonParseStringArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringArrayNode.cs index df553dd..f8c8020 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonParseStringArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringArrayNode.cs @@ -5,17 +5,17 @@ using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; -namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; + +[NodeName("JsonArray From String")] +[NodeCategory("Obsidian/Json")] +public class JsonParseStringArrayNode : ObjectFunctionNode { - [NodeCategory("Obsidian/Json")] - public class JsonParseStringArrayNode : ObjectFunctionNode - { - public readonly ObjectInput Input; + public readonly ObjectInput Input; - protected override JsonArray Compute(FrooxEngineContext context) - { - var input = Input.Evaluate(context); - return string.IsNullOrEmpty(input) ? null : JsonArray.FromString(input); - } + protected override JsonArray Compute(FrooxEngineContext context) + { + var input = Input.Evaluate(context); + return string.IsNullOrEmpty(input) ? null : JsonArray.FromString(input); } -} +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonParseStringObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringObjectNode.cs index 360143d..07732e7 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonParseStringObjectNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonParseStringObjectNode.cs @@ -5,18 +5,18 @@ using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; -namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; + +[NodeName("JsonObject From String")] +[NodeCategory("Obsidian/Json")] +public class JsonParseStringObjectNode : ObjectFunctionNode { - [NodeCategory("Obsidian/Json")] - public class JsonParseStringObjectNode : ObjectFunctionNode - { - public readonly ObjectInput Input; + public readonly ObjectInput Input; - protected override JsonObject Compute(FrooxEngineContext context) - { - var input = Input.Evaluate(context); - return string.IsNullOrEmpty(input) ? null : JsonObject.FromString(input); - } + protected override JsonObject Compute(FrooxEngineContext context) + { + var input = Input.Evaluate(context); + return string.IsNullOrEmpty(input) ? null : JsonObject.FromString(input); } -} +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs index 14b9b83..09d5009 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs @@ -10,13 +10,14 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; +[NodeName("Quick Get From Object")] [NodeCategory("Obsidian/Json")] [GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray))] public class JsonQuickGetObjectFromObjectNode : ObjectFunctionNode where T : class { public readonly ObjectInput Input; public readonly ObjectInput Tag; - public static bool IsValidGenericType => JsonTypeHelper.ValidObjectTypes.Contains(typeof(T)); + public static bool IsValidGenericType => JsonTypeHelper.ValidObjectGetTypes.Contains(typeof(T)); protected override T Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs index 2ead36d..bba5e0d 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs @@ -10,6 +10,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; +[NodeName("Quick Get From Object")] [NodeCategory("Obsidian/Json")] [GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))] @@ -17,7 +18,7 @@ public class JsonQuickGetValueFromObjectNode : ValueFunctionNode Input; public readonly ObjectInput Tag; - public static bool IsValidGenericType => JsonTypeHelper.ValidValueGetTypes.Contains(typeof(T)); + public static bool IsValidGenericType => JsonTypeHelper.ValidValueTypes.Contains(typeof(T)); protected override T Compute(FrooxEngineContext context) { var input = Input.Evaluate(context); diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs index 72c42b0..870d0f9 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromArrayNode.cs @@ -5,23 +5,23 @@ using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; -namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; + +[NodeName("Remove From Array")] +[NodeCategory("Obsidian/Json")] +public class JsonRemoveFromArrayNode : ObjectFunctionNode { - [NodeCategory("Obsidian/Json")] - public class JsonRemoveFromArrayNode : ObjectFunctionNode - { - public readonly ObjectInput Array; - public readonly ObjectInput Index; + public readonly ObjectInput Array; + public readonly ObjectInput Index; - protected override JsonArray Compute(FrooxEngineContext context) - { - var array = Array.Evaluate(context); - var index = Index.Evaluate(context); - if (array == null || index < 0 || index >= array.Count) - return null; + protected override JsonArray Compute(FrooxEngineContext context) + { + var array = Array.Evaluate(context); + var index = Index.Evaluate(context); + if (array == null || index < 0 || index >= array.Count) + return null; - return array.Remove(index); - } + return array.Remove(index); } -} +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs index 0751c39..705015f 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonRemoveFromObjectNode.cs @@ -5,22 +5,22 @@ using ProtoFlux.Core; using ProtoFlux.Runtimes.Execution; -namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json +namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; + +[NodeName("Remove From Object")] +[NodeCategory("Obsidian/Json")] +public class JsonRemoveFromObjectNode : ObjectFunctionNode { - [NodeCategory("Obsidian/Json")] - public class JsonRemoveFromObjectNode : ObjectFunctionNode - { - public readonly ObjectInput Input; - public readonly ObjectInput Tag; + public readonly ObjectInput Input; + public readonly ObjectInput Tag; - protected override JsonObject Compute(FrooxEngineContext context) - { - var input = Input.Evaluate(context); - if (input == null) return null; + protected override JsonObject Compute(FrooxEngineContext context) + { + var input = Input.Evaluate(context); + if (input == null) return null; - var tag = Tag.Evaluate(context); - return string.IsNullOrEmpty(tag) ? input : input.Remove(tag); - } + var tag = Tag.Evaluate(context); + return string.IsNullOrEmpty(tag) ? input : input.Remove(tag); } -} +} \ No newline at end of file diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs index a1ed246..38524c7 100644 --- a/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs +++ b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs @@ -9,6 +9,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json; +[NodeName("To String")] [NodeCategory("Obsidian/Json")] [GenericTypes(typeof(IJsonToken), typeof(JsonObject), typeof(JsonArray))] public class JsonToStringNode : ObjectFunctionNode