コード例 #1
0
        private void RefreshGameClients()
        {
            // remove game processes that have exited
            var exited = GameClients.Where(x => x.Process.HasExited).ToList();

            GameClients.RemoveAll(exited);

            // add new game processes
            Process.GetProcessesByName("elementclient")
            .Where(p => !GameClients.Any(g => p.Id == g.Process.Id))
            .Select(x => new GameModel(x))
            .ForEach(GameClients.Add);

            if (GameClients.Count == 1)
            {
                Attach.ExecuteAsync(GameClients.First());
            }
        }