public IEnumerable <GraphBase> ParseGraphContentFile(string content, IGraphBuilder graphBuilder) { var fileContent = JsonConvert.DeserializeObject <GraphData>(content); return(fileContent.Graphs.Select(graphMap => graphBuilder.Initialize(GraphMappingUtilities.GetGraphType(graphMap)) .CreateGraphFromData(graphMap)).ToList()); }
public IEnumerable <GraphBase> ParseGraphContentFile(string content, IGraphBuilder graphBuilder) { var xmlDoc = new XmlDocument(); xmlDoc.LoadXml(content); var xmlContent = new GraphData { Graphs = new List <Dictionary <string, string> >() }; var graphs = xmlDoc.GetElementsByTagName("graph"); foreach (XmlNode graphXml in graphs) { var xmlDictionary = graphXml.ChildNodes.Cast <XmlNode>().ToDictionary(graph => graph.Name, graph => graph.InnerText); xmlContent.Graphs.Add(xmlDictionary); } return(xmlContent.Graphs.Select(graphMap => graphBuilder.Initialize(GraphMappingUtilities.GetGraphType(graphMap)).CreateGraphFromData(graphMap)).ToList()); }