public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var array = JArray.Load(reader); var inputSockets = new InputSocket[array.Count]; for (int i = 0; i < array.Count; i++) { var arrayElement = array[i]; var inputSource = new LocalPropertyId(arrayElement.ToObject <string>()); if (!validOutputs.Contains(inputSource)) { Console.WriteLine($"Ignoring desired input of \"{inputSource}\" as it is not valid."); return(new InputSocket[0]); } int connectionId = mappedInputs.IndexOf(inputSource); if (connectionId == -1) { connectionId = mappedInputs.Count; mappedInputs.Add(inputSource); } inputSockets[i] = new InputSocket(connectionId); } return(inputSockets); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.Value == null) { return(new InputSocket()); } var inputSource = new LocalPropertyId(reader.Value.ToString()); if (!ValidOutputs.Contains(inputSource)) { Console.WriteLine($"Ignoring desired input of \"{inputSource}\" as it is not valid."); return(new InputSocket()); } int connectionId = MappedInputs.IndexOf(inputSource); if (connectionId == -1) { connectionId = MappedInputs.Count; MappedInputs.Add(inputSource); } return(new InputSocket(connectionId)); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.Value == null) { return(new InputSocket()); } var inputSource = new LocalPropertyId(reader.Value.ToString()); int connectionId = MappedInputs.IndexOf(inputSource); if (connectionId == -1) { connectionId = MappedInputs.Count; MappedInputs.Add(inputSource); } return(new InputSocket(connectionId)); }