public void Load(FileInfo info, DirectoryInfo players) { if (info.DirectoryName != null && !Directory.Exists(info.DirectoryName) || !File.Exists(info.FullName)) { LoadDefaults(info); return; } using (var fs = new FileStream(info.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (var sr = new StreamReader(fs)) { var json = sr.ReadToEnd(); var jsonClass = JsonConvert.DeserializeObject <GameSettings>(json); ApplyValues(jsonClass); } } if (AvailablePlayers.Count <= 0) { AvailablePlayers.AddRange(DefaultPlayers); } foreach (var player in AvailablePlayers.Where(p => p.Enabled)) { Players.Add(player); } }
private void ProcessDraftPick() { Player draftedPlayer = null; if (CurrentPick.Team.ManagerMode == ManagerMode.CPU) { draftedPlayer = draftService.DraftPlayer(CurrentPick.Team, AvailablePlayers.Where(player => CurrentPick.DraftCard.CanDraftPlayer(player))); } else { draftedPlayer = SelectedPlayer; } AvailablePlayers.Remove(draftedPlayer); CurrentPick.Player = draftedPlayer; SelectedDraftRound.DraftPicks.UpdateCollection(); NotifyPropertyChanged("CanDraftPlayer"); NotifyPropertyChanged("CanGoToNextPick"); NotifyPropertyChanged("DraftPanel"); SelectedPlayer = null; }