Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1615 for trunk/sources


Ignore:
Timestamp:
04/21/09 15:27:35 (16 years ago)
Author:
epitzer
Message:

Improve debugability to investigate failing tests. (#593)

Location:
trunk/sources/HeuristicLab.Persistence/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/SerializationTokenBase.cs

    r1556 r1615  
    11using HeuristicLab.Persistence.Interfaces;
     2using System.Reflection;
     3using System.Text;
    24
    35namespace HeuristicLab.Persistence.Core.Tokens {
     
    810      Name = name;
    911    }
     12    public override string ToString() {
     13      StringBuilder sb = new StringBuilder();
     14      sb.Append(this.GetType().Name).Append('(');
     15      foreach (FieldInfo fi in this.GetType().GetFields()) {
     16        sb.Append(fi.Name).Append('=').Append(fi.GetValue(this)).Append(", ");
     17      }
     18      sb.Append(')');
     19      return sb.ToString();
     20    }
    1021  }
    1122
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/String2XmlFormatter.cs

    r1570 r1615  
    33using HeuristicLab.Persistence.Interfaces;
    44using System.Text;
     5using System.Text.RegularExpressions;
    56
    67
     
    1011  public class String2XmlFormatter : FormatterBase<string, XmlString> {
    1112
    12     public override XmlString Format(string s) {     
     13    public override XmlString Format(string s) {
    1314      StringBuilder sb = new StringBuilder();
    1415      sb.Append("<![CDATA[");
     
    1819    }
    1920
    20     private static readonly string[] separators = new string[] { "<![CDATA[", "]]>" };
    21 
    22     public override string Parse(XmlString x) {     
     21    public override string Parse(XmlString x) {
    2322      StringBuilder sb = new StringBuilder();
    24       foreach (string s in x.Data.Split(separators,
    25         StringSplitOptions.RemoveEmptyEntries)) {
    26         sb.Append(s);
     23      Regex re = new Regex(@"<!\[CDATA\[((?:[^]]|\](?!\]>))*)\]\]>", RegexOptions.Singleline);
     24      foreach (Match m in re.Matches(x.Data)) {
     25        sb.Append(m.Groups[1]);
    2726      }
    2827      return sb.ToString();
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs

    r1612 r1615  
    1010using HeuristicLab.Persistence.Core.Tokens;
    1111
    12 namespace HeuristicLab.Persistence.Default.Xml { 
     12namespace HeuristicLab.Persistence.Default.Xml {
    1313
    1414  public class XmlGenerator : GeneratorBase<string> {
     
    177177      writer = new StreamWriter(zipStream);
    178178      foreach (string line in generator.Format(serializer.TypeCache)) {
    179         writer.WriteLine(line);
     179        writer.Write(line);
    180180        logger.Debug(line.TrimEnd());
    181181      }
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlString.cs

    r1566 r1615  
    11using HeuristicLab.Persistence.Interfaces;
    22using HeuristicLab.Persistence.Core;
     3using System.Text;
    34
    45namespace HeuristicLab.Persistence.Default.Xml {
     
    1213      Data = data;
    1314    }
     15
     16    public override string ToString() {
     17      StringBuilder sb = new StringBuilder();
     18      sb.Append("XmlString(").Append(Data).Append(')');
     19      return sb.ToString();
     20    }
    1421  }
    1522}
Note: See TracChangeset for help on using the changeset viewer.