Пример #1
0
        private static void RunAgent(string agent,
                                     ConcurrentQueue <string[]> queue,
                                     string distrFolder)
        {
            ProcessHelpers.KillProcess("Referee.exe", agent);
            ProcessHelpers.KillProcess("Server.exe", agent);
            ProcessHelpers.KillProcess("Client.exe", agent);

            DeployAgent(agent, distrFolder);

            while (!queue.IsEmpty)
            {
                string[] battle;
                while (!queue.TryDequeue(out battle))
                {
                    Thread.Sleep(10);
                }

                try
                {
                    ProcessHelpers.KillProcess("Referee.exe", agent);
                    ProcessHelpers.KillProcess("Server.exe", agent);
                    ProcessHelpers.KillProcess("Client.exe", agent);

                    RunBattle(agent, battle);
                }
                catch (Exception e)
                {
                    Log($"Error: {e.Message}");
                    queue.Enqueue(battle);
                }

                Log($"{queue.Count} left!");
            }
        }