Game.cs 4.0 KB

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