| using System; |
| using System; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
. | |
| 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> |
. | |
| /// |
| |
| /// </summary> |
| |
| public enum AppSoftwareType |
| |
| { |
| |
| /// <summary> |
| |
| /// |
| |
| /// </summary> |
| |
| [Description("LOCDefault")] |
| |
| Standard, |
| |
| /// <summary> |
| |
| /// |
| |
| /// </summary> |
| |
| [Description("LOCGameActionTypeScript")] |
| |
| Script |
| |
| } |
| |
| |
| |
| /// <summary> |
| /// Represents general application software. |
| /// Represents general application software. |
| /// </summary> |
| /// </summary> |
| public class AppSoftware : DatabaseObject |
| public class AppSoftware : DatabaseObject |
| { |
| { |
| private string icon; |
| private string icon; |
| /// <summary> |
| /// <summary> |
| /// Gets or sets application icon. |
| /// Gets or sets application icon. |
| /// </summary> |
| /// </summary> |
| public string Icon |
| public string Icon |
| { |
| { |
| get => icon; |
| get => icon; |
| set |
| set |
| { |
| { |
| icon = value; |
| icon = value; |
| OnPropertyChanged(); |
| OnPropertyChanged(); |
| } |
| } |
| } |
| } |
| |
| |
| private string arguments; |
| private string arguments; |
| /// <summary> |
| /// <summary> |
| /// Gets or sets application arguments. |
| /// Gets or sets application arguments. |
| /// </summary> |
| /// </summary> |
| public string Arguments |
| public string Arguments |
| { |
| { |
| get => arguments; |
| get => arguments; |
| set |
| set |
| { |
| { |
| arguments = value; |
| arguments = value; |
| OnPropertyChanged(); |
| OnPropertyChanged(); |
| } |
| } |
| } |
| } |
| |
| |
| private string path; |
| private string path; |
| /// <summary> |
| /// <summary> |
| /// Gets or sets application path. |
| /// Gets or sets application path. |
| /// </summary> |
| /// </summary> |
| public string Path |
| public string Path |
| { |
| { |
| get => path; |
| get => path; |
| set |
| set |
| { |
| { |
| path = value; |
| path = value; |
| OnPropertyChanged(); |
| OnPropertyChanged(); |
| } |
| } |
| } |
| } |
| |
| |
| private string workingDir; |
| private string workingDir; |
| /// <summary> |
| /// <summary> |
| /// Gets or sets application working directory. |
| /// Gets or sets application working directory. |
| /// </summary> |
| /// </summary> |
| public string WorkingDir |
| public string WorkingDir |
| { |
| { |
| get => workingDir; |
| get => workingDir; |
| set |
| set |
| { |
| { |
| workingDir = value; |
| workingDir = value; |
| OnPropertyChanged(); |
| OnPropertyChanged(); |
| } |
| } |
| } |
| } |
| |
| |
| private bool showOnSidebar; |
| private bool showOnSidebar; |
| /// <summary> |
| /// <summary> |
| /// |
| /// |
| /// </summary> |
| /// </summary> |
| public bool ShowOnSidebar |
| public bool ShowOnSidebar |
| { |
| { |
| get => showOnSidebar; |
| get => showOnSidebar; |
| set |
| set |
| { |
| { |
| showOnSidebar = value; |
| showOnSidebar = value; |
| OnPropertyChanged(); |
| OnPropertyChanged(); |
| } |
| } |
| } |
| } |
| |
| |
. | |
| private AppSoftwareType appType = AppSoftwareType.Standard; |
| |
| /// <summary> |
| |
| /// Gets or sets type. |
| |
| /// </summary> |
| |
| public AppSoftwareType AppType |
| |
| { |
| |
| get => appType; |
| |
| set |
| |
| { |
| |
| appType = value; |
| |
| OnPropertyChanged(); |
| |
| } |
| |
| } |
| |
| |
| |
| private string script; |
| |
| /// <summary> |
| |
| /// Gets or sets script to execute if type is set to script type. |
| |
| /// </summary> |
| |
| public string Script |
| |
| { |
| |
| get => script; |
| |
| set |
| |
| { |
| |
| script = value; |
| |
| OnPropertyChanged(); |
| |
| } |
| |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Creates new instance of <see cref="AppSoftware"/>. |
| /// Creates new instance of <see cref="AppSoftware"/>. |
| /// </summary> |
| /// </summary> |
| public AppSoftware() : base() |
| public AppSoftware() : base() |
| { |
| { |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Creates new instance of <see cref="AppSoftware"/>. |
| /// Creates new instance of <see cref="AppSoftware"/>. |
| /// </summary> |
| /// </summary> |
| /// <param name="name"></param> |
| /// <param name="name"></param> |
| public AppSoftware(string name) : base() |
| public AppSoftware(string name) : base() |
| { |
| { |
| Name = name; |
| Name = name; |
| } |
| } |
| |
| |
| /// <inheritdoc/> |
| /// <inheritdoc/> |
| public override void CopyDiffTo(object target) |
| public override void CopyDiffTo(object target) |
| { |
| { |
| base.CopyDiffTo(target); |
| base.CopyDiffTo(target); |
| |
| |
| if (target is AppSoftware tro) |
| if (target is AppSoftware 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(Arguments, tro.Arguments, StringComparison.Ordinal)) |
| if (!string.Equals(Arguments, tro.Arguments, StringComparison.Ordinal)) |
| { |
| { |
| tro.Arguments = Arguments; |
| tro.Arguments = Arguments; |
| } |
| } |
| |
| |
| if (!string.Equals(Path, tro.Path, StringComparison.Ordinal)) |
| if (!string.Equals(Path, tro.Path, StringComparison.Ordinal)) |
| { |
| { |
| tro.Path = Path; |
| tro.Path = Path; |
| } |
| } |
| |
| |
| if (!string.Equals(WorkingDir, tro.WorkingDir, StringComparison.Ordinal)) |
| if (!string.Equals(WorkingDir, tro.WorkingDir, StringComparison.Ordinal)) |
| { |
| { |
| tro.WorkingDir = WorkingDir; |
| tro.WorkingDir = WorkingDir; |
| } |
| } |
| |
| |
| if (ShowOnSidebar != tro.ShowOnSidebar) |
| if (ShowOnSidebar != tro.ShowOnSidebar) |
| { |
| { |
| tro.ShowOnSidebar = ShowOnSidebar; |
| tro.ShowOnSidebar = ShowOnSidebar; |
. | |
| } |
| |
| |
| |
| if (AppType != tro.AppType) |
| |
| { |
| |
| tro.AppType = AppType; |
| |
| } |
| |
| |
| |
| if (!string.Equals(Script, tro.Script, StringComparison.Ordinal)) |
| |
| { |
| |
| tro.Script = Script; |
| } |
| } |
| } |
| } |
| 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}"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |