Game.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System;
  2. using System.Collections.Generic;
  3. using MediaBrowser.Controller.Providers;
  4. using MediaBrowser.Model.Configuration;
  5. using MediaBrowser.Model.Entities;
  6. using MediaBrowser.Model.IO;
  7. using MediaBrowser.Model.Serialization;
  8. namespace MediaBrowser.Controller.Entities
  9. {
  10. public class Game : BaseItem, IHasTrailers, IHasScreenshots, ISupportsPlaceHolders, IHasLookupInfo<GameInfo>
  11. {
  12. public Game()
  13. {
  14. MultiPartGameFiles = Array.Empty<string>();
  15. RemoteTrailers = EmptyMediaUrlArray;
  16. LocalTrailerIds = Array.Empty<Guid>();
  17. RemoteTrailerIds = Array.Empty<Guid>();
  18. }
  19. public Guid[] LocalTrailerIds { get; set; }
  20. public Guid[] RemoteTrailerIds { get; set; }
  21. public override bool CanDownload()
  22. {
  23. return IsFileProtocol;
  24. }
  25. [IgnoreDataMember]
  26. public override bool SupportsThemeMedia
  27. {
  28. get { return true; }
  29. }
  30. [IgnoreDataMember]
  31. public override bool SupportsPeople
  32. {
  33. get { return false; }
  34. }
  35. /// <summary>
  36. /// Gets the type of the media.
  37. /// </summary>
  38. /// <value>The type of the media.</value>
  39. [IgnoreDataMember]
  40. public override string MediaType
  41. {
  42. get { return Model.Entities.MediaType.Game; }
  43. }
  44. /// <summary>
  45. /// Gets or sets the players supported.
  46. /// </summary>
  47. /// <value>The players supported.</value>
  48. public int? PlayersSupported { get; set; }
  49. /// <summary>
  50. /// Gets a value indicating whether this instance is place holder.
  51. /// </summary>
  52. /// <value><c>true</c> if this instance is place holder; otherwise, <c>false</c>.</value>
  53. public bool IsPlaceHolder { get; set; }
  54. /// <summary>
  55. /// Gets or sets the game system.
  56. /// </summary>
  57. /// <value>The game system.</value>
  58. public string GameSystem { get; set; }
  59. /// <summary>
  60. /// Gets or sets a value indicating whether this instance is multi part.
  61. /// </summary>
  62. /// <value><c>true</c> if this instance is multi part; otherwise, <c>false</c>.</value>
  63. public bool IsMultiPart { get; set; }
  64. /// <summary>
  65. /// Holds the paths to the game files in the event this is a multipart game
  66. /// </summary>
  67. public string[] MultiPartGameFiles { get; set; }
  68. public override List<string> GetUserDataKeys()
  69. {
  70. var list = base.GetUserDataKeys();
  71. var id = this.GetProviderId(MetadataProviders.Gamesdb);
  72. if (!string.IsNullOrEmpty(id))
  73. {
  74. list.Insert(0, "Game-Gamesdb-" + id);
  75. }
  76. return list;
  77. }
  78. public override IEnumerable<FileSystemMetadata> GetDeletePaths()
  79. {
  80. if (!IsInMixedFolder)
  81. {
  82. return new[] {
  83. new FileSystemMetadata
  84. {
  85. FullName = FileSystem.GetDirectoryName(Path),
  86. IsDirectory = true
  87. }
  88. };
  89. }
  90. return base.GetDeletePaths();
  91. }
  92. public override UnratedItem GetBlockUnratedType()
  93. {
  94. return UnratedItem.Game;
  95. }
  96. public GameInfo GetLookupInfo()
  97. {
  98. var id = GetItemLookupInfo<GameInfo>();
  99. id.GameSystem = GameSystem;
  100. return id;
  101. }
  102. }
  103. }