예제 #1
0
 public override void Dispose()
 {
     if (IsDisposed)
     {
         return;
     }
     IsDisposed = true;
     IsRunning  = false;
     _tokenSource.Cancel();
     GenericProcessManager.Destroy(_playerAi);
 }
예제 #2
0
        public AiPlayer(Field currentField, GameMain gameMain, string fileName)
            : base(currentField, gameMain)
        {
            _playerAi = new Process();
            GenericProcessManager.Add(_playerAi);
            _fileName   = fileName;
            _inputQueue = new ConcurrentQueue <string>();

            _tokenSource = new CancellationTokenSource();
            _token       = _tokenSource.Token;
            _writeTask   = Task.Factory.StartNew(WriteStanderdInputFromQueue, _token);
        }