Changeset 11056 for trunk/sources/HeuristicLab.Scripting
- Timestamp:
- 06/30/14 11:20:08 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Scripting/3.3/CSharpScript.cs
r10857 r11056 21 21 22 22 using System; 23 using System.IO; 23 24 using System.Linq; 24 25 using System.Reflection; … … 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Core; 29 using HeuristicLab.Persistence.Core; 28 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Persistence.Default.Xml; 29 32 30 33 namespace HeuristicLab.Scripting { … … 78 81 protected CSharpScript(CSharpScript original, Cloner cloner) 79 82 : base(original, cloner) { 80 variableStore = new VariableStore(); 83 try { 84 using (var serializerStream = new MemoryStream()) { 85 XmlGenerator.Serialize(original.variableStore, serializerStream); 86 var bytes = serializerStream.GetBuffer(); 87 using (var deserializerStream = new MemoryStream(bytes)) { 88 variableStore = XmlParser.Deserialize<VariableStore>(deserializerStream); 89 } 90 } 91 } catch (PersistenceException pe) { 92 throw new NotSupportedException("Could not clone the script because some of its variables could not be cloned.", pe); 93 } 81 94 } 82 95 public CSharpScript() {
Note: See TracChangeset
for help on using the changeset viewer.