Changeset 17226 for branches/2521_ProblemRefactoring/HeuristicLab.Core/3.3/PersistenceContentManager.cs
- Timestamp:
- 08/29/19 15:57:35 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Core
- Property svn:mergeinfo changed
/branches/2435-alglib_3_15/HeuristicLab.Core (added) merged: 17034 /trunk/HeuristicLab.Core merged: 16992,17009,17037,17180,17184
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Core/3.3/PersistenceContentManager.cs
r16946 r17226 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2019Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 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.