using System.Collections.Generic; using System.Linq; using JD.Guinness.WPF.Module.Configuration.Ps4; using JD.Guinness.WPF.Module.Extension; using Plume.WPF.Mvvm; namespace JD.Guinness.WPF.Module.Model.Ps4 { public sealed class Ps4Zone : BindableBase, IWarnable { private string _name; private string _npCommId; private string _trpFilePath; private string _warnings; public string Name { get => _name; set => SetProperty(ref _name, value); } public string NpCommId { get => _npCommId; set => SetProperty(ref _npCommId, value); } public string TrpFilePath { get => _trpFilePath; set => SetProperty(ref _trpFilePath, value); } public string Warnings { get => _warnings; set => SetProperty(ref _warnings, value); } public DispatcherObservableCollection> Languages { get; } public Ps4Zone(IEnumerable infos) { Languages = new DispatcherObservableCollection>(infos.Select(i => new Selectable { Value = i })); } public Ps4ZoneSave ToSave(string workspacePath) => new Ps4ZoneSave { Name = Name, NpCommId = NpCommId, TrpFilePath = TrpFilePath.ToRelativePath(workspacePath), Languages = Languages.Where(s => s.IsSelected).Select(s => s.Value.Id).ToArray() }; } }