| using Playnite.SDK.Models; |
| using Playnite.SDK.Models; |
| 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; |
| using System.Threading.Tasks; |
| using System.Threading.Tasks; |
| using System.Windows.Controls; |
| using System.Windows.Controls; |
| |
| |
| namespace Playnite.SDK.Plugins |
| namespace Playnite.SDK.Plugins |
| { |
| { |
| /// <summary> |
| /// <summary> |
. | /// Represents capabilities of a library plugin. |
| /// Represents arguments for <see cref="LibraryPlugin.GetGames(LibraryGetGamesArgs)"/> method. |
| /// </summary> |
| /// </summary> |
. | public class LibraryPluginCapabilities |
| public class LibraryGetGamesArgs |
| |
| { |
| |
| /// <summary> |
| |
| /// Gets cancellataion token. |
| |
| /// </summary> |
| |
| public CancellationToken CancelToken { get; internal set; } |
| |
| } |
| |
| |
| |
| /// <summary> |
| |
| /// Represents arguments for <see cref="LibraryPlugin.ImportGames(LibraryImportGamesArgs)"/> method. |
| |
| /// </summary> |
| |
| public class LibraryImportGamesArgs |
| |
| { |
| |
| /// <summary> |
| |
| /// Gets cancellataion token. |
| |
| /// </summary> |
| |
| public CancellationToken CancelToken { get; internal set; } |
| |
| } |
| |
| |
| |
| /// <summary> |
| |
| /// Represents <see cref="LibraryPlugin"/> plugin properties. |
| |
| /// </summary> |
| |
| public class LibraryPluginProperties : PluginProperties |
| { |
| { |
| /// <summary> |
| /// <summary> |
| /// Gets or sets value indicating whether plugin is capable of closing down original game client. |
| /// Gets or sets value indicating whether plugin is capable of closing down original game client. |
| /// </summary> |
| /// </summary> |
| public bool CanShutdownClient { get; set; } = false; |
| public bool CanShutdownClient { get; set; } = false; |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets or sets value indicated whether plugin uses customized mechanism for game import. |
| /// Gets or sets value indicated whether plugin uses customized mechanism for game import. |
| /// </summary> |
| /// </summary> |
| public bool HasCustomizedGameImport { get; set; } = false; |
| public bool HasCustomizedGameImport { get; set; } = false; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Represents base game library plugin. |
| /// Represents base game library plugin. |
| /// </summary> |
| /// </summary> |
| public abstract class LibraryPlugin : Plugin |
| public abstract class LibraryPlugin : Plugin |
| { |
| { |
| /// <summary> |
| /// <summary> |
. | |
| /// Gets plugin's properties. |
| |
| /// </summary> |
| |
| public LibraryPluginProperties Properties { get; protected set; } |
| |
| |
| |
| /// <summary> |
| /// Creates new instance of <see cref="LibraryPlugin"/>. |
| /// Creates new instance of <see cref="LibraryPlugin"/>. |
| /// </summary> |
| /// </summary> |
| /// <param name="playniteAPI"></param> |
| /// <param name="playniteAPI"></param> |
| public LibraryPlugin(IPlayniteAPI playniteAPI) : base(playniteAPI) |
| public LibraryPlugin(IPlayniteAPI playniteAPI) : base(playniteAPI) |
| { |
| { |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets library name; |
| /// Gets library name; |
| /// </summary> |
| /// </summary> |
| public abstract string Name { get; } |
| public abstract string Name { get; } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets library icon or null if no icon is available. |
| /// Gets library icon or null if no icon is available. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
| public virtual string LibraryIcon { get; } |
| public virtual string LibraryIcon { get; } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets library background image or null if no background is available. |
| /// Gets library background image or null if no background is available. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
| public virtual string LibraryBackground { get; } |
| public virtual string LibraryBackground { get; } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets library client application or null of no client is associated with this library. |
| /// Gets library client application or null of no client is associated with this library. |
| /// </summary> |
| /// </summary> |
| public virtual LibraryClient Client { get; } |
| public virtual LibraryClient Client { get; } |
| |
| |
| /// <summary> |
| /// <summary> |
. | /// Gets plugin's library capabilities. |
| |
| /// </summary> |
| |
| public virtual LibraryPluginCapabilities Capabilities { get; } |
| |
| |
| |
| /// <summary> |
| |
| /// Gets library games. |
| /// Gets library games. |
| /// </summary> |
| /// </summary> |
| /// <returns>List of library games.</returns> |
| /// <returns>List of library games.</returns> |
. | public virtual IEnumerable<GameInfo> GetGames() |
| public virtual IEnumerable<GameMetadata> GetGames(LibraryGetGamesArgs args) |
| { |
| { |
. | return new List<GameInfo>(); |
| return new List<GameMetadata>(); |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Initiates game import if "HasCustomizedGameImport" capability is enabled. |
| /// Initiates game import if "HasCustomizedGameImport" capability is enabled. |
| /// </summary> |
| /// </summary> |
| /// <returns>List of newly imported games.</returns> |
| /// <returns>List of newly imported games.</returns> |
. | public virtual IEnumerable<Game> ImportGames() |
| public virtual IEnumerable<Game> ImportGames(LibraryImportGamesArgs args) |
| { |
| { |
| return new List<Game>(); |
| return new List<Game>(); |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
. | /// Gets controller responsible for handling of library game or null if no specific controller is available. |
| |
| /// </summary> |
| |
| /// <param name="game">Game to be handled.</param> |
| |
| /// <returns>Game controller.</returns> |
| |
| public virtual IGameController GetGameController(Game game) |
| |
| { |
| |
| return null; |
| |
| } |
| |
| |
| |
| /// <summary> |
| |
| /// Gets library metadata downloader or null if no metadata provider is available. |
| /// Gets library metadata downloader or null if no metadata provider is available. |
| /// </summary> |
| /// </summary> |
| /// <returns>Metadata downloader.</returns> |
| /// <returns>Metadata downloader.</returns> |
| public virtual LibraryMetadataProvider GetMetadataDownloader() |
| public virtual LibraryMetadataProvider GetMetadataDownloader() |
| { |
| { |
| return null; |
| return null; |
. | |
| } |
| |
| |
| |
| ///<inheritdoc/> |
| |
| public override string ToString() |
| |
| { |
| |
| return Name; |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |