/// <summary> /// Gets the atex paths for a given item /// </summary> /// <param name="itemModel">The item to get the atex paths for</param> /// <returns>A list of TexTypePath containing the atex info</returns> public List <TexTypePath> GetAtexPaths(IItemModel itemModel) { var atexTexTypePathList = new List <TexTypePath>(); var index = new Index(_gameDirectory); var avfx = new Avfx(_gameDirectory, _dataFile); var itemType = ItemType.GetItemType(itemModel); var vfxPath = GetVfxPath(itemModel, itemType); var vfxOffset = index.GetDataOffset(HashGenerator.GetHash(vfxPath.Folder), HashGenerator.GetHash(vfxPath.File), _dataFile); if (vfxOffset == 0) { throw new Exception($"Could not find offset for vfx path {vfxPath.Folder}/{vfxPath.File}"); } var aTexPaths = avfx.GetATexPaths(vfxOffset); foreach (var atexPath in aTexPaths) { var ttp = new TexTypePath { DataFile = _dataFile, Name = Path.GetFileNameWithoutExtension(atexPath), Path = atexPath }; atexTexTypePathList.Add(ttp); } return(atexTexTypePathList); }
/// <summary> /// Gets the atex paths for a given item /// </summary> /// <param name="itemModel">The item to get the atex paths for</param> /// <returns>A list of TexTypePath containing the atex info</returns> public async Task <List <TexTypePath> > GetAtexPaths(IItemModel itemModel) { var atexTexTypePathList = new List <TexTypePath>(); var index = new Index(_gameDirectory); var avfx = new Avfx(_gameDirectory, _dataFile); var itemType = ItemType.GetPrimaryItemType(itemModel); var vfxPath = await GetVfxPath(itemModel, itemType); var vfxOffset = await index.GetDataOffset(HashGenerator.GetHash(vfxPath.Folder), HashGenerator.GetHash(vfxPath.File), _dataFile); if (vfxOffset == 0) { throw new Exception($"Could not find offset for vfx path {vfxPath.Folder}/{vfxPath.File}"); } var aTexPaths = new List <string>(); try { aTexPaths = await avfx.GetATexPaths(vfxOffset); } catch (Exception e) { throw new Exception(e.Message); } foreach (var atexPath in aTexPaths) { var ttp = new TexTypePath { DataFile = _dataFile, Name = "VFX: " + Path.GetFileNameWithoutExtension(atexPath), Path = atexPath }; atexTexTypePathList.Add(ttp); } return(atexTexTypePathList); }
public async Task <List <TexTypePath> > GetAtexPaths(string vfxPath) { var index = new Index(_gameDirectory); var avfx = new Avfx(_gameDirectory, _dataFile); var folder = vfxPath.Substring(0, vfxPath.LastIndexOf("/")); var file = Path.GetFileName(vfxPath); var vfxOffset = await index.GetDataOffset(HashGenerator.GetHash(folder), HashGenerator.GetHash(file), _dataFile); var atexTexTypePathList = new List <TexTypePath>(); if (vfxOffset <= 0) { return(new List <TexTypePath>()); } var aTexPaths = new List <string>(); try { aTexPaths = await avfx.GetATexPaths(vfxOffset); } catch (Exception e) { throw new Exception(e.Message); } foreach (var atexPath in aTexPaths) { var ttp = new TexTypePath { DataFile = _dataFile, Name = "VFX: " + Path.GetFileNameWithoutExtension(atexPath), Path = atexPath }; atexTexTypePathList.Add(ttp); } return(atexTexTypePathList); }