/// <summary> /// Writes the common part of the Task XML Element. /// </summary> /// <param name="writer">The XML Writer instance to write to.</param> private void WriteXmlCommon(XmlWriter writer) { writer.WriteAttributeString("name", Name); writer.WriteStartElement("Schedule"); if (schedule.GetType() == Schedule.RunManually.GetType()) { writer.WriteAttributeString("type", "Manual"); } else if (schedule.GetType() == Schedule.RunNow.GetType()) { writer.WriteAttributeString("type", "Now"); } else if (schedule.GetType() == Schedule.RunOnRestart.GetType()) { writer.WriteAttributeString("type", "Restart"); } else if (schedule is RecurringSchedule) { writer.WriteAttributeString("type", "Recurring"); XmlSerializer serializer = new XmlSerializer(schedule.GetType()); serializer.Serialize(writer, schedule); } writer.WriteEndElement(); XmlSerializer targetsSerializer = new XmlSerializer(Targets.GetType()); targetsSerializer.Serialize(writer, Targets); }
private void ReadTargets(XmlReader reader) { XmlSerializer targetsSerializer = new XmlSerializer(Targets.GetType()); Targets = (ErasureTargetCollection)targetsSerializer.Deserialize(reader); Targets.Owner = this; }