public static object CypherList(Type objectType, CypherToNativeObject obj) { var result = new List <object>(); foreach (JObject item in (JArray)obj.data.value) { result.Add(Convert(item.ToObject <CypherToNativeObject>())); } return(result); }
public static object CypherMap(Type objectType, CypherToNativeObject obj) { var result = new Dictionary <string, object>(); var dictionaryElements = JObject.FromObject(obj.data.value).ToObject <Dictionary <string, CypherToNativeObject> >(); foreach (var item in dictionaryElements) { result.Add(item.Key, Convert(item.Value)); } return(result); }
public static object Convert(CypherToNativeObject sourceObject) { if (sourceObject.name == "CypherNull") { return(null); } try { Type objectType = TypeMap[sourceObject.name]; var function = FunctionMap[objectType]; return(function(objectType, sourceObject)); } catch { throw new IOException($"Attempting to convert an unsuported object type to a CypherType: {sourceObject.GetType()}"); } }
public static object CypherTODO(Type objectType, CypherToNativeObject cypherObject) { throw new NotImplementedException($"CypherToNative : {cypherObject.name} conversion is not implemented yet"); }
public static object CypherSimple(Type objectType, CypherToNativeObject cypherObject) { return(cypherObject.data.value); }