Ejemplo n.º 1
0
        public SimulationCaseParserResult Parse(string xml)
        {
            var result        = new SimulationCaseParserResult();
            var doc           = XDocument.Parse(xml);
            var processParser = new ProcessInstanceXmlParser();
            var chunksParser  = new SimulationChunksXmlParser();

            var instance = processParser.Parse(doc.Root);
            var chunks   = chunksParser.Parse(doc.Root);

            result.Name = doc.Root.Attribute(XmlParsersConfig.AttributeName).Value;

            var actorsElement = doc.Root.Element(XmlParsersConfig.ElementActors);

            var actors = ParseActorElements(actorsElement);


            result.Actors          = actors;
            result.ProcessInstance = instance;
            result.Chunks          = chunks;

            return(result);
        }
Ejemplo n.º 2
0
        public XDocument Create(SimulationCaseParserResult data)
        {
            var root = new XElement(XmlParsersConfig.ElementSimulation, new XAttribute(XmlParsersConfig.AttributeName, data.Name));

            var actorsElement = new XElement(XmlParsersConfig.ElementActors);

            foreach (var actor in data.Actors)
            {
                actorsElement.Add(CreateActorElement(actor));
            }

            root.Add(actorsElement);

            var transactionsElement = new ProcessInstanceXmlParser().Create(data.ProcessInstance);

            root.Add(transactionsElement);

            var chunksElement = new SimulationChunksXmlParser().Create(data.Chunks);

            root.Add(chunksElement);


            return(new XDocument(root));
        }