Esempio n. 1
0
        public void LoadGraph(IGraphBundle bundle)
        {
            _nodes.Clear();
            _bundle = bundle;

            foreach (IFilter filter in _bundle.Graph.Filters)
            {
                AddFilterNode(filter);
            }
        }
Esempio n. 2
0
        private void SaveInternal(IGraphBundle graph, string path)
        {
            var xDoc = new XDocument();

            var root = new XElement(GraphFileFormat.NodeRoot);

            root.Add(new XAttribute(GraphFileFormat.NodeFormatVersion, FileFormat.Version));

            var filtersNode = new XElement(FileFormat.Node_Filters);

            graph.Graph.Filters
            .SelectMany(GetFilterNodes)
            .ToList()
            .ForEach(filtersNode.Add);
            root.Add(filtersNode);

            if (graph.Locations != null)
            {
                var locationsNode = new XElement(FileFormat.Node_Locations);
                graph.Locations
                .Select(GetLocationNode)
                .ToList()
                .ForEach(locationsNode.Add);
                root.Add(locationsNode);
            }

            xDoc.Add(root);

            var xws = new XmlWriterSettings
            {
                Indent      = true,
                IndentChars = "\t"
            };

            using (XmlWriter xw = XmlWriter.Create(path, xws))
                xDoc.Save(xw);
        }
Esempio n. 3
0
        public static void Save(IGraphBundle graph, string path, SaveOptions options = SaveOptions.Default)
        {
            var graphLoader = new GraphSaver(options);

            graphLoader.SaveInternal(graph, path);
        }