Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/20/17 11:16:42 (8 years ago)
Author:
jkarder
Message:

#2520: worked on persistence

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistenceOverhaul/HeuristicLab.Core/3.3/PersistenceContentManager.cs

    r12012 r14594  
    2020#endregion
    2121
     22using System;
    2223using System.IO.Compression;
    2324using HeuristicLab.Common;
     25using HeuristicLab.Persistence;
    2426using HeuristicLab.Persistence.Default.Xml;
    2527
     
    2931
    3032    protected override IStorableContent LoadContent(string filename) {
    31       return XmlParser.Deserialize<IStorableContent>(filename);
     33      try {
     34        return XmlParser.Deserialize<IStorableContent>(filename);
     35      } catch (Exception) {
     36        var serializer = new ProtoBufSerializer();
     37        return (IStorableContent)serializer.Deserialize(filename);
     38      }
    3239    }
    3340
    3441    protected override void SaveContent(IStorableContent content, string filename, bool compressed) {
    35       XmlGenerator.Serialize(content, filename, compressed ? CompressionLevel.Optimal : CompressionLevel.NoCompression);
     42      //XmlGenerator.Serialize(content, filename, compressed ? CompressionLevel.Optimal : CompressionLevel.NoCompression);
     43      new ProtoBufSerializer().Serialize(content, filename);
    3644    }
    3745  }
Note: See TracChangeset for help on using the changeset viewer.