| using System; |
| using System; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
| using System.ComponentModel; |
| using System.ComponentModel; |
| using System.Linq; |
| using System.Linq; |
| using System.Text; |
| using System.Text; |
| using System.Threading.Tasks; |
| using System.Threading.Tasks; |
| |
| |
| namespace Playnite.SDK.Models |
| namespace Playnite.SDK.Models |
| { |
| { |
| /// <summary> |
| /// <summary> |
| /// Represents game's platfom. |
| /// Represents game's platfom. |
| /// </summary> |
| /// </summary> |
| public class Platform : DatabaseObject |
| public class Platform : DatabaseObject |
| { |
| { |
. | |
| private string specificationId; |
| |
| /// <summary> |
| |
| /// Gets or sets specification identifier. |
| |
| /// </summary> |
| |
| public string SpecificationId |
| |
| { |
| |
| get => specificationId; |
| |
| set |
| |
| { |
| |
| specificationId = value; |
| |
| OnPropertyChanged(); |
| |
| } |
| |
| } |
| |
| |
| private string icon; |
| private string icon; |
| /// <summary> |
| /// <summary> |
| /// Gets or sets platform icon. |
| /// Gets or sets platform icon. |
| /// </summary> |
| /// </summary> |
| public string Icon |
| public string Icon |
| { |
| { |
| get => icon; |
| get => icon; |
| set |
| set |
| { |
| { |
| icon = value; |
| icon = value; |
| OnPropertyChanged(); |
| OnPropertyChanged(); |
| } |
| } |
| } |
| } |
| |
| |
| private string cover; |
| private string cover; |
| /// <summary> |
| /// <summary> |
| /// Gets or sets default game cover. |
| /// Gets or sets default game cover. |
| /// </summary> |
| /// </summary> |
| public string Cover |
| public string Cover |
| { |
| { |
| get => cover; |
| get => cover; |
| set |
| set |
| { |
| { |
| cover = value; |
| cover = value; |
| OnPropertyChanged(); |
| OnPropertyChanged(); |
| } |
| } |
| } |
| } |
| |
| |
| private string background; |
| private string background; |
| /// <summary> |
| /// <summary> |
| /// Gets or sets default game background image. |
| /// Gets or sets default game background image. |
| /// </summary> |
| /// </summary> |
| public string Background |
| public string Background |
| { |
| { |
| get => background; |
| get => background; |
| set |
| set |
| { |
| { |
| background = value; |
| background = value; |
| OnPropertyChanged(); |
| OnPropertyChanged(); |
| } |
| } |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Creates new instance of Platform. |
| /// Creates new instance of Platform. |
| /// </summary> |
| /// </summary> |
| public Platform() : base() |
| public Platform() : base() |
| { |
| { |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Creates new instance of Platform with specific name. |
| /// Creates new instance of Platform with specific name. |
| /// </summary> |
| /// </summary> |
| /// <param name="name">Platform name.</param> |
| /// <param name="name">Platform name.</param> |
| public Platform(string name) : this() |
| public Platform(string name) : this() |
| { |
| { |
| Name = name; |
| Name = name; |
| } |
| } |
| |
| |
| /// <inheritdoc/> |
| /// <inheritdoc/> |
| public override string ToString() |
| public override string ToString() |
. | { |
| { |
| return Name; |
| return Name; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets empty platform. |
| /// Gets empty platform. |
| /// </summary> |
| /// </summary> |
| public static readonly Platform Empty = new Platform { Id = Guid.Empty, Name = string.Empty }; |
| public static readonly Platform Empty = new Platform { Id = Guid.Empty, Name = string.Empty }; |
| |
| |
| /// <inheritdoc/> |
| /// <inheritdoc/> |
| public override void CopyDiffTo(object target) |
| public override void CopyDiffTo(object target) |
| { |
| { |
| base.CopyDiffTo(target); |
| base.CopyDiffTo(target); |
| |
| |
| if (target is Platform tro) |
| if (target is Platform tro) |
| { |
| { |
| if (!string.Equals(Icon, tro.Icon, StringComparison.Ordinal)) |
| if (!string.Equals(Icon, tro.Icon, StringComparison.Ordinal)) |
| { |
| { |
| tro.Icon = Icon; |
| tro.Icon = Icon; |
| } |
| } |
| |
| |
| if (!string.Equals(Cover, tro.Cover, StringComparison.Ordinal)) |
| if (!string.Equals(Cover, tro.Cover, StringComparison.Ordinal)) |
| { |
| { |
| tro.Cover = Cover; |
| tro.Cover = Cover; |
| } |
| } |
| |
| |
| if (!string.Equals(Background, tro.Background, StringComparison.Ordinal)) |
| if (!string.Equals(Background, tro.Background, StringComparison.Ordinal)) |
| { |
| { |
| tro.Background = Background; |
| tro.Background = Background; |
. | |
| } |
| |
| |
| |
| if (!string.Equals(SpecificationId, tro.SpecificationId, StringComparison.Ordinal)) |
| |
| { |
| |
| tro.SpecificationId = SpecificationId; |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| throw new ArgumentException($"Target object has to be of type {GetType().Name}"); |
| throw new ArgumentException($"Target object has to be of type {GetType().Name}"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |