using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Linq; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities { public class Game : BaseItem, IHasTrailers, IHasScreenshots, ISupportsPlaceHolders, IHasLookupInfo { public Game() { MultiPartGameFiles = new List(); RemoteTrailers = new List(); LocalTrailerIds = new List(); RemoteTrailerIds = new List(); } public List LocalTrailerIds { get; set; } public List RemoteTrailerIds { get; set; } public override bool CanDownload() { var locationType = LocationType; return locationType != LocationType.Remote && locationType != LocationType.Virtual; } [IgnoreDataMember] public override bool EnableRefreshOnDateModifiedChange { get { return true; } } [IgnoreDataMember] public override bool SupportsThemeMedia { get { return true; } } /// /// Gets or sets the remote trailers. /// /// The remote trailers. public List RemoteTrailers { get; set; } /// /// Gets the type of the media. /// /// The type of the media. [IgnoreDataMember] public override string MediaType { get { return Model.Entities.MediaType.Game; } } /// /// Gets or sets the players supported. /// /// The players supported. public int? PlayersSupported { get; set; } /// /// Gets a value indicating whether this instance is place holder. /// /// true if this instance is place holder; otherwise, false. public bool IsPlaceHolder { get; set; } /// /// Gets or sets the game system. /// /// The game system. public string GameSystem { get; set; } /// /// Gets or sets a value indicating whether this instance is multi part. /// /// true if this instance is multi part; otherwise, false. public bool IsMultiPart { get; set; } /// /// Holds the paths to the game files in the event this is a multipart game /// public List MultiPartGameFiles { get; set; } public override List GetUserDataKeys() { var list = base.GetUserDataKeys(); var id = this.GetProviderId(MetadataProviders.Gamesdb); if (!string.IsNullOrEmpty(id)) { list.Insert(0, "Game-Gamesdb-" + id); } return list; } public override IEnumerable GetDeletePaths() { if (!IsInMixedFolder) { return new[] { new FileSystemMetadata { FullName = FileSystem.GetDirectoryName(Path), IsDirectory = true } }; } return base.GetDeletePaths(); } public override UnratedItem GetBlockUnratedType() { return UnratedItem.Game; } public GameInfo GetLookupInfo() { var id = GetItemLookupInfo(); id.GameSystem = GameSystem; return id; } /// /// Gets the trailer ids. /// /// List<Guid>. public List GetTrailerIds() { var list = LocalTrailerIds.ToList(); list.AddRange(RemoteTrailerIds); return list; } } }