- Timestamp:
- 05/07/19 14:48:48 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Core/3.3/PersistenceContentManager.cs
r16579 r16907 24 24 using HeuristicLab.Persistence.Default.Xml; 25 25 using HEAL.Attic; 26 using System;27 26 28 27 namespace HeuristicLab.Core { … … 32 31 protected override IStorableContent LoadContent(string filename) { 33 32 // first try to load using the new persistence format 34 try { 35 var ser = new ProtoBufSerializer(); 36 return (IStorableContent)ser.Deserialize(filename); 37 } catch (Exception) { 38 // try old format if new format fails 39 return XmlParser.Deserialize<IStorableContent>(filename); 33 var ser = new ProtoBufSerializer(); 34 var o = (IStorableContent)ser.Deserialize(filename, out SerializationInfo info); 35 if (info.SerializedTypes != null) { 36 return o; 40 37 } 38 // try old format if new format fails 39 return XmlParser.Deserialize<IStorableContent>(filename); 41 40 } 42 41 43 42 protected override void SaveContent(IStorableContent content, string filename, bool compressed, CancellationToken cancellationToken) { 44 43 var ser = new ProtoBufSerializer(); 45 ser.Serialize(content, filename, cancellationToken); 44 ser.Serialize(content, filename, cancellationToken); 46 45 } 47 46 }
Note: See TracChangeset
for help on using the changeset viewer.