Game.cs 3.7 KB

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