コード例 #1
0
        /// <summary>
        /// Disposes of this object and cleans up any dependent resources.
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                    StopTimer(); // In case it's running.
                    if (_commandTimer != null)
                    {
                        _commandTimer.Dispose();
                    }
                    if (ChessEngineController != null)
                    {
                        ChessEngineController.ErrorReceived -= EngineController_ErrorReceived;
                        ChessEngineController = null;
                    }
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
コード例 #2
0
        public void Start(IEngineController remoteController)
        {
            killLingeringProcesses();

            _controller = remoteController;

            // Watch UseShellExecute.
            var start = new ProcessStartInfo
            {
                UseShellExecute  = false,
                WorkingDirectory = _project.ProjectPath.ToFullPath(),
                FileName         = "dotnet"
            };


            var framework = _project.Framework;

#if NET46
            framework = framework ?? "net46";
#else
            framework = framework ?? "netcoreapp1.0";
#endif


            // TODO -- need to lock this down somehow
            start.Arguments = $"run --framework {framework} -- {_project.Port}";
            _testCommand    = $"dotnet run --framework {framework} -- test";

            _command = $"dotnet {start.Arguments}";

            _process         = Process.Start(start);
            _process.Exited += _process_Exited;

            lock (_readyLock)
            {
                _agentReady = false;
            }



            Task.Delay(5.Seconds()).ContinueWith(t =>
            {
                lock (_readyLock)
                {
                    if (!_agentReady)
                    {
                    }
                }

                if (_process.HasExited)
                {
                    sendFailedToStartMessage();
                }
            });

            if (_process.HasExited)
            {
                sendFailedToStartMessage();
            }
        }
コード例 #3
0
 public void Start(IEngineController remoteController)
 {
     _agent = new StorytellerAgent(_project.Port, _system);
     _agent.Receive(new StartProject {
         Project = _project
     });
 }
コード例 #4
0
 public VehicleFacade(IEngineController engineController, ITransmissionController transmissionController,
                      ITractionControlController tractionControlController, ITachometerController tachometerController)
 {
     _engineController          = engineController;
     _transmissionController    = transmissionController;
     _tractionControlController = tractionControlController;
     _tachometerController      = tachometerController;
 }
コード例 #5
0
     public VehicleFacade(IEngineController engineController, ITransmissionController transmissionController,
 ITractionControlController tractionControlController, ITachometerController tachometerController)
     {
         _engineController = engineController;
         _transmissionController = transmissionController;
         _tractionControlController = tractionControlController;
         _tachometerController = tachometerController;
     }
コード例 #6
0
 public WashMachine(
     IEngineController engineController,
     IHeaterController heaterController,
     IPumpController pumpController)
 {
     _engineController = engineController;
     _heaterController = heaterController;
     _pumpController   = pumpController;
 }
コード例 #7
0
 public ChessterController(IEngineController engineController, ILoggerFactory loggerFactory)
 {
     _logger = loggerFactory.CreateLogger("ChessterController")
               ?? throw new ArgumentNullException(nameof(loggerFactory));
     _logger.LogTrace("Constructing ChessterController");
     if (null == engineController)
     {
         throw new ArgumentNullException(nameof(engineController));
     }
     _uci = new UniversalChessInterface(engineController);
 }
コード例 #8
0
        public CommandRunnerTester()
        {
            theCommand = new RecordingCommand <RunSpec>();

            var app = Substitute.For <IApplication>();

            theRemoteController = Substitute.For <IEngineController>();

            app.Engine.Returns(theRemoteController);

            theRunner = new CommandRunner(app, new ICommand[] { theCommand });
        }
コード例 #9
0
        public void Start(IEngineController remoteController)
        {
            killLingeringProcesses();

            _controller = remoteController;

            // Watch UseShellExecute.
            var start = new ProcessStartInfo
            {
                UseShellExecute  = false,
                WorkingDirectory = _project.ProjectPath.ToFullPath(),
                FileName         = "dotnet",
                Arguments        = _project.ToAgentCommandLine()
            };

            _testCommand = _project.ToTestCommandLine();

            _command = $"dotnet {start.Arguments}";

            _process         = Process.Start(start);
            _process.Exited += _process_Exited;

            lock (_readyLock)
            {
                _agentReady = false;
            }



            Task.Delay(5.Seconds()).ContinueWith(t =>
            {
                lock (_readyLock)
                {
                    if (!_agentReady)
                    {
                    }
                }

                if (_process.HasExited)
                {
                    sendFailedToStartMessage();
                }
            });

            if (_process.HasExited)
            {
                sendFailedToStartMessage();
            }
        }
コード例 #10
0
        public void Start(IEngineController controller)
        {
            _domain = AppDomain.CreateDomain("Storyteller-SpecRunning-Domain", null, _remoteSetup.Setup);


            try
            {
                var proxyType = typeof(RemoteProxy);
                _proxy = (RemoteProxy)_domain.CreateInstanceAndUnwrap(proxyType.Assembly.FullName, proxyType.FullName);

                _proxy.Start(_project);
            }
            catch (Exception)
            {
                ConsoleWriter.Write(ConsoleColor.Yellow,
                                    "Storyteller was unable to start an AppDomain for the specification project. Check that the project has already been compiled.");

                throw;
            }
        }
コード例 #11
0
 public SmartMetrics(SmartResolver resolver, ExecuteEngine executeEngine)
 {
     this.resolver    = resolver;
     engineController = executeEngine;
 }
コード例 #12
0
ファイル: EngineBehaviour.cs プロジェクト: jcawe/CarRacing
 void Start() => _engineController = new EngineController(TorqueWheels);
コード例 #13
0
 public void Initialize()
 {
     _engineController = TestflowRunner.GetInstance().EngineController;
 }
コード例 #14
0
 /// <summary>
 /// Performs initialization for the factory.
 /// </summary>
 /// <param name="engineController">Instance of <see cref="IEngineController"/> which will be
 /// associated with a command during creation so the command can receive messages from the
 /// chess engine.</param>
 public ChessCommandFactory(IEngineController engineController)
 {
     _chessEngineController = engineController;
 }
コード例 #15
0
 public void Start(IEngineController remoteController)
 {
     _agent = new StorytellerAgent(_project.Port, _system);
     _agent.Receive(new StartProject {Project = _project});
 }
コード例 #16
0
        public void Start(IEngineController controller)
        {
            _domain = AppDomain.CreateDomain("Storyteller-SpecRunning-Domain", null, _remoteSetup.Setup);


            try
            {
                var proxyType = typeof(RemoteProxy);
                _proxy = (RemoteProxy)_domain.CreateInstanceAndUnwrap(proxyType.Assembly.FullName, proxyType.FullName);

                _proxy.Start(_project);
            }
            catch (Exception)
            {
                ConsoleWriter.Write(ConsoleColor.Yellow,
                    "Storyteller was unable to start an AppDomain for the specification project. Check that the project has already been compiled.");

                throw;
            }
        }
コード例 #17
0
 public ApplicationController(OpenInput input, IEngineController engine, IWebApplicationRunner website)
 {
     _input  = input;
     Engine  = engine;
     Website = website;
 }
コード例 #18
0
ファイル: RunInput.cs プロジェクト: jiristeidl/Storyteller
        public Task <BatchRunResponse> StartBatch(IEngineController controller)
        {
            var request = GetBatchRunRequest();

            return(controller.Send(request).AndWaitFor <BatchRunResponse>());
        }
コード例 #19
0
ファイル: RunInput.cs プロジェクト: storyteller/Storyteller
 public Task<BatchRunResponse> StartBatch(IEngineController controller)
 {
     var request = GetBatchRunRequest();
     return controller.Send(request).AndWaitFor<BatchRunResponse>();
 }
コード例 #20
0
 /// <summary>
 /// Performs initialization for the chess interface to the engine given the specified
 /// <paramref name="engineController" />.
 /// </summary>
 public UniversalChessInterface(IEngineController engineController)
 {
     Logger.LogTrace("UniversalChessInterface() with an injected engineController");
     ChessEngineController = engineController;
     Initialize();
 }