Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/04/17 19:53:35 (8 years ago)
Author:
gkronber
Message:

#2520 changed optimizer to use new persistence per default

File:
1 edited

Legend:

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

    r14185 r14930  
    2020#endregion
    2121
    22 using System.IO.Compression;
     22using System;
    2323using HeuristicLab.Common;
    24 using HeuristicLab.Persistence.Default.Xml;
    2524
    2625namespace HeuristicLab.Core {
     
    2928
    3029    protected override IStorableContent LoadContent(string filename) {
    31       return XmlParser.Deserialize<IStorableContent>(filename);
     30      #region backwards compatibility
     31      // try to deserialize with new serializer first
     32      var serializer = new HeuristicLab.Persistence.ProtoBufSerializer();
     33      IStorableContent content;
     34      try {
     35        content = (IStorableContent)serializer.Deserialize(filename);
     36        return content;
     37      } catch (Exception e) { }
     38      return HeuristicLab.Persistence.Default.Xml.XmlParser.Deserialize<IStorableContent>(filename);
     39      #endregion
    3240    }
    3341
    34     protected override void SaveContent(IStorableContent content, string filename, bool compressed) {
    35       XmlGenerator.Serialize(content, filename, compressed ? CompressionLevel.Optimal : CompressionLevel.NoCompression);
     42    protected override void SaveContent(IStorableContent content, string filename) {
     43      // XmlGenerator.Serialize(content, filename, compressed ? CompressionLevel.Optimal : CompressionLevel.NoCompression);
     44
     45      var serializer = new HeuristicLab.Persistence.ProtoBufSerializer();
     46      serializer.Serialize(content, filename);
    3647    }
    3748  }
Note: See TracChangeset for help on using the changeset viewer.