Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/28/09 12:45:32 (16 years ago)
Author:
epitzer
Message:

Fix StackDecomposer, reverse collection before serialization (#603)

Location:
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/String2XmlFormatter.cs

    r1679 r1683  
    99
    1010namespace HeuristicLab.Persistence.Default.Xml.Primitive {
    11 
    12   [EmptyStorableClass]
    13   public class TimeSpan2XmlFormatter : PrimitiveXmlFormatterBase<TimeSpan> {
    14 
    15     public override XmlString Format(TimeSpan o) {
    16       return new XmlString(o.ToString());
    17     }
    18 
    19     public override TimeSpan Parse(XmlString t) {
    20       try {
    21         return TimeSpan.Parse(t.Data);
    22       } catch (FormatException x) {
    23         throw new PersistenceException("Cannot parse TimeSpan string representation.", x);
    24       } catch (OverflowException x) {
    25         throw new PersistenceException("Overflow during TimeSpan parsing.", x);
    26       }
    27     }
    28   }
    29 
    30   [EmptyStorableClass]
    31   public class Guid2XmlFormatter : PrimitiveXmlFormatterBase<Guid> {
    32 
    33     public override XmlString Format(Guid o) {
    34       return new XmlString(o.ToString("D", CultureInfo.InvariantCulture));
    35     }
    36 
    37     public override Guid Parse(XmlString t) {
    38       try {
    39         return new Guid(t.Data);
    40       } catch (FormatException x) {
    41         throw new PersistenceException("Cannot parse Guid string representation.", x);
    42       } catch (OverflowException x) {
    43         throw new PersistenceException("Overflow during Guid parsing.", x);
    44       }
    45     }
    46   }
    4711
    4812  [EmptyStorableClass]
Note: See TracChangeset for help on using the changeset viewer.