- Timestamp:
- 01/20/14 17:33:22 (11 years ago)
- Location:
- branches/HLScript
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HLScript
- Property svn:mergeinfo changed
/trunk/sources (added) merged: 10346,10348,10355
- Property svn:mergeinfo changed
-
branches/HLScript/HeuristicLab.HLScript/3.3/HLScriptGeneration.cs
r10332 r10358 8 8 namespace HeuristicLab.HLScript { 9 9 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 } 11 20 12 21 public abstract void Main(); … … 14 23 private void Execute(VariableStore variableStore) { 15 24 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); 24 31 } 25 32 } … … 48 55 } 49 56 50 private class EventWriter : TextWriter { 51 private readonly TextWriter consoleOut; 57 protected class EventWriter : TextWriter { 52 58 private readonly HLScriptGeneration hlsg; 53 private bool disposed;54 59 55 60 public EventWriter(HLScriptGeneration hlsg) { 56 61 this.hlsg = hlsg; 57 consoleOut = Console.Out;58 Console.SetOut(this);59 disposed = false;60 62 } 61 63 … … 106 108 #endregion 107 109 #endregion 108 109 protected override void Dispose(bool disposing) {110 if (!disposed && disposing)111 Console.SetOut(consoleOut);112 disposed = true;113 }114 110 } 115 111 }
Note: See TracChangeset
for help on using the changeset viewer.