- Timestamp:
- 01/24/19 19:22:44 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2520_PersistenceReintegration/HeuristicLab.Clients.Hive/3.3/Util/PersistenceUtil.cs
r16480 r16553 24 24 using System.IO; 25 25 using HEAL.Fossil; 26 using HeuristicLab.Persistence.Default.Xml; 26 27 27 28 namespace HeuristicLab.Clients.Hive { 28 29 public static class PersistenceUtil { 29 30 public static byte[] Serialize(object obj, out IEnumerable<Type> types) { 30 using (MemoryStream memStream = new MemoryStream()) { 31 throw new NotImplementedException("Not supported by HEAL.Fossil yet."); // TODO 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 return ser.Serialize(obj, out types); 36 33 } 37 34 … … 43 40 public static T Deserialize<T>(byte[] sjob) { 44 41 var ser = new ProtoBufSerializer(); 45 return (T)ser.Deserialize(sjob); 42 try { 43 return (T)ser.Deserialize(sjob); 44 } catch (Exception) { 45 // retry with old persistence 46 using (MemoryStream memStream = new MemoryStream(sjob)) { 47 return XmlParser.Deserialize<T>(memStream); 48 } 49 } 46 50 } 47 51 }
Note: See TracChangeset
for help on using the changeset viewer.