public static void WriteToFile(string path, RequestGraph graph) { GraphSerializer.WriteToFile <RequestGraph, RequestNode>( path, graph, WriteGraphProperties, WriteNode); }
public static void WriteToGraphvizFile(string path, RequestGraph graph) { var builder = new StringBuilder(); GraphSerializer.WriteToGraphvizFile( path, graph, n => GetNodeLabel(builder, n)); }
private static void WriteGraphProperties(JsonTextWriter j, RequestGraph graph) { if (graph.Sources.Any()) { j.WritePropertyName("s"); j.WriteStartArray(); foreach (var source in graph.Sources) { j.WriteValue(source); } j.WriteEndArray(); } }
private static void ReadGraphProperty(JsonSerializer serializer, JsonReader j, RequestGraph graph) { switch ((string)j.Value) { case "s": j.Read(); graph.Sources.AddRange(serializer.Deserialize <List <string> >(j)); break; } }