Skip to content

Commit 7103b66

Browse files
committed
Web: Force analyze metadata
This used to work (around or when aeb4966 was in the works), no idea what happened...
1 parent 369e1d2 commit 7103b66

3 files changed

Lines changed: 8 additions & 21 deletions

File tree

OTRMod.Web/Pages/ArchiveBrowser.razor

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -413,25 +413,12 @@ else
413413

414414
private string GetEntryIcon(ArchiveEntry entry)
415415
{
416-
// Use cached resource info if available, otherwise use path-based detection
417-
if (entry.ResourceInfo != null)
418-
return entry.ResourceInfo.IconClass;
419-
420-
if (entry.IsTextResource)
421-
return "fa-file-lines text-info";
422-
423-
// Heuristic based on path
424-
var path = entry.Path.ToLowerInvariant();
425-
if (path.Contains("tex") || path.EndsWith(".png") || path.EndsWith(".jpg"))
426-
return "fa-image text-success";
427-
if (path.Contains("anim"))
428-
return "fa-person-running text-primary";
429-
if (path.Contains("audio") || path.Contains("sound") || path.Contains("music"))
430-
return "fa-music text-warning";
431-
if (path.Contains("skel"))
432-
return "fa-bone text-secondary";
433-
434-
return "fa-file";
416+
// Use cached resource info if available, otherwise analyze metadata
417+
if (entry.ResourceInfo == null)
418+
{
419+
entry.ResourceInfo = ArchiveExplorer.AnalyzeMetadata(entry.Path);
420+
}
421+
return entry.ResourceInfo?.IconClass ?? "fa-file";
435422
}
436423

437424
private void OpenInTextEditor(ArchiveEntry entry)

OTRMod.Web/Services/Archive/ArchiveEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public sealed record ArchiveEntry(
2222
long Size,
2323
bool IsDirectory) {
2424
/// <summary>Resource info (populated after analysis).</summary>
25-
public ResourceInfo? ResourceInfo { get; init; }
25+
public ResourceInfo? ResourceInfo { get; set; }
2626

2727
/// <summary>Checks if this is a text resource.</summary>
2828
public bool IsTextResource => ResourceInfo?.Type == ResourceType.Text;

OTRMod.Web/Services/Archive/ResourceInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public sealed record ResourceInfo(
4646
/// <summary>Gets a Font Awesome icon class for the resource type.</summary>
4747
public string IconClass => Type switch {
4848
ResourceType.Texture or ResourceType.Background => "fa-image",
49-
ResourceType.Text => "fa-file-lines",
49+
ResourceType.Text => "fa-file-text",
5050
ResourceType.Animation or ResourceType.PlayerAnimation => "fa-person-running",
5151
ResourceType.Audio or ResourceType.AudioSample or ResourceType.AudioSoundFont or ResourceType.AudioSequence => "fa-music",
5252
ResourceType.Skeleton or ResourceType.SkeletonLimb => "fa-bone",

0 commit comments

Comments
 (0)