Game.cs 4.3 KB

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