Changeset 16992 for trunk/HeuristicLab.Core
- Timestamp:
- 05/29/19 11:20:22 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Core/3.3/PersistenceContentManager.cs
r16945 r16992 25 25 using HEAL.Attic; 26 26 using System; 27 using System.Diagnostics; 27 28 28 29 namespace HeuristicLab.Core { … … 30 31 public PersistenceContentManager() : base() { } 31 32 32 protected override IStorableContent LoadContent(string filename ) {33 protected override IStorableContent LoadContent(string filename, out Info info) { 33 34 bool useOldPersistence = XmlParser.CanOpen(filename); 34 if (useOldPersistence) return XmlParser.Deserialize<IStorableContent>(filename); 35 IStorableContent content = null; 36 if (useOldPersistence) { 37 var sw = new Stopwatch(); 38 sw.Start(); 39 content = XmlParser.Deserialize<IStorableContent>(filename); 40 sw.Stop(); 41 info = new Info(filename, sw.Elapsed); 42 } else { 43 var ser = new ProtoBufSerializer(); 44 content = (IStorableContent)ser.Deserialize(filename, out SerializationInfo serInfo); 45 info = new Info(filename, serInfo); 46 } 47 if (content == null) throw new PersistenceException($"Cannot deserialize root element of {filename}"); 48 return content; 49 } 35 50 36 var ser = new ProtoBufSerializer();37 return (IStorableContent)ser.Deserialize(filename, out SerializationInfo info);38 }39 51 40 52 protected override void SaveContent(IStorableContent content, string filename, bool compressed, CancellationToken cancellationToken) {
Note: See TracChangeset
for help on using the changeset viewer.