コード例 #1
0
 private GraphSON1Converter()
 {
     _readers = new Dictionary <Type, ReadDelegate>
     {
         { typeof(IPAddress), (r, _) => IPAddress.Parse(r.Value.ToString()) },
         { typeof(BigInteger), (r, _) => BigInteger.Parse(r.Value.ToString(), CultureInfo.InvariantCulture) },
         { typeof(Point), (r, _) => Point.Parse(r.Value.ToString()) },
         { typeof(LineString), (r, _) => LineString.Parse(r.Value.ToString()) },
         { typeof(Polygon), (r, _) => Polygon.Parse(r.Value.ToString()) },
         { typeof(Duration), (r, _) => Duration.Parse(r.Value.ToString()) },
         { typeof(LocalDate), (r, _) => LocalDate.Parse(r.Value.ToString()) },
         { typeof(LocalTime), (r, _) => LocalTime.Parse(r.Value.ToString()) },
         { typeof(GraphNode), GetTokenReader(t => new GraphNode(GraphSON1Node.CreateParsedNode(t))) },
         { typeof(IGraphNode), GetTokenReader(t => new GraphNode(GraphSON1Node.CreateParsedNode(t))) },
         { typeof(Vertex), GetTokenReader(ToVertex) },
         { typeof(IVertex), GetTokenReader(ToVertex) },
         { typeof(Edge), GetTokenReader(ToEdge) },
         { typeof(IEdge), GetTokenReader(ToEdge) },
         { typeof(Path), GetTokenReader(ToPath) },
         { typeof(IPath), GetTokenReader(ToPath) },
         { typeof(IVertexProperty), GetTokenReader(ToVertexProperty) },
         { typeof(IProperty), GetTokenReader(ToProperty) }
     };
 }
コード例 #2
0
 protected override GraphNode ToGraphNode(JToken token)
 {
     return(token == null ? null : new GraphNode(GraphSON1Node.CreateParsedNode(token)));
 }