JD2022-TU1/main/tools/modules/JD.Guinness.WPF.Module/Model/Ps4/Ps4Configuration.cs

71 lines
2 KiB
C#

using System.Linq;
using JD.Guinness.WPF.Module.Configuration.Ps4;
using JD.Guinness.WPF.Module.Extension;
using JD.Oasis.Service.API;
using Plume.WPF.Mvvm;
namespace JD.Guinness.WPF.Module.Model.Ps4
{
public sealed class Ps4Configuration : BindableBase, IWarnable
{
private bool _generate;
private string _version;
private LocalizedLine _titleName;
private LocalizedLine _titleDescription;
private string _titleImagePath;
private string _warnings;
public bool Generate
{
get => _generate;
set => SetProperty(ref _generate, value);
}
public string Version
{
get => _version;
set => SetProperty(ref _version, value);
}
public LocalizedLine TitleName
{
get => _titleName;
set => SetProperty(ref _titleName, value);
}
public LocalizedLine TitleDescription
{
get => _titleDescription;
set => SetProperty(ref _titleDescription, value);
}
public string TitleImagePath
{
get => _titleImagePath;
set => SetProperty(ref _titleImagePath, value);
}
public string Warnings
{
get => _warnings;
set => SetProperty(ref _warnings, value);
}
public DispatcherObservableCollection<Ps4Zone> Zones { get; }
public Ps4Configuration()
{
Zones = new DispatcherObservableCollection<Ps4Zone>();
}
public Ps4ConfigurationSave ToSave(string workspacePath) => new Ps4ConfigurationSave
{
Generate = Generate,
Version = Version,
TitleName = TitleName?.Id,
TitleDescription = TitleDescription?.Id,
TitleImagePath = TitleImagePath.ToRelativePath(workspacePath),
Zones = Zones.Select(z => z.ToSave(workspacePath)).ToArray()
};
}
}