Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/30/14 14:42:38 (10 years ago)
Author:
abeham
Message:

#2203: Made VariableStore IDeepCloneable and implemented cloning there

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Scripting/3.3/CSharpScript.cs

    r11056 r11058  
    2121
    2222using System;
    23 using System.IO;
    2423using System.Linq;
    2524using System.Reflection;
     
    2726using HeuristicLab.Common;
    2827using HeuristicLab.Core;
    29 using HeuristicLab.Persistence.Core;
    3028using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.Persistence.Default.Xml;
    3229
    3330namespace HeuristicLab.Scripting {
     
    8178    protected CSharpScript(CSharpScript original, Cloner cloner)
    8279      : base(original, cloner) {
    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       }
     80      variableStore = cloner.Clone(original.variableStore);
    9481    }
    9582    public CSharpScript() {
Note: See TracChangeset for help on using the changeset viewer.