示例#1
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement("ParameterManager");
            ParameterManager.WriteXml(writer);
            writer.WriteEndElement();

            writer.WriteStartElement("Steps");
            // ReSharper disable ForCanBeConvertedToForeach
            // NOTE:  order is important for steps, so explicitly iterate
            for (var i = 0; i < Steps.Count; i++)
            // ReSharper restore ForCanBeConvertedToForeach
            {
                writer.WriteStartElement("Step");
                writer.WriteAttributeString("Type", Steps[i].GetType().ToString());

                Steps[i].WriteXml(writer);

                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
示例#2
0
        public void ReadXml(XmlReader reader)
        {
            if (reader.ReadToDescendant("ParameterManager"))
            {
                ParameterManager.ReadXml(reader.ReadSubtree());
            }

            if (reader.ReadToNextSibling("Steps"))
            {
                while (reader.ReadToFollowing("Step"))
                {
                    var stepType    = reader.GetAttribute("Type");
                    var stepFactory = mFactories.First(x => x.CreatedType.ToString() == stepType);
                    if (!stepFactory.IsLicensed)
                    {
                        continue;
                    }
                    var step = stepFactory.Create(mRoot, mCallback, ParameterManager);

                    step.ReadXml(reader);
                    Steps.Add(step);
                }
            }
        }
示例#3
0
 // parameterless constructor required for XML serialisation
 public Specification()
 {
     ParameterManager = new ParameterManager();
     Steps            = new List <IRunnable>();
 }