Game.cs 4.1 KB

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