Skip to content

Commit f714dda

Browse files
committed
Addition of convenience function to get offsets via just path, rather than needing extra data.
1 parent 86a7acc commit f714dda

File tree

1 file changed

+10
-1
lines changed
  • xivModdingFramework/SqPack/FileTypes

1 file changed

+10
-1
lines changed

xivModdingFramework/SqPack/FileTypes/Index.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ public Task<bool> HaveFilesAddedByTexTools(XivDataFile dataFile)
199199
});
200200
}
201201

202+
public async Task<int> GetDataOffset(string fullPath)
203+
{
204+
var dataFile = IOUtil.GetDataFileFromPath(fullPath);
205+
206+
var pathHash = HashGenerator.GetHash(fullPath.Substring(0, fullPath.LastIndexOf("/", StringComparison.Ordinal)));
207+
var fileHash = HashGenerator.GetHash(Path.GetFileName(fullPath));
208+
return await GetDataOffset(pathHash, fileHash, dataFile);
209+
210+
}
202211
/// <summary>
203212
/// Gets the offset for the data in the .dat file
204213
/// </summary>
@@ -915,7 +924,7 @@ public bool DeleteFileDescriptor(string fullPath, XivDataFile dataFile)
915924
/// <param name="dataOffset">Raw DAT file offset to use for the new file.</param>
916925
/// <param name="dataFile">Which data file set to use.</param>
917926
/// <returns></returns>
918-
public bool AddFileDescriptor(string fullPath, int dataOffset, XivDataFile dataFile)
927+
public bool AddFileDescriptor(string fullPath, int dataOffset, XivDataFile dataFile)
919928
{
920929
fullPath = fullPath.Replace("\\", "/");
921930
var pathHash = HashGenerator.GetHash(fullPath.Substring(0, fullPath.LastIndexOf("/", StringComparison.Ordinal)));

0 commit comments

Comments
 (0)