Load/cache icon directly out of archive, don't rely on embedded manifest
This commit is contained in:
parent
1675d38f88
commit
89633c1096
9 changed files with 1145 additions and 3 deletions
|
@ -357,6 +357,7 @@ namespace LANCommander.Controllers
|
|||
game.Title = viewModel.Game.Title;
|
||||
game.SortTitle = viewModel.Game.SortTitle;
|
||||
game.DirectoryName = viewModel.Game.DirectoryName;
|
||||
game.Icon = viewModel.Game.Icon;
|
||||
game.Description = viewModel.Game.Description;
|
||||
game.ReleasedOn = viewModel.Game.ReleasedOn;
|
||||
game.Singleplayer = viewModel.Game.Singleplayer;
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace LANCommander.Data.Models
|
|||
public string Title { get; set; }
|
||||
[Display(Name = "Sort Title")]
|
||||
public string? SortTitle { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
[Display(Name = "Directory Name")]
|
||||
public string? DirectoryName { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
|
1099
LANCommander/Migrations/20230116051528_AddIconField.Designer.cs
generated
Normal file
1099
LANCommander/Migrations/20230116051528_AddIconField.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
25
LANCommander/Migrations/20230116051528_AddIconField.cs
Normal file
25
LANCommander/Migrations/20230116051528_AddIconField.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LANCommander.Migrations
|
||||
{
|
||||
public partial class AddIconField : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Icon",
|
||||
table: "Games",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Icon",
|
||||
table: "Games");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -282,6 +282,9 @@ namespace LANCommander.Migrations
|
|||
b.Property<long?>("IGDBId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Icon")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("ReleasedOn")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
|
|
|
@ -121,8 +121,7 @@ namespace LANCommander.Services
|
|||
|
||||
Bitmap bitmap = null;
|
||||
|
||||
var manifest = ArchiveService.ReadManifest(archive.ObjectKey);
|
||||
var iconReference = ArchiveService.ReadFile(archive.ObjectKey, manifest.Icon);
|
||||
var iconReference = ArchiveService.ReadFile(archive.ObjectKey, game.Icon);
|
||||
|
||||
if (IsWinPEFile(iconReference))
|
||||
{
|
||||
|
|
|
@ -41,6 +41,11 @@
|
|||
<input asp-for="Game.SortTitle" class="form-control" />
|
||||
<span asp-validation-for="Game.SortTitle" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label asp-for="Game.Icon" class="control-label"></label>
|
||||
<input asp-for="Game.Icon" class="form-control" />
|
||||
<span asp-validation-for="Game.Icon" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label asp-for="Game.Description" class="control-label"></label>
|
||||
<textarea asp-for="Game.Description" class="form-control" data-bs-toggle="autosize"></textarea>
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
<input asp-for="Game.SortTitle" class="form-control" />
|
||||
<span asp-validation-for="Game.SortTitle" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label asp-for="Game.Icon" class="control-label"></label>
|
||||
<input asp-for="Game.Icon" class="form-control" />
|
||||
<span asp-validation-for="Game.Icon" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label asp-for="Game.Description" class="control-label"></label>
|
||||
<textarea asp-for="Game.Description" class="form-control" data-bs-toggle="autosize"></textarea>
|
||||
|
|
|
@ -63,7 +63,11 @@
|
|||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td><img src="@Url.Action("GetIcon", "Games", new { id = item.Id })" /></td>
|
||||
<td>
|
||||
@if (!String.IsNullOrWhiteSpace(item.Icon)) {
|
||||
<img src="@Url.Action("GetIcon", "Games", new { id = item.Id })" />
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Title)
|
||||
</td>
|
||||
|
|
Loading…
Add table
Reference in a new issue