LANCommander/LANCommander.Server/Templates/Wiki/Game.cshtml
2024-08-12 00:15:16 -05:00

80 lines
2 KiB
Text

@using LANCommander.PCGamingWiki
@using LANCommander.SDK.Enums
@model LANCommander.Server.Data.Models.Game
@{
Layout = null;
var PCGamingWikiClient = new PCGamingWikiClient();
Dictionary<string, ScriptType> scriptTypes = new Dictionary<string, ScriptType>()
{
{ "Install Script", ScriptType.Install },
{ "Uninstall Script", ScriptType.Uninstall },
{ "Name Change Script", ScriptType.NameChange },
{ "Key Change Script", ScriptType.KeyChange }
};
var pcgwGame = await PCGamingWikiClient.Search(Model.Title);
}
[[Category:Games]]
{{Game.InfoBox
|Cover = cover.jpg
|Developers =
@foreach (var company in Model.Developers)
{
<text>{{Game.InfoBox.Developer|@company.Name}}</text>
}
|Publishers =
@foreach (var company in Model.Publishers)
{
<text>{{Game.InfoBox.Publisher|@company.Name}}</text>
}
|Release Date =
{{Game.InfoBox.ReleaseDate|Windows|@Model.ReleasedOn?.ToString("MMMM d, yyyy")}}
|Genres =
@foreach (var genre in Model.Genres)
{
<text>{{Game.InfoBox.Genre|@genre.Name}}</text>
}
@if (pcgwGame != null)
{
<text>|PCGamingWiki = @pcgwGame.ToString().Replace("https://www.pcgamingwiki.com/wiki/", "")</text>
}
}}
{{Game.ActionBox
|Actions =
@foreach (var action in Model.Actions)
{
<text>{{Game.ActionBox.Row|Name = @action.Name|Path = @action.Path|Arguments = @action.Arguments|WorkingDirectory = @action.WorkingDirectory|Primary = @(action.PrimaryAction ? "True" : "False")}}</text>
@Html.Raw('\n')
}
}}
@if (Model.Scripts != null)
{
foreach (var scriptType in scriptTypes)
{
var script = Model.Scripts.FirstOrDefault(s => s.Type == scriptType.Value);
if (script != null)
{
<text>
{{Game.Scripts.@scriptType.Value
|Name = @scriptType.Key
|Description = @script.Description
|RequiresAdmin = @(script.RequiresAdmin ? "True" : "False")
|Contents =
<syntaxhighlight lang="powershell" line>
@Html.Raw(script.Contents)
</syntaxhighlight>
}}
</text>
}
}
}