Last change
on this file since 3188 was
3036,
checked in by epitzer, 15 years ago
|
make most serializers internal and complete API documentation (#548)
|
File size:
824 bytes
|
Line | |
---|
1 | using System;
|
---|
2 | using HeuristicLab.Persistence.Core;
|
---|
3 | using HeuristicLab.Persistence.Interfaces;
|
---|
4 | using System.Text;
|
---|
5 | using System.Text.RegularExpressions;
|
---|
6 | using System.Globalization;
|
---|
7 |
|
---|
8 |
|
---|
9 | namespace HeuristicLab.Persistence.Default.Xml.Primitive {
|
---|
10 |
|
---|
11 | internal sealed class TimeSpan2XmlSerializer : PrimitiveXmlSerializerBase<TimeSpan> {
|
---|
12 |
|
---|
13 | public override XmlString Format(TimeSpan o) {
|
---|
14 | return new XmlString(o.ToString());
|
---|
15 | }
|
---|
16 |
|
---|
17 | public override TimeSpan Parse(XmlString t) {
|
---|
18 | try {
|
---|
19 | return TimeSpan.Parse(t.Data);
|
---|
20 | } catch (FormatException x) {
|
---|
21 | throw new PersistenceException("Cannot parse TimeSpan string representation.", x);
|
---|
22 | } catch (OverflowException x) {
|
---|
23 | throw new PersistenceException("Overflow during TimeSpan parsing.", x);
|
---|
24 | }
|
---|
25 | }
|
---|
26 | }
|
---|
27 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.