Changeset 14927 for branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs
- Timestamp:
- 05/04/17 17:19:35 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs
r14185 r14927 61 61 } 62 62 63 protected enum NodeType { Start, End, Inline } 63 protected enum NodeType { Start, End, Inline }; 64 64 65 65 protected static void AddXmlTagContent(StringBuilder sb, string name, Dictionary<string, string> attributes) { … … 256 256 {"typeName", lastTypeToken.TypeName }, 257 257 {"serializer", lastTypeToken.Serializer }}); 258 } 259 finally { 258 } finally { 260 259 lastTypeToken = null; 261 260 } … … 313 312 private static void Serialize(object obj, Stream stream, Configuration config, bool includeAssemblies 314 313 , CompressionLevel compression) { 315 Serializer serializer = newSerializer(obj, config);314 var serializer = new HeuristicLab.Persistence.Core.Serializer(obj, config); 316 315 Serialize(stream, includeAssemblies, compression, serializer); 317 316 } 318 317 319 private static void Serialize(Stream stream, bool includeAssemblies, CompressionLevel compression, Serializer serializer) {318 private static void Serialize(Stream stream, bool includeAssemblies, CompressionLevel compression, HeuristicLab.Persistence.Core.Serializer serializer) { 320 319 try { 321 320 DateTime start = DateTime.Now; … … 360 359 Logger.Info(String.Format("serialization took {0} seconds with compression level {1}", 361 360 (DateTime.Now - start).TotalSeconds, compression)); 362 } 363 catch (Exception) { 361 } catch (Exception) { 364 362 Logger.Warn("Exception caught, no data has been serialized."); 365 363 throw; … … 385 383 File.Copy(tempfile, filename, true); 386 384 File.Delete(tempfile); 387 } 388 catch (Exception) { 385 } catch (Exception) { 389 386 Logger.Warn("Exception caught, no data has been written."); 390 387 throw; … … 426 423 CompressionType compressionType = CompressionType.GZip) { 427 424 try { 428 Serializer serializer = newSerializer(obj, config);425 var serializer = new HeuristicLab.Persistence.Core.Serializer(obj, config); 429 426 if (compressionType == CompressionType.Zip) { 430 427 Serialize(obj, stream, config, includeAssemblies, CompressionLevel.Optimal); … … 432 429 Serialize(stream, serializer); 433 430 } 434 } 435 catch (PersistenceException) { 431 } catch (PersistenceException) { 436 432 throw; 437 } 438 catch (Exception e) { 433 } catch (Exception e) { 439 434 throw new PersistenceException("Unexpected exception during Serialization.", e); 440 435 } … … 453 448 CompressionType compressionType = CompressionType.GZip) { 454 449 try { 455 Serializer serializer = newSerializer(obj, config);450 var serializer = new HeuristicLab.Persistence.Core.Serializer(obj, config); 456 451 if (compressionType == CompressionType.Zip) { 457 452 Serialize(stream, includeAssemblies, CompressionLevel.Optimal, serializer); … … 460 455 } 461 456 types = serializer.SerializedTypes; 462 } 463 catch (PersistenceException) { 457 } catch (PersistenceException) { 464 458 throw; 465 } 466 catch (Exception e) { 459 } catch (Exception e) { 467 460 throw new PersistenceException("Unexpected exception during Serialization.", e); 468 461 } 469 462 } 470 463 471 private static void Serialize(Stream stream, Serializer serializer) {464 private static void Serialize(Stream stream, HeuristicLab.Persistence.Core.Serializer serializer) { 472 465 using (StreamWriter writer = new StreamWriter(new GZipStream(stream, CompressionMode.Compress))) { 473 466 serializer.InterleaveTypeInformation = true;
Note: See TracChangeset
for help on using the changeset viewer.