Game.cs 3.4 KB

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