예제 #1
0
        private void OnException(Task <ScriptState <object> > t, object state)
        {
            _consoleRedirect.Dispose();
            var ex = t.Exception;

            VSTools.LogError(ex);
            VSTools.LogEndRunning(true);
            var executionEnd = (Action <object, Exception>)state;

            executionEnd(null, ex);
        }
예제 #2
0
        private void OnSuccess(Task <ScriptState <object> > t, object state)
        {
            _consoleRedirect.Dispose();
            var result    = t.IsCompleted ? t.Result : null;
            var exception = t.IsFaulted ? t.Exception : null;

            VSTools.LogEndRunning(t.IsFaulted);
            var executionEnd = (Action <object, Exception>)state;

            executionEnd(result, exception);
        }
예제 #3
0
        public void Run(string sCode, Action <object, Exception> executionEnd)
        {
            _consoleRedirect = new ConsoleRedirect();
            VSTools.LogStartRunning();
            try
            {
                var result = CSharpScript.RunAsync(sCode, defaultOptions, globals: new Globals());

                result.ContinueWith(OnException, executionEnd, TaskContinuationOptions.OnlyOnFaulted);
                result.ContinueWith(OnSuccess, executionEnd, TaskContinuationOptions.OnlyOnRanToCompletion);
            }
            catch (Exception ex)
            {
                _consoleRedirect.Dispose();
                VSTools.LogError(ex);
                VSTools.LogEndRunning(true);
                executionEnd(null, ex);
            }
        }
예제 #4
0
파일: Globals.cs 프로젝트: gyssels/VSREPL
 public int TraceError(Exception ex)
 {
     VSTools.LogDebugError(ex);
     return(0);
 }
예제 #5
0
파일: Globals.cs 프로젝트: gyssels/VSREPL
 public int Trace(string message)
 {
     VSTools.LogDebug(message);
     return(0);
 }
예제 #6
0
 public override void Write(string value)
 {
     VSTools.LogDebug(value);
 }
예제 #7
0
 public override void Write(char[] buffer, int index, int count)
 {
     VSTools.LogDebug(new string(buffer, index, count));
 }
예제 #8
0
 public override void Write(char value)
 {
     VSTools.LogDebug(new string (value, 1));
 }