2024-08-12 00:15:16 -05:00
|
|
|
|
using LANCommander.SDK.Enums;
|
2024-01-08 02:37:36 -06:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2023-01-02 15:44:04 -06:00
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
|
2024-08-04 18:44:33 -05:00
|
|
|
|
namespace LANCommander.Server.Data.Models
|
2023-01-02 15:44:04 -06:00
|
|
|
|
{
|
|
|
|
|
|
[Table("Games")]
|
|
|
|
|
|
public class Game : BaseModel
|
|
|
|
|
|
{
|
2023-01-10 02:25:16 -06:00
|
|
|
|
public long? IGDBId { get; set; }
|
2023-01-02 15:44:04 -06:00
|
|
|
|
public string Title { get; set; }
|
2023-01-03 18:11:45 -06:00
|
|
|
|
[Display(Name = "Sort Title")]
|
2023-01-02 15:44:04 -06:00
|
|
|
|
public string? SortTitle { get; set; }
|
2023-01-03 18:11:45 -06:00
|
|
|
|
[Display(Name = "Directory Name")]
|
2023-01-02 15:44:04 -06:00
|
|
|
|
public string? DirectoryName { get; set; }
|
2023-01-10 02:25:16 -06:00
|
|
|
|
public string? Description { get; set; }
|
2023-08-27 12:31:04 -05:00
|
|
|
|
public string? Notes { get; set; }
|
|
|
|
|
|
|
2023-01-03 18:11:45 -06:00
|
|
|
|
[Display(Name = "Released On")]
|
2023-01-10 02:25:16 -06:00
|
|
|
|
public DateTime? ReleasedOn { get; set; }
|
2023-01-02 15:44:04 -06:00
|
|
|
|
|
2025-02-09 14:10:06 -06:00
|
|
|
|
public virtual ICollection<Action>? Actions { get; set; }
|
2023-01-02 15:44:04 -06:00
|
|
|
|
|
2024-09-03 19:57:39 -05:00
|
|
|
|
public KeyAllocationMethod KeyAllocationMethod { get; set; } = KeyAllocationMethod.UserAccount;
|
|
|
|
|
|
|
2024-01-08 02:37:36 -06:00
|
|
|
|
public GameType Type { get; set; }
|
|
|
|
|
|
public Guid? BaseGameId { get; set; }
|
|
|
|
|
|
[ForeignKey(nameof(BaseGameId))]
|
|
|
|
|
|
public virtual Game? BaseGame { get; set; }
|
|
|
|
|
|
|
2023-01-10 02:25:16 -06:00
|
|
|
|
public bool Singleplayer { get; set; } = false;
|
2023-01-02 15:44:04 -06:00
|
|
|
|
|
2024-03-29 17:19:42 -05:00
|
|
|
|
public Guid? EngineId { get; set; }
|
|
|
|
|
|
[ForeignKey(nameof(EngineId))]
|
|
|
|
|
|
public virtual Engine Engine { get; set; }
|
|
|
|
|
|
|
2025-02-09 14:10:06 -06:00
|
|
|
|
public ICollection<MultiplayerMode>? MultiplayerModes { get; set; }
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public ICollection<Genre>? Genres { get; set; } = new List<Genre>();
|
|
|
|
|
|
public ICollection<Tag>? Tags { get; set; } = new List<Tag>();
|
2025-02-09 14:10:06 -06:00
|
|
|
|
public ICollection<Platform>? Platforms { get; set; }
|
|
|
|
|
|
public ICollection<Category>? Categories { get; set; }
|
|
|
|
|
|
public ICollection<Company>? Publishers { get; set; }
|
|
|
|
|
|
public ICollection<Company>? Developers { get; set; }
|
|
|
|
|
|
public ICollection<Archive>? Archives { get; set; }
|
|
|
|
|
|
public ICollection<Script>? Scripts { get; set; }
|
|
|
|
|
|
public ICollection<GameSave>? GameSaves { get; set; }
|
|
|
|
|
|
public ICollection<PlaySession>? PlaySessions { get; set; }
|
|
|
|
|
|
public ICollection<SavePath>? SavePaths { get; set; }
|
|
|
|
|
|
public ICollection<Server>? Servers { get; set; }
|
|
|
|
|
|
public ICollection<Redistributable>? Redistributables { get; set; }
|
|
|
|
|
|
public ICollection<Media>? Media { get; set; }
|
2023-01-07 20:54:24 -06:00
|
|
|
|
|
|
|
|
|
|
public string? ValidKeyRegex { get; set; }
|
2025-02-09 14:10:06 -06:00
|
|
|
|
public ICollection<Key>? Keys { get; set; }
|
|
|
|
|
|
public ICollection<Collection> Collections { get; set; }
|
|
|
|
|
|
public ICollection<Game> DependentGames { get; set; }
|
|
|
|
|
|
public ICollection<Issue> Issues { get; set; }
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public ICollection<Page>? Pages { get; set; }
|
2025-02-09 14:10:06 -06:00
|
|
|
|
public ICollection<Library> Libraries { get; set; }
|
|
|
|
|
|
public ICollection<GameCustomField>? CustomFields { get; set; }
|
2025-05-23 02:17:06 -05:00
|
|
|
|
|
|
|
|
|
|
[NotMapped]
|
|
|
|
|
|
public bool IsAddon => AddonTypes.Contains(Type);
|
|
|
|
|
|
|
|
|
|
|
|
[NotMapped]
|
|
|
|
|
|
public GameType[] AddonTypes =
|
|
|
|
|
|
[
|
|
|
|
|
|
GameType.Expansion,
|
|
|
|
|
|
GameType.Mod
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
[NotMapped]
|
|
|
|
|
|
public IEnumerable<Game> Addons {
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (DependentGames != null)
|
|
|
|
|
|
return DependentGames.Where(g => AddonTypes.Contains(g.Type));
|
|
|
|
|
|
else
|
|
|
|
|
|
return [];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-01-02 15:44:04 -06:00
|
|
|
|
}
|
|
|
|
|
|
}
|