private void Initialize() { // Load list ProfileList = new ObservableImmutableList <ClientProfileVm>( ClientProfile.GetAllProfiles().Select(x => new ClientProfileVm(x))); if (MainWindowVm.Instance.SelectedWorkingProfile != null) { SelectedProfile = MainWindowVm.Instance.SelectedWorkingProfile; } else if (ProfileList == null || ProfileList.Count == 0) { SelectedProfile = new ClientProfileVm() { Name = "Default Profile", IndexKey = new byte[] { 0xB9, 0x9E, 0xB0, 0x02, 0x6F, 0x69, 0x81, 0x05, 0x63, 0x98, 0x9B, 0x28, 0x79, 0x18, 0x1A, 0x00 }, PackKey = new byte[] { 0x22, 0xB8, 0xB4, 0x04, 0x64, 0xB2, 0x6E, 0x1F, 0xAE, 0xEA, 0x18, 0x00, 0xA6, 0xF6, 0xFB, 0x1C }, PackExtension = ".epk", IndexExtension = ".eix", WorkingDirectory = "WORKING_DIR", UnpackDirectory = "UNPACK_DIR" }; ProfileList.Add(SelectedProfile); } else { SelectedProfile = ProfileList.FirstOrDefault(x => x.IsDefault) ?? ProfileList.First(); } }
/// <summary> /// Adds new profile to the list /// </summary> private void AddNewProfileAction() { // Check if there is a blank profile already, if so select it ClientProfileVm outProfile = ProfileList.FirstOrDefault(x => x.Name == null || x.Name == "Default Profile"); if (outProfile != null) { SelectedProfile = outProfile; } else { var profile = new ClientProfileVm() { Name = "Default Profile", IndexKey = new byte[] { 0xB9, 0x9E, 0xB0, 0x02, 0x6F, 0x69, 0x81, 0x05, 0x63, 0x98, 0x9B, 0x28, 0x79, 0x18, 0x1A, 0x00 }, PackKey = new byte[] { 0x22, 0xB8, 0xB4, 0x04, 0x64, 0xB2, 0x6E, 0x1F, 0xAE, 0xEA, 0x18, 0x00, 0xA6, 0xF6, 0xFB, 0x1C }, PackExtension = ".epk", IndexExtension = ".eix", WorkingDirectory = "WORKING_DIR", UnpackDirectory = "UNPACK_DIR" }; ProfileList.Add(profile); SelectedProfile = profile; } }