diff --git a/ProjectLighthouse.Servers.GameServer/Helpers/GameResourceHelper.cs b/ProjectLighthouse.Servers.GameServer/Helpers/GameResourceHelper.cs index ede5977b..3932724e 100644 --- a/ProjectLighthouse.Servers.GameServer/Helpers/GameResourceHelper.cs +++ b/ProjectLighthouse.Servers.GameServer/Helpers/GameResourceHelper.cs @@ -1,5 +1,4 @@ -using System.Collections.Immutable; -using LBPUnion.ProjectLighthouse.Files; +using LBPUnion.ProjectLighthouse.Files; using LBPUnion.ProjectLighthouse.Logging; using LBPUnion.ProjectLighthouse.Types.Logging; using LBPUnion.ProjectLighthouse.Types.Resources; @@ -8,11 +7,10 @@ namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Helpers; public static class GameResourceHelper { - private static readonly ImmutableList textureGuids = ImmutableList.Empty; + private static readonly HashSet textureGuids = new(); static GameResourceHelper() { - List guids = new(); using Stream? guidStream = typeof(GameResourceHelper).Assembly.GetManifestResourceStream("LBPUnion.ProjectLighthouse.Servers.GameServer.textureGuids.txt"); if (guidStream == null) { @@ -26,21 +24,17 @@ public static class GameResourceHelper string? guid = reader.ReadLine(); if (guid == null) continue; - guids.Add(guid); + textureGuids.Add(guid); } - textureGuids = ImmutableList.Create(guids.ToArray()); } public static bool IsValidTexture(string resource) { if (!FileHelper.IsResourceValid(resource)) return false; - if (resource.StartsWith("g")) - { - return textureGuids.Contains(resource[1..]); - } + if (resource.StartsWith("g")) return textureGuids.Contains(resource[1..]); - return LbpFile.FromHash(resource)?.FileType is LbpFileType.Png or LbpFileType.Jpeg or LbpFileType.Plan - or LbpFileType.Painting or LbpFileType.Texture; + return LbpFile.FromHash(resource)?.FileType is LbpFileType.Png or LbpFileType.Jpeg or LbpFileType.Painting + or LbpFileType.Texture; } } \ No newline at end of file