public static SProfileData[] GetProfileList() { List <SProfileData> result = new List <SProfileData>(CProfiles.NumProfiles); result.AddRange(CProfiles.GetProfiles().Select(profile => _CreateProfileData(profile, true))); return(result.ToArray()); }
private void _LoadProfiles(bool keep) { string name = String.Empty; if (_EditMode == EEditMode.PlayerName) { name = CProfiles.GetPlayerName(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag)); } Guid selectedProfileID = _GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag); _SelectSlides[_SelectSlideProfiles].Clear(); _SelectSlideGuids.Clear(); CProfile[] profiles = CProfiles.GetProfiles(); int i = 0; foreach (CProfile profile in profiles) { _SelectSlides[_SelectSlideProfiles].AddValue(profile.PlayerName, null, i); _SelectSlideGuids.Add(i, profile.ID); i++; } if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0) { if (selectedProfileID != Guid.Empty) { _SelectSlides[_SelectSlideProfiles].SelectedTag = _SelectSlideGuids.FirstOrDefault(x => x.Value.Equals(selectedProfileID)).Key; } else { _SelectSlides[_SelectSlideProfiles].Selection = 0; selectedProfileID = _GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag); } if (!keep) { _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID); _SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(selectedProfileID); _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(selectedProfileID); _SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(selectedProfileID); } if (_EditMode == EEditMode.PlayerName) { CProfiles.SetPlayerName(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag), name); } } _ProfilesChanged = false; }
public static Guid GetUserIdFromUsername(string username) { IEnumerable <Guid> playerIds = (from p in CProfiles.GetProfiles() where String.Equals(p.PlayerName, username, StringComparison.OrdinalIgnoreCase) select p.ID); try { return(playerIds.First()); } catch (InvalidOperationException) { throw new ArgumentException("Invalid playername"); } }
private void _LoadProfiles(bool keep) { string name = String.Empty; if (_EditMode == EEditMode.PlayerName) { name = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag); } int selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag; _SelectSlides[_SelectSlideProfiles].Clear(); CProfile[] profiles = CProfiles.GetProfiles(); foreach (CProfile profile in profiles) { _SelectSlides[_SelectSlideProfiles].AddValue(profile.PlayerName, null, profile.ID); } if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0) { if (selectedProfileID != -1) { _SelectSlides[_SelectSlideProfiles].SelectedTag = selectedProfileID; } else { _SelectSlides[_SelectSlideProfiles].Selection = 0; selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag; } if (!keep) { _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID); _SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(selectedProfileID); _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(selectedProfileID); _SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(selectedProfileID); } if (_EditMode == EEditMode.PlayerName) { CProfiles.SetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, name); } } _ProfilesChanged = false; }
private void _LoadProfiles(bool keep) { /*string name = String.Empty; * if (_EditMode == EEditMode.PlayerName) * name = CProfiles.GetPlayerName(_NewProfileID); * //name = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag);*/ Guid selectedProfileID = _NewProfileID; //_SelectSlides[_SelectSlideProfiles].Clear(); CProfile[] profiles = CProfiles.GetProfiles(); /*foreach (CProfile profile in profiles) * _SelectSlides[_SelectSlideProfiles].AddValue(profile.PlayerName, null, profile.ID);*/ if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0) { /*if (selectedProfileID != -1) * _SelectSlides[_SelectSlideProfiles].SelectedTag = selectedProfileID; * else * { * _SelectSlides[_SelectSlideProfiles].Selection = 0; * selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag; * }*/ if (!keep) { _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID); //_SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(selectedProfileID); //_SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(selectedProfileID); _SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(selectedProfileID); } /*if (_EditMode == EEditMode.PlayerName) * CProfiles.SetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, name);*/ } _ProfilesChanged = false; }