Esempio n. 1
0
        private static void AddChosenPlaces(Graph.Graph graph, bool isGiven = false)
        {
            if (isGiven)
            {
                foreach (var ln in _data3)
                {
                    List <String> id = ln.Split("|").ToList();

                    Place place = graph.Places.Find(item => item.Id.Equals(id[1].Replace(" ", "")));
                    if (graph.ChosenPlaces.Exists(item => item.Equals(place)))
                    {
                        throw new IOException($"Cannot choose place twice {ln}");
                    }
                    if (place == null)
                    {
                        throw new IOException($"Cannot choose place that not exist {ln}");
                    }

                    graph.AddChosenPlace(place);
                }
            }
            else
            {
                graph.ChosenPlaces.AddRange(graph.Places);
            }
        }