Ejemplo n.º 1
0
        private void FromXML(XDocument XDoc)
        {
            var Elem = XDoc.Element("ScenarioRuns");

            var m = Elem.Element("ModelFiles");

            if (m != null)
            {
                foreach (var f in m.Elements("FileName"))
                {
                    this.LoadModel(f.Value);
                }
            }

            OutputDirectory = Elem.Element("OutputDirectory").Value;
            Prefix          = Elem.Element("Prefix").Value;

            m = Elem.Element("MikeSheFileName");
            if (m != null)
            {
                mikeSheFileName = new FilePathRelative(m.Value);
                RaisePropertyChanged("MikeSheFileName");
            }

            m = Elem.Element("PostProcessBatFile");
            if (m != null)
            {
                postProcessBat = new FilePathRelative(m.Value);
                RaisePropertyChanged("PostProcessBat");
            }


            var fs = Elem.Element("FilesToCopy");

            if (fs != null)
            {
                foreach (var f in fs.Elements("FileName"))
                {
                    this.FileNamesToCopy.Add(f.Value);
                }
            }


            var slf = Elem.Element("SimlabFileName");

            if (slf != null)
            {
                loadSimLab(slf.Value);
            }

            var sctorun = Elem.Element("ScenariosToRun");

            if (sctorun != null & Runs != null)
            {
                var splits = sctorun.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var r in Runs)
                {
                    r.RunThis = false;
                }

                foreach (var s in splits)
                {
                    int index;
                    if (int.TryParse(s, out index))
                    {
                        if (index <= Runs.Count)
                        {
                            var r = Runs.SingleOrDefault(var => var.Number == index);
                            if (r != null)
                            {
                                r.RunThis = true;
                            }
                        }
                    }
                }
            }
        }