Ejemplo n.º 1
0
        public static Graph LoadGraph(string content)
        {
            var           serializer    = new Serializer();
            GraphDocument graphDocument = serializer.Deserialize <GraphDocument>(content);

            return(ParseGraph(graphDocument));
        }
Ejemplo n.º 2
0
        private static Graph ParseGraph(GraphDocument graphDocument)
        {
            Graph graph = new Graph(graphDocument.id, graphDocument.name, new List <Entity>(), new List <Layer>());

            graphDocument.entities.ForEach(entity => graph.Entities.Add(ParseEntity(entity, graph)));
            graphDocument.layers.ForEach(layer => graph.AddLayer(ParseLayer(layer, graph)));

            return(graph);
        }
Ejemplo n.º 3
0
        public static string SaveGraph(Graph graph, bool emitAlias = false)
        {
            var settings = new SerializerSettings {
                EmitAlias = emitAlias
            };
            var           serializer    = new Serializer(settings);
            GraphDocument graphDocument = MakeGraphDocument(graph);

            return(serializer.Serialize(graphDocument));
        }