2
0

Game.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using MediaBrowser.Controller.Providers;
  2. using MediaBrowser.Model.Configuration;
  3. using MediaBrowser.Model.Entities;
  4. using System;
  5. using System.Collections.Generic;
  6. namespace MediaBrowser.Controller.Entities
  7. {
  8. public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, IHasPreferredMetadataLanguage, IHasLookupInfo<GameInfo>
  9. {
  10. public List<Guid> SoundtrackIds { get; set; }
  11. public List<Guid> ThemeSongIds { get; set; }
  12. public List<Guid> ThemeVideoIds { get; set; }
  13. public string PreferredMetadataLanguage { get; set; }
  14. /// <summary>
  15. /// Gets or sets the preferred metadata country code.
  16. /// </summary>
  17. /// <value>The preferred metadata country code.</value>
  18. public string PreferredMetadataCountryCode { get; set; }
  19. public Game()
  20. {
  21. MultiPartGameFiles = new List<string>();
  22. SoundtrackIds = new List<Guid>();
  23. RemoteTrailers = new List<MediaUrl>();
  24. LocalTrailerIds = new List<Guid>();
  25. ThemeSongIds = new List<Guid>();
  26. ThemeVideoIds = new List<Guid>();
  27. Tags = new List<string>();
  28. }
  29. public List<Guid> LocalTrailerIds { get; set; }
  30. /// <summary>
  31. /// Gets or sets the tags.
  32. /// </summary>
  33. /// <value>The tags.</value>
  34. public List<string> Tags { get; set; }
  35. /// <summary>
  36. /// Gets or sets the remote trailers.
  37. /// </summary>
  38. /// <value>The remote trailers.</value>
  39. public List<MediaUrl> RemoteTrailers { get; set; }
  40. /// <summary>
  41. /// Gets the type of the media.
  42. /// </summary>
  43. /// <value>The type of the media.</value>
  44. public override string MediaType
  45. {
  46. get { return Model.Entities.MediaType.Game; }
  47. }
  48. /// <summary>
  49. /// Gets or sets the players supported.
  50. /// </summary>
  51. /// <value>The players supported.</value>
  52. public int? PlayersSupported { get; set; }
  53. /// <summary>
  54. /// Gets or sets a value indicating whether this instance is installed on client.
  55. /// </summary>
  56. /// <value><c>true</c> if this instance is installed on client; otherwise, <c>false</c>.</value>
  57. public bool IsInstalledOnClient { get; set; }
  58. /// <summary>
  59. /// Gets or sets the game system.
  60. /// </summary>
  61. /// <value>The game system.</value>
  62. public string GameSystem { get; set; }
  63. /// <summary>
  64. /// Gets or sets a value indicating whether this instance is multi part.
  65. /// </summary>
  66. /// <value><c>true</c> if this instance is multi part; otherwise, <c>false</c>.</value>
  67. public bool IsMultiPart { get; set; }
  68. /// <summary>
  69. /// Holds the paths to the game files in the event this is a multipart game
  70. /// </summary>
  71. public List<string> MultiPartGameFiles { get; set; }
  72. public override string GetUserDataKey()
  73. {
  74. var id = this.GetProviderId(MetadataProviders.Gamesdb);
  75. if (!string.IsNullOrEmpty(id))
  76. {
  77. return "Game-Gamesdb-" + id;
  78. }
  79. return base.GetUserDataKey();
  80. }
  81. public override IEnumerable<string> GetDeletePaths()
  82. {
  83. if (!IsInMixedFolder)
  84. {
  85. return new[] { System.IO.Path.GetDirectoryName(Path) };
  86. }
  87. return base.GetDeletePaths();
  88. }
  89. protected override bool GetBlockUnratedValue(UserConfiguration config)
  90. {
  91. return config.BlockUnratedGames;
  92. }
  93. public GameInfo GetLookupInfo()
  94. {
  95. var id = GetItemLookupInfo<GameInfo>();
  96. id.GameSystem = GameSystem;
  97. return id;
  98. }
  99. }
  100. }