示例#1
0
        private void OnDataReceived(string data)
        {
            switch (data)
            {
            case MESSAGE_COMPILE_STARTED:
                IsCompiling = true;
                CompileStarted?.Invoke(this, EventArgs.Empty);
                break;

            case MESSAGE_COMPILE_ENDED:
            case MESSAGE_COMPILE_ENDED_WITH_WARNINGS:
                if (!IsStarting)
                {
                    IsCompiling = false;
                    CompileEnded?.Invoke(this, true);
                }
                else
                {
                    nodeProcesses = GetNodeProcessesByExecutablePath(ExecutablesDirectory);
                    IsStarting    = false;
                    Started?.Invoke(this, EventArgs.Empty);
                }
                break;

            case MESSAGE_COMPILE_FAILED:
                IsCompiling = false;
                CompileEnded?.Invoke(this, false);
                break;

            default:
                if (IsRunning && data.StartsWith(MESSAGE_NPM_ERROR))
                {
                    Stop();
                    IsStarting  = false;
                    IsCompiling = false;
                    CompileEnded?.Invoke(this, false);
                }
                else if (IsInstalling)
                {
                    if (data.StartsWith(MESSAGE_NPM_WARNING))
                    {
                        Stop();
                        InstallEnded?.Invoke(this, false);
                    }
                    else if (InstallEndedIdentifier.IsMatch(data))
                    {
                        IsInstalling = false;
                        InstallEnded?.Invoke(this, true);
                    }
                }
                break;
            }

            OutputLine?.Invoke(this, data);
        }
 public static void WriteLine(string line)
 {
     Console.WriteLine(line);
     OutputLine?.Invoke(line);
 }
示例#3
0
 protected virtual void OnWriteLine(OutputEventArgs e)
 {
     OutputLine?.Invoke(this, e);
 }