. | using Playnite.SDK.Metadata; |
| |
| using Playnite.SDK.Models; |
| using Playnite.SDK.Models; |
| using System; |
| using System; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
| using System.Linq; |
| using System.Linq; |
| using System.Text; |
| using System.Text; |
. | |
| using System.Threading; |
| using System.Threading.Tasks; |
| using System.Threading.Tasks; |
| |
| |
| namespace Playnite.SDK.Plugins |
| namespace Playnite.SDK.Plugins |
| { |
| { |
| /// <summary> |
| /// <summary> |
| /// Represents metadata game fields. |
| /// Represents metadata game fields. |
| /// </summary> |
| /// </summary> |
| public enum MetadataField |
| public enum MetadataField |
| { |
| { |
| /// <summary> |
| /// <summary> |
| /// Name can be provided. |
| /// Name can be provided. |
| /// </summary> |
| /// </summary> |
| Name, |
| Name, |
| /// <summary> |
| /// <summary> |
| /// Genres can be provided. |
| /// Genres can be provided. |
| /// </summary> |
| /// </summary> |
| Genres, |
| Genres, |
| /// <summary> |
| /// <summary> |
| /// Release Data can be provided. |
| /// Release Data can be provided. |
| /// </summary> |
| /// </summary> |
| ReleaseDate, |
| ReleaseDate, |
| /// <summary> |
| /// <summary> |
| /// List of Developers can be provided. |
| /// List of Developers can be provided. |
| /// </summary> |
| /// </summary> |
| Developers, |
| Developers, |
| /// <summary> |
| /// <summary> |
| /// List of Publishers can be provided. |
| /// List of Publishers can be provided. |
| /// </summary> |
| /// </summary> |
| Publishers, |
| Publishers, |
| /// <summary> |
| /// <summary> |
| /// List of Tags can be provided. |
| /// List of Tags can be provided. |
| /// </summary> |
| /// </summary> |
| Tags, |
| Tags, |
| /// <summary> |
| /// <summary> |
| /// Description can be provided. |
| /// Description can be provided. |
| /// </summary> |
| /// </summary> |
| Description, |
| Description, |
| /// <summary> |
| /// <summary> |
| /// List of associated Links can be provided. |
| /// List of associated Links can be provided. |
| /// </summary> |
| /// </summary> |
| Links, |
| Links, |
| /// <summary> |
| /// <summary> |
| /// Critics Score can be provided. |
| /// Critics Score can be provided. |
| /// </summary> |
| /// </summary> |
| CriticScore, |
| CriticScore, |
| /// <summary> |
| /// <summary> |
| /// Community Score can be provided. |
| /// Community Score can be provided. |
| /// </summary> |
| /// </summary> |
| CommunityScore, |
| CommunityScore, |
| /// <summary> |
| /// <summary> |
| /// Icon can be provided. |
| /// Icon can be provided. |
| /// </summary> |
| /// </summary> |
| Icon, |
| Icon, |
| /// <summary> |
| /// <summary> |
| /// Cover Image can be provided. |
| /// Cover Image can be provided. |
| /// </summary> |
| /// </summary> |
| CoverImage, |
| CoverImage, |
| /// <summary> |
| /// <summary> |
| /// Background Image can be provided. |
| /// Background Image can be provided. |
| /// </summary> |
| /// </summary> |
| BackgroundImage, |
| BackgroundImage, |
| /// <summary> |
| /// <summary> |
| /// List of Features can be provided. |
| /// List of Features can be provided. |
| /// </summary> |
| /// </summary> |
| Features, |
| Features, |
| /// <summary> |
| /// <summary> |
| /// Age Rating can be provided. |
| /// Age Rating can be provided. |
| /// </summary> |
| /// </summary> |
| AgeRating, |
| AgeRating, |
| /// <summary> |
| /// <summary> |
| /// Name of the Series can be provided. |
| /// Name of the Series can be provided. |
| /// </summary> |
| /// </summary> |
| Series, |
| Series, |
| /// <summary> |
| /// <summary> |
| /// Region can be provided. |
| /// Region can be provided. |
| /// </summary> |
| /// </summary> |
| Region, |
| Region, |
| /// <summary> |
| /// <summary> |
| /// Platform can be provided. |
| /// Platform can be provided. |
| /// </summary> |
| /// </summary> |
| Platform |
| Platform |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Represents options for game metadata download. |
| /// Represents options for game metadata download. |
| /// </summary> |
| /// </summary> |
| public class MetadataRequestOptions |
| public class MetadataRequestOptions |
| { |
| { |
| /// <summary> |
| /// <summary> |
| /// Gets or sets game data are being requested for. |
| /// Gets or sets game data are being requested for. |
| /// </summary> |
| /// </summary> |
| public Game GameData |
| public Game GameData |
| { |
| { |
| get; set; |
| get; set; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets or sets value indicating whether the request is part of bulk metadata download. |
| /// Gets or sets value indicating whether the request is part of bulk metadata download. |
| /// </summary> |
| /// </summary> |
| public bool IsBackgroundDownload |
| public bool IsBackgroundDownload |
| { |
| { |
| get; set; |
| get; set; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Creates new instance of <see cref="MetadataRequestOptions"/>. |
| /// Creates new instance of <see cref="MetadataRequestOptions"/>. |
| /// </summary> |
| /// </summary> |
| /// <param name="gameData"></param> |
| /// <param name="gameData"></param> |
| /// <param name="backgroundDownload"></param> |
| /// <param name="backgroundDownload"></param> |
| public MetadataRequestOptions(Game gameData, bool backgroundDownload) |
| public MetadataRequestOptions(Game gameData, bool backgroundDownload) |
| { |
| { |
| GameData = gameData; |
| GameData = gameData; |
| IsBackgroundDownload = backgroundDownload; |
| IsBackgroundDownload = backgroundDownload; |
| } |
| } |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
. | |
| /// Represents arguments for metadata field getters. |
| |
| /// </summary> |
| |
| public class GetMetadataFieldArgs |
| |
| { |
| |
| /// <summary> |
| |
| /// Gets cancellation token. |
| |
| /// </summary> |
| |
| public CancellationToken CancelToken { get; internal set; } |
| |
| } |
| |
| |
| |
| /// <summary> |
| /// Represents metadata class providing specific fields when requested. |
| /// Represents metadata class providing specific fields when requested. |
| /// </summary> |
| /// </summary> |
| public abstract class OnDemandMetadataProvider : IDisposable |
| public abstract class OnDemandMetadataProvider : IDisposable |
| { |
| { |
| /// <summary> |
| /// <summary> |
| /// Gets currently available fields. |
| /// Gets currently available fields. |
| /// </summary> |
| /// </summary> |
| public abstract List<MetadataField> AvailableFields { get; } |
| public abstract List<MetadataField> AvailableFields { get; } |
| |
| |
| /// <inheritdoc /> |
| /// <inheritdoc /> |
| public virtual void Dispose() |
| public virtual void Dispose() |
| { |
| { |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets name. |
| /// Gets name. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual string GetName() |
| public virtual string GetName(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets genres. |
| /// Gets genres. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual List<string> GetGenres() |
| public virtual IEnumerable<MetadataProperty> GetGenres(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets relese date. |
| /// Gets relese date. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual DateTime? GetReleaseDate() |
| public virtual ReleaseDate? GetReleaseDate(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets developers. |
| /// Gets developers. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual List<string> GetDevelopers() |
| public virtual IEnumerable<MetadataProperty> GetDevelopers(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets publishers. |
| /// Gets publishers. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual List<string> GetPublishers() |
| public virtual IEnumerable<MetadataProperty> GetPublishers(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets tags. |
| /// Gets tags. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual List<string> GetTags() |
| public virtual IEnumerable<MetadataProperty> GetTags(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets descriptions. |
| /// Gets descriptions. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual string GetDescription() |
| public virtual string GetDescription(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets critic score. |
| /// Gets critic score. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual int? GetCriticScore() |
| public virtual int? GetCriticScore(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets community score. |
| /// Gets community score. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual int? GetCommunityScore() |
| public virtual int? GetCommunityScore(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets cover image. |
| /// Gets cover image. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual MetadataFile GetCoverImage() |
| public virtual MetadataFile GetCoverImage(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets icon image. |
| /// Gets icon image. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual MetadataFile GetIcon() |
| public virtual MetadataFile GetIcon(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets background image. |
| /// Gets background image. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual MetadataFile GetBackgroundImage() |
| public virtual MetadataFile GetBackgroundImage(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets links. |
| /// Gets links. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual List<Link> GetLinks() |
| public virtual IEnumerable<Link> GetLinks(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets features. |
| /// Gets features. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual List<string> GetFeatures() |
| public virtual IEnumerable<MetadataProperty> GetFeatures(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets age rating. |
| /// Gets age rating. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual string GetAgeRating() |
| public virtual IEnumerable<MetadataProperty> GetAgeRatings(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets series. |
| /// Gets series. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual string GetSeries() |
| public virtual IEnumerable<MetadataProperty> GetSeries(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets region. |
| /// Gets region. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual string GetRegion() |
| public virtual IEnumerable<MetadataProperty> GetRegions(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets platform. |
| /// Gets platform. |
| /// </summary> |
| /// </summary> |
| /// <returns></returns> |
| /// <returns></returns> |
. | public virtual string GetPlatform() |
| public virtual IEnumerable<MetadataProperty> GetPlatforms(GetMetadataFieldArgs args) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
. | |
| /// Represents <see cref="MetadataPlugin"/> plugin properties. |
| |
| /// </summary> |
| |
| public class MetadataPluginProperties : PluginProperties |
| |
| { |
| |
| } |
| |
| |
| |
| /// <summary> |
| /// Represents plugin providing game metadata. |
| /// Represents plugin providing game metadata. |
| /// </summary> |
| /// </summary> |
| public abstract class MetadataPlugin : Plugin |
| public abstract class MetadataPlugin : Plugin |
| { |
| { |
. | |
| /// <summary> |
| |
| /// Gets plugin's properties. |
| |
| /// </summary> |
| |
| public MetadataPluginProperties Properties { get; protected set; } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets metadata source name. |
| /// Gets metadata source name. |
| /// </summary> |
| /// </summary> |
| public abstract string Name { get; } |
| public abstract string Name { get; } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets list of game fields this metadata provider can provide. |
| /// Gets list of game fields this metadata provider can provide. |
| /// </summary> |
| /// </summary> |
| public abstract List<MetadataField> SupportedFields { get; } |
| public abstract List<MetadataField> SupportedFields { get; } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Creates new instance of <see cref="MetadataPlugin"/>. |
| /// Creates new instance of <see cref="MetadataPlugin"/>. |
| /// </summary> |
| /// </summary> |
| /// <param name="playniteAPI"></param> |
| /// <param name="playniteAPI"></param> |
| public MetadataPlugin(IPlayniteAPI playniteAPI) : base(playniteAPI) |
| public MetadataPlugin(IPlayniteAPI playniteAPI) : base(playniteAPI) |
| { |
| { |
| } |
| } |
| |
| |
| /// <summary> |
| /// <summary> |
| /// Gets metadata provider. |
| /// Gets metadata provider. |
| /// </summary> |
| /// </summary> |
| /// <param name="options"></param> |
| /// <param name="options"></param> |
| /// <returns></returns> |
| /// <returns></returns> |
| public abstract OnDemandMetadataProvider GetMetadataProvider(MetadataRequestOptions options); |
| public abstract OnDemandMetadataProvider GetMetadataProvider(MetadataRequestOptions options); |
| } |
| } |
| } |
| } |
| |
| |