Changeset 16565 for trunk/HeuristicLab.Clients.Hive/3.3/Util
- Timestamp:
- 01/28/19 13:41:42 (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/2520_PersistenceReintegration (added) merged: 16451-16454,16462,16465-16468,16470-16472,16474,16476-16477,16479-16487,16529-16530,16539,16551-16555,16558-16559,16562-16564
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Clients.Hive
- Property svn:mergeinfo changed
/branches/2520_PersistenceReintegration/HeuristicLab.Clients.Hive (added) merged: 16452-16454,16462,16480,16529,16539,16553,16558-16559
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Clients.Hive/3.3/Util/PersistenceUtil.cs
r15583 r16565 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 8Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 23 23 using System.Collections.Generic; 24 24 using System.IO; 25 using H euristicLab.Persistence.Core;25 using HEAL.Attic; 26 26 using HeuristicLab.Persistence.Default.Xml; 27 27 … … 29 29 public static class PersistenceUtil { 30 30 public static byte[] Serialize(object obj, out IEnumerable<Type> types) { 31 using (MemoryStream memStream = new MemoryStream()) { 32 XmlGenerator.Serialize(obj, memStream, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, out types); 33 byte[] jobByteArray = memStream.ToArray(); 34 return jobByteArray; 35 } 31 var ser = new ProtoBufSerializer(); 32 var bytes = ser.Serialize(obj, out SerializationInfo info); 33 types = info.SerializedTypes; 34 return bytes; 36 35 } 37 36 38 37 public static byte[] Serialize(object obj) { 39 using (MemoryStream memStream = new MemoryStream()) { 40 XmlGenerator.Serialize(obj, memStream); 41 byte[] jobByteArray = memStream.ToArray(); 42 return jobByteArray; 43 } 38 var ser = new ProtoBufSerializer(); 39 return ser.Serialize(obj); 44 40 } 45 41 46 42 public static T Deserialize<T>(byte[] sjob) { 47 using (MemoryStream memStream = new MemoryStream(sjob)) { 48 T job = XmlParser.Deserialize<T>(memStream); 49 return job; 43 var ser = new ProtoBufSerializer(); 44 try { 45 return (T)ser.Deserialize(sjob); 46 } catch (Exception) { 47 // retry with old persistence 48 using (MemoryStream memStream = new MemoryStream(sjob)) { 49 return XmlParser.Deserialize<T>(memStream); 50 } 50 51 } 51 52 } -
trunk/HeuristicLab.Clients.Hive/3.3/Util/PluginUtil.cs
r15583 r16565 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 8Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.