Changeset 14930 for branches/PersistenceReintegration/HeuristicLab.Core
- Timestamp:
- 05/04/17 19:53:35 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.Core/3.3/PersistenceContentManager.cs
r14185 r14930 20 20 #endregion 21 21 22 using System .IO.Compression;22 using System; 23 23 using HeuristicLab.Common; 24 using HeuristicLab.Persistence.Default.Xml;25 24 26 25 namespace HeuristicLab.Core { … … 29 28 30 29 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 32 40 } 33 41 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); 36 47 } 37 48 }
Note: See TracChangeset
for help on using the changeset viewer.