Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/20/14 17:33:22 (10 years ago)
Author:
jkarder
Message:

#2136:

  • refactored HLScriptGeneration to separate outputs from different running HL scripts.
  • added persistence support for HLScripts and fixed cloning
  • added code completion for all types in the currently loaded assemblies
  • merged trunk changes
Location:
branches/HLScript
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HLScript

  • branches/HLScript/HeuristicLab.HLScript/3.3/HLScriptGeneration.cs

    r10332 r10358  
    88namespace HeuristicLab.HLScript {
    99  public abstract class HLScriptGeneration {
    10     protected static dynamic vars;
     10    protected dynamic vars;
     11
     12    private readonly EventWriter console;
     13    protected EventWriter Console {
     14      get { return console; }
     15    }
     16
     17    protected HLScriptGeneration() {
     18      console = new EventWriter(this);
     19    }
    1120
    1221    public abstract void Main();
     
    1423    private void Execute(VariableStore variableStore) {
    1524      vars = new Variables(variableStore);
    16       using (new EventWriter(this)) {
    17         try {
    18           Main();
    19         } catch (ThreadAbortException) {
    20         } catch (Exception e) {
    21           Console.WriteLine("---");
    22           Console.WriteLine(e);
    23         }
     25      try {
     26        Main();
     27      } catch (ThreadAbortException) {
     28      } catch (Exception e) {
     29        Console.WriteLine("---");
     30        Console.WriteLine(e);
    2431      }
    2532    }
     
    4855    }
    4956
    50     private class EventWriter : TextWriter {
    51       private readonly TextWriter consoleOut;
     57    protected class EventWriter : TextWriter {
    5258      private readonly HLScriptGeneration hlsg;
    53       private bool disposed;
    5459
    5560      public EventWriter(HLScriptGeneration hlsg) {
    5661        this.hlsg = hlsg;
    57         consoleOut = Console.Out;
    58         Console.SetOut(this);
    59         disposed = false;
    6062      }
    6163
     
    106108      #endregion
    107109      #endregion
    108 
    109       protected override void Dispose(bool disposing) {
    110         if (!disposed && disposing)
    111           Console.SetOut(consoleOut);
    112         disposed = true;
    113       }
    114110    }
    115111  }
Note: See TracChangeset for help on using the changeset viewer.