public IState Store()
        {
            string graphXml;

            using (var stream = new MemoryStream())
            {
                using (var streamReader = new StreamReader(stream))
                {
                    using (var xmlWriter = XmlWriter.Create(stream, new XmlWriterSettings {
                        Indent = true
                    }))
                    {
                        var vertexId = new VertexIdentity <PluginId>(id => id.Id.ToString());
                        var edgeId   = new EdgeIdentity <PluginId, SEdge <PluginId> >(edge => edge.Target.ToString());
                        _graph.SerializeToGraphML(xmlWriter, vertexId, edgeId);
                        xmlWriter.Flush();
                        stream.Position = 0;
                        graphXml        = streamReader.ReadToEnd();
                    }
                }
            }
            return(new DependencyGraphState
            {
                CreatedBy = GetFinalCreatedBy().ToDictionary(kv => kv.Key.Id.ToString(), kv => kv.Value),
                Consumes = GetFinalConsumes().ToDictionary(kv => kv.Key.Id.ToString(), kv => kv.Value),
                Graph = graphXml,
                ExecutedPlugins = _executedPlugins,
            });
        }
Esempio n. 2
0
        /// <inheritdoc />
        public async Task Serialise(string filename = "streams")
        {
            await Wait();

            _graph.SerializeToGraphML <ICVertex, QEdge <ICVertex>, BidirectionalGraph <ICVertex, QEdge <ICVertex> > >(filename + ".graphml");
        }
Esempio n. 3
0
 public void Serialize(string filename)
 {
     _graph.SerializeToGraphML <StateVertex, ActionEdge, BidirectionalGraph <StateVertex, ActionEdge> >(filename + ".graphml");;
 }