Add and use MPQ filename constants

This commit is contained in:
Matt Nadareski
2025-11-02 23:21:29 -05:00
parent 22167a9617
commit d3e340ae39
2 changed files with 26 additions and 1 deletions

View File

@@ -79,5 +79,29 @@ namespace SabreTools.Data.Models.MoPaQ
public const uint MPQ_KEY_HASH_TABLE = 0xC3AF3770;
#endregion
#region Special Entry Names
/// <summary>
/// Name of internal listfile
/// </summary>
public const string LISTFILE_NAME = "(listfile)";
/// <summary>
/// Name of internal signature
/// </summary>
public const string SIGNATURE_NAME = "(signature)";
/// <summary>
/// Name of internal attributes file
/// </summary>
public const string ATTRIBUTES_NAME = "(attributes)";
/// <summary>
/// Patch metadata
/// </summary>
public const string PATCH_METADATA_NAME = "(patch_metadata)";
#endregion
}
}

View File

@@ -1,6 +1,7 @@
using System;
using System.IO;
using StormLibSharp;
using static SabreTools.Data.Models.MoPaQ.Constants;
namespace SabreTools.Serialization.Wrappers
{
@@ -24,7 +25,7 @@ namespace SabreTools.Serialization.Wrappers
// Try to open the archive and listfile
var mpqArchive = new MpqArchive(Filename, FileAccess.Read);
string? listfile = null;
MpqFileStream listStream = mpqArchive.OpenFile("(listfile)");
MpqFileStream listStream = mpqArchive.OpenFile(LISTFILE_NAME);
// If we can't read the listfile, we just return
if (!listStream.CanRead)