Ignore:
Timestamp:
3/31/2012 12:44:10 AM (2 years ago)
Author:
lowjoel
Message:

Merged the XML Task Lists branch back to trunk. Implements #362: Use XML to store task lists

Location:
trunk/eraser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser

  • trunk/eraser/Eraser.DefaultPlugins/ErasureTargets/ErasureTargetBase.cs

    r2515 r2606  
    2525using System.Text; 
    2626using System.Runtime.Serialization; 
     27using System.Xml; 
     28using System.Xml.Serialization; 
    2729using System.Security.Permissions; 
    2830 
     
    3436namespace Eraser.DefaultPlugins 
    3537{ 
    36     abstract class ErasureTargetBase : IErasureTarget 
     38    public abstract class ErasureTargetBase : IErasureTarget 
    3739    { 
    3840        #region IErasureTarget Members 
     
    8284        { 
    8385            info.AddValue("Method", Method.Guid); 
     86        } 
     87 
     88        public System.Xml.Schema.XmlSchema GetSchema() 
     89        { 
     90            return null; 
     91        } 
     92 
     93        /// <summary> 
     94        /// Reads the XML for the current Erasure Target. 
     95        /// </summary> 
     96        /// <param name="reader">The XML Reader containing the element to deserialise.</param> 
     97        /// <param name="advance">Whether to advance the element pointer. Set to false if 
     98        /// a derived class will be doing further processing on the element.</param> 
     99        /// <remarks>When inheriting and overriding this method, call the base method with 
     100        /// <paramref name="advance"/> set to false.</remarks> 
     101        protected virtual void ReadXml(XmlReader reader, bool advance) 
     102        { 
     103            Guid methodGuid = Guid.Empty; 
     104            if (reader.HasAttributes) 
     105            { 
     106                string method = reader.GetAttribute("method"); 
     107                if (method != null) 
     108                    methodGuid = new Guid(method); 
     109            } 
     110 
     111            if (methodGuid == Guid.Empty) 
     112                Method = ErasureMethodRegistrar.Default; 
     113            else 
     114                Method = Host.Instance.ErasureMethods[methodGuid]; 
     115 
     116            if (advance) 
     117                reader.Read(); 
     118        } 
     119 
     120        public void ReadXml(XmlReader reader) 
     121        { 
     122            ReadXml(reader, true); 
     123        } 
     124 
     125        public virtual void WriteXml(XmlWriter writer) 
     126        { 
     127            if (method != ErasureMethodRegistrar.Default) 
     128                writer.WriteAttributeString("method", method.Guid.ToString()); 
    84129        } 
    85130        #endregion 
Note: See TracChangeset for help on using the changeset viewer.