This commit is contained in:
Ottermandias 2023-03-10 18:29:58 +01:00
parent 3c564add0e
commit 73e2793da6
48 changed files with 4231 additions and 456 deletions

View file

@ -8,8 +8,9 @@ using Penumbra.GameData.Structs;
namespace Penumbra.GameData.Data;
internal class GamePathParser : IGamePathParser
{
public class GamePathParser : IGamePathParser
{
/// <summary> Obtain basic information about a file path. </summary>
public GameObjectInfo GetFileInfo(string path)
{
path = path.ToLowerInvariant().Replace('\\', '/');
@ -49,6 +50,8 @@ internal class GamePathParser : IGamePathParser
};
}
/// <summary> Get the key of a VFX symbol. </summary>
/// <returns>The lower-case key or an empty string if no match is found.</returns>
public string VfxToKey(string path)
{
var match = GamePaths.Vfx.Tmb().Match(path);
@ -59,25 +62,7 @@ internal class GamePathParser : IGamePathParser
return match.Success ? match.Groups["key"].Value.ToLowerInvariant() : string.Empty;
}
private const string CharacterFolder = "chara";
private const string EquipmentFolder = "equipment";
private const string PlayerFolder = "human";
private const string WeaponFolder = "weapon";
private const string AccessoryFolder = "accessory";
private const string DemiHumanFolder = "demihuman";
private const string MonsterFolder = "monster";
private const string CommonFolder = "common";
private const string UiFolder = "ui";
private const string IconFolder = "icon";
private const string LoadingFolder = "loadingimage";
private const string MapFolder = "map";
private const string InterfaceFolder = "uld";
private const string FontFolder = "font";
private const string HousingFolder = "hou";
private const string VfxFolder = "vfx";
private const string WorldFolder1 = "bgcommon";
private const string WorldFolder2 = "bg";
/// <summary> Obtain the ObjectType from a given path.</summary>
public ObjectType PathToObjectType(string path)
{
if (path.Length == 0)
@ -125,6 +110,25 @@ internal class GamePathParser : IGamePathParser
};
}
private const string CharacterFolder = "chara";
private const string EquipmentFolder = "equipment";
private const string PlayerFolder = "human";
private const string WeaponFolder = "weapon";
private const string AccessoryFolder = "accessory";
private const string DemiHumanFolder = "demihuman";
private const string MonsterFolder = "monster";
private const string CommonFolder = "common";
private const string UiFolder = "ui";
private const string IconFolder = "icon";
private const string LoadingFolder = "loadingimage";
private const string MapFolder = "map";
private const string InterfaceFolder = "uld";
private const string FontFolder = "font";
private const string HousingFolder = "hou";
private const string VfxFolder = "vfx";
private const string WorldFolder1 = "bgcommon";
private const string WorldFolder2 = "bg";
private (FileType, ObjectType, Match?) ParseGamePath(string path)
{
if (!Names.ExtensionToFileType.TryGetValue(Path.GetExtension(path), out var fileType))