Game.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 = new string[] {};
  15. RemoteTrailers = EmptyMediaUrlArray;
  16. LocalTrailerIds = new Guid[] {};
  17. RemoteTrailerIds = new 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 or sets the remote trailers.
  37. /// </summary>
  38. /// <value>The remote trailers.</value>
  39. public MediaUrl[] RemoteTrailers { get; set; }
  40. /// <summary>
  41. /// Gets the type of the media.
  42. /// </summary>
  43. /// <value>The type of the media.</value>
  44. [IgnoreDataMember]
  45. public override string MediaType
  46. {
  47. get { return Model.Entities.MediaType.Game; }
  48. }
  49. /// <summary>
  50. /// Gets or sets the players supported.
  51. /// </summary>
  52. /// <value>The players supported.</value>
  53. public int? PlayersSupported { get; set; }
  54. /// <summary>
  55. /// Gets a value indicating whether this instance is place holder.
  56. /// </summary>
  57. /// <value><c>true</c> if this instance is place holder; otherwise, <c>false</c>.</value>
  58. public bool IsPlaceHolder { get; set; }
  59. /// <summary>
  60. /// Gets or sets the game system.
  61. /// </summary>
  62. /// <value>The game system.</value>
  63. public string GameSystem { get; set; }
  64. /// <summary>
  65. /// Gets or sets a value indicating whether this instance is multi part.
  66. /// </summary>
  67. /// <value><c>true</c> if this instance is multi part; otherwise, <c>false</c>.</value>
  68. public bool IsMultiPart { get; set; }
  69. /// <summary>
  70. /// Holds the paths to the game files in the event this is a multipart game
  71. /// </summary>
  72. public string[] MultiPartGameFiles { get; set; }
  73. public override List<string> GetUserDataKeys()
  74. {
  75. var list = base.GetUserDataKeys();
  76. var id = this.GetProviderId(MetadataProviders.Gamesdb);
  77. if (!string.IsNullOrEmpty(id))
  78. {
  79. list.Insert(0, "Game-Gamesdb-" + id);
  80. }
  81. return list;
  82. }
  83. public override IEnumerable<FileSystemMetadata> GetDeletePaths()
  84. {
  85. if (!IsInMixedFolder)
  86. {
  87. return new[] {
  88. new FileSystemMetadata
  89. {
  90. FullName = FileSystem.GetDirectoryName(Path),
  91. IsDirectory = true
  92. }
  93. };
  94. }
  95. return base.GetDeletePaths();
  96. }
  97. public override UnratedItem GetBlockUnratedType()
  98. {
  99. return UnratedItem.Game;
  100. }
  101. public GameInfo GetLookupInfo()
  102. {
  103. var id = GetItemLookupInfo<GameInfo>();
  104. id.GameSystem = GameSystem;
  105. return id;
  106. }
  107. }
  108. }