addArrayToFileList |
( BOOL ) addArrayToFileList:
(NSArray *) pListFile;
Each MPQArchive instance has a list of the paths of the files inside its associated
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
This method attemps to add each entry of the provided array to the instance's internal list
of files. MPQArchive will make sure each entry actually exists inside the archive
before adding it to the list.
addArrayToFileList: |
( BOOL ) addArrayToFileList:
(NSArray *) pListFile;
Each MPQArchive instance has a list of the paths of the files inside its associated
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
This method attemps to add each entry of the provided array to the instance's internal list
of files. MPQArchive will make sure each entry actually exists inside the archive
before adding it to the list.
- pListFile
- A NSArray containing MPQ file paths. Note that the path separator MUST BE \, and not /.
addFileWithData |
( BOOL ) addFileWithData:
(NSData *) lpbySourceBuffer name :
(NSString *) lpszDestFile attributes :
(NSDictionary *) attributesDict;
This method adds the given data to the MPQ archive as lpszDestFile. Note that
the archive itself is not modified until writeToSave:atomically: is invoked. As such, the
data will be retained until the archive has been saved.
The attribute dictionary is used to override the default import options. It may be nil, or
have the following keys:
MPQAddFlags: The file's flags. Default flags are MPQReplaceExisting and MPQCompress.
Note that MPQFileValid is automatically added to the flags, so you do not need
to specify it here. In order to compress the file, OR the value MPQCompress or
MPQCompressDiablo (not recommended) to the file flags. See the MPQFileFlag enum in
the MPQSharedConstants.h header for other flag values.
MPQAddQuality: If either compression flag is set, this is the compression quality that
will be used. Default is Z_DEFAULT_COMPRESSION for zlib compression and MPQWavQualityNone
for DCL/WAV compression. This flag is ignored for Diablo compression. If this flag is not
MPQWavQualityNone and DCL compression is used, then the file that is going to be added MUST
BE A WAV FILE.
MPQAddLocale: The file's locale. Default value is MPQNeutral. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQAddCompressior: The compressor that is going to be used for that particular file.
If this flag is not specified, the default compressor is used.
addFileWithData:name:attributes: |
( BOOL ) addFileWithData:
(NSData *) lpbySourceBuffer name :
(NSString *) lpszDestFile attributes :
(NSDictionary *) attributesDict;
This method adds the given data to the MPQ archive as lpszDestFile. Note that
the archive itself is not modified until writeToSave:atomically: is invoked. As such, the
data will be retained until the archive has been saved.
The attribute dictionary is used to override the default import options. It may be nil, or
have the following keys:
MPQAddFlags: The file's flags. Default flags are MPQReplaceExisting and MPQCompress.
Note that MPQFileValid is automatically added to the flags, so you do not need
to specify it here. In order to compress the file, OR the value MPQCompress or
MPQCompressDiablo (not recommended) to the file flags. See the MPQFileFlag enum in
the MPQSharedConstants.h header for other flag values.
MPQAddQuality: If either compression flag is set, this is the compression quality that
will be used. Default is Z_DEFAULT_COMPRESSION for zlib compression and MPQWavQualityNone
for DCL/WAV compression. This flag is ignored for Diablo compression. If this flag is not
MPQWavQualityNone and DCL compression is used, then the file that is going to be added MUST
BE A WAV FILE.
MPQAddLocale: The file's locale. Default value is MPQNeutral. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQAddCompressior: The compressor that is going to be used for that particular file.
If this flag is not specified, the default compressor is used.
- lpbySourceBuffer
- The data to be added to the archive. Must not be nil.
- lpszDestFile
- The MPQ file path. Note that the path separator MUST be \. Must not be nil.
- attributesDict
- A NSDictionary containing file addition parameters. Can be nil.
addFileWithPath |
( BOOL ) addFileWithPath:
(NSString *) path name :
(NSString *) lpszDestFile attributes :
(NSDictionary *) attributesDict;
This method adds the file at path to the MPQ archive as lpszDestFile. Note that
the archive itself is not modified until writeToSave:atomically: is invoked. Note that this
method simply calls addFileWithData:name:attributes:.
The attribute dictionary is used to override the default import options. It may be nil, or
have the following keys:
MPQAddFlags: The file's flags. Default flags are MPQReplaceExisting and MPQCompress.
Note that MPQFileValid is automatically added to the flags, so you do not need
to specify it here. In order to compress the file, OR the value MPQCompress or
MPQCompressDiablo (not recommended) to the file flags. See the MPQFileFlag enum in
the MPQSharedConstants.h header for other flag values.
MPQAddQuality: If either compression flag is set, this is the compression quality that
will be used. Default is Z_DEFAULT_COMPRESSION for zlib compression and MPQWavQualityNone
for DCL/WAV compression. This flag is ignored for Diablo compression. If this flag is not
MPQWavQualityNone and DCL compression is used, then the file that is going to be added MUST
BE A WAV FILE.
MPQAddLocale: The file's locale. Default value is MPQNeutral. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQAddCompressior: The compressor that is going to be used for that particular file.
If this flag is not specified, the default compressor is used.
addFileWithPath:name:attributes: |
( BOOL ) addFileWithPath:
(NSString *) path name :
(NSString *) lpszDestFile attributes :
(NSDictionary *) attributesDict;
This method adds the file at path to the MPQ archive as lpszDestFile. Note that
the archive itself is not modified until writeToSave:atomically: is invoked. Note that this
method simply calls addFileWithData:name:attributes:.
The attribute dictionary is used to override the default import options. It may be nil, or
have the following keys:
MPQAddFlags: The file's flags. Default flags are MPQReplaceExisting and MPQCompress.
Note that MPQFileValid is automatically added to the flags, so you do not need
to specify it here. In order to compress the file, OR the value MPQCompress or
MPQCompressDiablo (not recommended) to the file flags. See the MPQFileFlag enum in
the MPQSharedConstants.h header for other flag values.
MPQAddQuality: If either compression flag is set, this is the compression quality that
will be used. Default is Z_DEFAULT_COMPRESSION for zlib compression and MPQWavQualityNone
for DCL/WAV compression. This flag is ignored for Diablo compression. If this flag is not
MPQWavQualityNone and DCL compression is used, then the file that is going to be added MUST
BE A WAV FILE.
MPQAddLocale: The file's locale. Default value is MPQNeutral. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQAddCompressior: The compressor that is going to be used for that particular file.
If this flag is not specified, the default compressor is used.
- path
- The absolute path of the file on disk. Must not be nil.
- lpszDestFile
- The MPQ file path. Note that the path separator MUST be \. Must not be nil.
- attributesDict
- A NSDictionary containing file addition parameters. Can be nil.
addListfileToFileList |
( BOOL ) addListfileToFileList:
(NSString *) listfile;
Each MPQArchive instance has a list of the paths of the files inside its associated
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
This method attemps to add each entry of the provided listfile to the instance's internal list
of files. MPQArchive will make sure each entry actually exists inside the archive
before adding it to the list.
addListfileToFileList: |
( BOOL ) addListfileToFileList:
(NSString *) listfile;
Each MPQArchive instance has a list of the paths of the files inside its associated
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
This method attemps to add each entry of the provided listfile to the instance's internal list
of files. MPQArchive will make sure each entry actually exists inside the archive
before adding it to the list.
- listfile
- A string containing the content of the listfile in the NSASCIIStringEncoding encoding. Note that the path separator MUST BE \, and not /, and that the line breaks MUST BE \r\n and not \n or \r.
archiveInfo |
( NSDictionary *) archiveInfo;
Archive information dictionaries will always contain the following keys:
MPQArchiveLength: The size of the archive on the disk in bytes as an integer.
MPQBlockSize: The size of file data blocks where the actual size in bytes
of blocks is 512 << MPQBlockSize as an integer.
MPQNumberOfFiles: The number of used and deleted files in the archive as an integer.
MPQMaximumNumberOfFiles: The maximum number of files the archive may contain as an integer.
MPQNumberOfUsedFiles: The number of used files in the archive as an integer.
MPQArchiveOffset: MPQ archives may be embedded in other files with a 512 bytes padding.
This is the offset of the MPQ archive within its container file in bytes as an integer.
MPQArchivePath: The path of the MPQ archive's container file. May be nil if the archive
was initialized without a file path and was not saved yet.
archiveWithFileLimit |
( id ) archiveWithFileLimit:
(unsigned ) limit header :
(NSData *) headerData;
This is the recommended way of loading an existing archive from disk. Depending on where it is stored and what permissions the archive file has, you may or may not be able to modify the archive.
archiveWithFileLimit:header: |
( id ) archiveWithFileLimit:
(unsigned ) limit header :
(NSData *) headerData;
This is the recommended way of loading an existing archive from disk. Depending on where it is stored and what permissions the archive file has, you may or may not be able to modify the archive.
- limit
- An integer indicating the maximum number of files the new archive may contain. Minimum value is 16, maximum value is 0x80000. If you pass 0, MPQArchive will set this parameter to the default value of 1024. The file limit must be a power of 2 and will automatically be rounded off to one, so you may safely pass any integer.
- headerData
- An NSData instance containing bytes that will be saved before the archive at save time. Note that MPQ archives must be embedded at 512 bytes offsets, so the data that you pass will be padded to the nearest multiple of 512. Header data cannot be changed beyond initialization because of offset-adjusted files.
archiveWithPath |
( id ) archiveWithPath:
(NSString *) mpqPath;
Creates and returns an MPQArchive instance initialized with the archive at the specified path.
archiveWithPath: |
( id ) archiveWithPath:
(NSString *) mpqPath;
Creates and returns an MPQArchive instance initialized with the archive at the specified path.
- mpqPath
- The POSIX path to the archive. Must be a fully expanded path. Must not be nil.
compressor |
( MPQCompressionType ) compressor;
The default compressor is zlib.
dataForFile |
( NSData *) dataForFile:
(NSString *) lpszFileName;
Note that this method simply calls dataForFile:range:locale: with {0,0} as the range
and MPQNeutral as the locale.
If you intend on streaming a file, you should not use the dataForFile methods, but rather
use the openFile methods to get a MPQFile object for the desired file.
dataForFile |
( NSData *) dataForFile:
(NSString *) lpszFileName range :
(NSRange ) dataRange;
Note that this method simply calls dataForFile:range:locale: with MPQNeutral as the locale.
If you intend on streaming a file, you should not use the dataForFile methods, but rather
use the openFile methods to get a MPQFile object for the desired file.
dataForFile |
( NSData *) dataForFile:
(NSString *) lpszFileName locale :
(MPQLocale ) wLocale;
Note that this method simply calls dataForFile:range:locale: with {0,0} as the range.
If you intend on streaming a file, you should not use the dataForFile methods, but rather
use the openFile methods to get a MPQFile object for the desired file.
dataForFile |
( NSData *) dataForFile:
(NSString *) lpszFileName range :
(NSRange ) dataRange locale :
(MPQLocale ) wLocale;
If you intend on streaming a file, you should not use the dataForFile methods, but rather use the openFile methods to get a MPQFile object for the desired file.
dataForFile: |
( NSData *) dataForFile:
(NSString *) lpszFileName;
Note that this method simply calls dataForFile:range:locale: with {0,0} as the range
and MPQNeutral as the locale.
If you intend on streaming a file, you should not use the dataForFile methods, but rather
use the openFile methods to get a MPQFile object for the desired file.
- lpszFileName
- The path of the MPQ file to read from. Note that the path separator MUST be \. Must not be nil.
dataForFile:locale: |
( NSData *) dataForFile:
(NSString *) lpszFileName locale :
(MPQLocale ) wLocale;
Note that this method simply calls dataForFile:range:locale: with {0,0} as the range.
If you intend on streaming a file, you should not use the dataForFile methods, but rather
use the openFile methods to get a MPQFile object for the desired file.
- lpszFileName
- The path of the MPQ file to read from. Note that the path separator MUST be \. Must not be nil.
- wLocale
- The file's locale code. See the MPQLocale enum in MPQSharedConstants.h for a list of valid values.
dataForFile:range: |
( NSData *) dataForFile:
(NSString *) lpszFileName range :
(NSRange ) dataRange;
Note that this method simply calls dataForFile:range:locale: with MPQNeutral as the locale.
If you intend on streaming a file, you should not use the dataForFile methods, but rather
use the openFile methods to get a MPQFile object for the desired file.
- lpszFileName
- The path of the MPQ file to read from. Note that the path separator MUST be \. Must not be nil.
- dataRange
- An NSRange struct specifying the range of bytes to read. Note that specifying 0 as the length will return all the data from the starting offset up until the end of file.
dataForFile:range:locale: |
( NSData *) dataForFile:
(NSString *) lpszFileName range :
(NSRange ) dataRange locale :
(MPQLocale ) wLocale;
If you intend on streaming a file, you should not use the dataForFile methods, but rather use the openFile methods to get a MPQFile object for the desired file.
- lpszFileName
- The path of the MPQ file to read from. Note that the path separator MUST be \. Must not be nil.
- dataRange
- An NSRange struct specifying the range of bytes to read. Note that specifying 0 as the length will return all the data from the starting offset up until the end of file.
- wLocale
- The file's locale code. See the MPQLocale enum in MPQSharedConstants.h for a list of valid values.
delegate |
( id ) delegate;
MPQArchive principally notifies its delegate about operations that are about to be performed or that finished performing, and also to control operations (allow or disallow).
deleteFile |
( BOOL ) deleteFile:
(NSString *) lpszFileName;
Note that when deleting files from MPQ archives, the file is simply marked
as deleted. The data itself isn't removed from the archive file. That is to say, deleting
a file will not decrease the size of the archive. In order to delete unused file data from
an MPQ archive, use the compact method.
WARNING: COMPACTION IS CURRENTLY NOT IMPLEMENTED.
Note that this method simply calls deleteFile:locale: with MPQNeutral as the locale.
deleteFile |
( BOOL ) deleteFile:
(NSString *) lpszFileName locale :
(MPQLocale ) wLocale;
Note that when deleting files from MPQ archives, the file is simply marked
as deleted. The data itself isn't removed from the archive file. That is to say, deleting
a file will not decrease the size of the archive. In order to delete unused file data from
an MPQ archive, use the compact method.
WARNING: COMPACTION IS CURRENTLY NOT IMPLEMENTED.
deleteFile: |
( BOOL ) deleteFile:
(NSString *) lpszFileName;
Note that when deleting files from MPQ archives, the file is simply marked
as deleted. The data itself isn't removed from the archive file. That is to say, deleting
a file will not decrease the size of the archive. In order to delete unused file data from
an MPQ archive, use the compact method.
WARNING: COMPACTION IS CURRENTLY NOT IMPLEMENTED.
Note that this method simply calls deleteFile:locale: with MPQNeutral as the locale.
- lpszFileName
- The path of the MPQ file to delete. Note that the path separator MUST be \. Must not be nil.
deleteFile:locale: |
( BOOL ) deleteFile:
(NSString *) lpszFileName locale :
(MPQLocale ) wLocale;
Note that when deleting files from MPQ archives, the file is simply marked
as deleted. The data itself isn't removed from the archive file. That is to say, deleting
a file will not decrease the size of the archive. In order to delete unused file data from
an MPQ archive, use the compact method.
WARNING: COMPACTION IS CURRENTLY NOT IMPLEMENTED.
- lpszFileName
- The path of the MPQ file to delete. Note that the path separator MUST be \. Must not be nil.
- wLocale
- The file's locale code. See the MPQLocale enum in MPQSharedConstants.h for a list of valid values.
fileCount |
( unsigned long ) fileCount;
You may calculate the number of deleted files by substracting this number with the result of usedFileCount.
fileExists |
( NSArray *) fileExists:
(NSString *) lpszFileName;
Files can have the same path in an MPQ archive so long as their locale is different.
fileExists |
( BOOL ) fileExists:
(NSString *) lpszFileName locale :
(MPQLocale ) wLocale;
A file's path and locale are the two values necessary to uniquely identify a file in an MPQ archive.
fileExists: |
( NSArray *) fileExists:
(NSString *) lpszFileName;
Files can have the same path in an MPQ archive so long as their locale is different.
- lpszFileName
- The path of the MPQ file to search for. Note that the path separator MUST be \. Must not be nil.
fileExists:locale: |
( BOOL ) fileExists:
(NSString *) lpszFileName locale :
(MPQLocale ) wLocale;
A file's path and locale are the two values necessary to uniquely identify a file in an MPQ archive.
- lpszFileName
- The path of the MPQ file to search for. Note that the path separator MUST be \. Must not be nil.
- wLocale
- The file's locale code. See the MPQLocale enum in MPQSharedConstants.h for a list of valid values.
fileInfoEnumerator |
( NSEnumerator *) fileInfoEnumerator;
File information dictionaries will always contain the following keys:
MPQFileLength: The size of the file in bytes as an integer.
MPQFileCompressedLength: The compressed size of the file in bytes as an integer.
MPQFileFlags: The file's flags as an integer. See the MPQFileFlag enum in
MPQSharedConstants.h for a list of valid bit values.
MPQFileLocale: The file's locale code as an integer. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQFileHashA: The file's A hash as an integer. Mostly useless.
MPQFileHashB: The file's B hash as an integer. Mostly useless as well.
MPQFileHashPosition: The file's hash table position. Can be used as a unique key for that
particular file (in fact, a file's path is not a unique key, so this is the only unique key
for MPQ files).
File information dictionaries may also contain the following key:
MPQFileName: The file's path inside the MPQ archive. Note that the path separator is \.
fileInfoForFile |
( NSDictionary *) fileInfoForFile:
(NSString *) lpszFileName locale :
(MPQLocale ) wLocale;
File information dictionaries will always contain the following keys:
MPQFileLength: The size of the file in bytes as an integer.
MPQFileCompressedLength: The compressed size of the file in bytes as an integer.
MPQFileFlags: The file's flags as an integer. See the MPQFileFlag enum in
MPQSharedConstants.h for a list of valid bit values.
MPQFileLocale: The file's locale code as an integer. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQFileHashA: The file's A hash as an integer. Mostly useless.
MPQFileHashB: The file's B hash as an integer. Mostly useless as well.
MPQFileHashPosition: The file's hash table position. Can be used as a unique key for that
particular file (in fact, a file's path is not a unique key, so this is the only unique key
for MPQ files).
File information dictionaries may also contain the following key:
MPQFileName: The file's path inside the MPQ archive. Note that the path separator is \.
fileInfoForFile:locale: |
( NSDictionary *) fileInfoForFile:
(NSString *) lpszFileName locale :
(MPQLocale ) wLocale;
File information dictionaries will always contain the following keys:
MPQFileLength: The size of the file in bytes as an integer.
MPQFileCompressedLength: The compressed size of the file in bytes as an integer.
MPQFileFlags: The file's flags as an integer. See the MPQFileFlag enum in
MPQSharedConstants.h for a list of valid bit values.
MPQFileLocale: The file's locale code as an integer. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQFileHashA: The file's A hash as an integer. Mostly useless.
MPQFileHashB: The file's B hash as an integer. Mostly useless as well.
MPQFileHashPosition: The file's hash table position. Can be used as a unique key for that
particular file (in fact, a file's path is not a unique key, so this is the only unique key
for MPQ files).
File information dictionaries may also contain the following key:
MPQFileName: The file's path inside the MPQ archive. Note that the path separator is \.
- lpszFileName
- The MPQ file path of the file you wish information about. Must not be nil.
- wLocale
- The file's locale code. See the MPQLocale enum in MPQSharedConstants.h for a list of valid values.
fileInfoForFiles |
( NSArray *) fileInfoForFiles:
(NSArray *) fileArray locale :
(MPQLocale ) wLocale;
File information dictionaries will always contain the following keys:
MPQFileLength: The size of the file in bytes as an integer.
MPQFileCompressedLength: The compressed size of the file in bytes as an integer.
MPQFileFlags: The file's flags as an integer. See the MPQFileFlag enum in
MPQSharedConstants.h for a list of valid bit values.
MPQFileLocale: The file's locale code as an integer. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQFileHashA: The file's A hash as an integer. Mostly useless.
MPQFileHashB: The file's B hash as an integer. Mostly useless as well.
MPQFileHashPosition: The file's hash table position. Can be used as a unique key for that
particular file (in fact, a file's path is not a unique key, so this is the only unique key
for MPQ files).
File information dictionaries may also contain the following key:
MPQFileName: The file's path inside the MPQ archive. Note that the path separator is \.
This method simply call fileInfoForFile:locale: for each entry in fileArray and places the result in order
inside an NSArray.
fileInfoForFiles:locale: |
( NSArray *) fileInfoForFiles:
(NSArray *) fileArray locale :
(MPQLocale ) wLocale;
File information dictionaries will always contain the following keys:
MPQFileLength: The size of the file in bytes as an integer.
MPQFileCompressedLength: The compressed size of the file in bytes as an integer.
MPQFileFlags: The file's flags as an integer. See the MPQFileFlag enum in
MPQSharedConstants.h for a list of valid bit values.
MPQFileLocale: The file's locale code as an integer. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQFileHashA: The file's A hash as an integer. Mostly useless.
MPQFileHashB: The file's B hash as an integer. Mostly useless as well.
MPQFileHashPosition: The file's hash table position. Can be used as a unique key for that
particular file (in fact, a file's path is not a unique key, so this is the only unique key
for MPQ files).
File information dictionaries may also contain the following key:
MPQFileName: The file's path inside the MPQ archive. Note that the path separator is \.
This method simply call fileInfoForFile:locale: for each entry in fileArray and places the result in order
inside an NSArray.
- fileArray
- An array of MPQ file paths you wish information about. Must not be nil.
- wLocale
- The locale to be used for every file in fileArray.
fileInfoForPosition |
( NSDictionary *) fileInfoForPosition:
(unsigned ) position;
File information dictionaries will always contain the following keys:
MPQFileLength: The size of the file in bytes as an integer.
MPQFileCompressedLength: The compressed size of the file in bytes as an integer.
MPQFileFlags: The file's flags as an integer. See the MPQFileFlag enum in
MPQSharedConstants.h for a list of valid bit values.
MPQFileLocale: The file's locale code as an integer. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQFileHashA: The file's A hash as an integer. Mostly useless.
MPQFileHashB: The file's B hash as an integer. Mostly useless as well.
MPQFileHashPosition: The file's hash table position. Can be used as a unique key for that
particular file (in fact, a file's path is not a unique key, so this is the only unique key
for MPQ files).
File information dictionaries may also contain the following key:
MPQFileName: The file's path inside the MPQ archive. Note that the path separator is \.
Additionally, file information dictionaries may contain one or more MPQ file attribute keys.
Please refer to the documentation of the header MPQSharedConstants.h for a list of valid keys.
fileInfoForPosition: |
( NSDictionary *) fileInfoForPosition:
(unsigned ) position;
File information dictionaries will always contain the following keys:
MPQFileLength: The size of the file in bytes as an integer.
MPQFileCompressedLength: The compressed size of the file in bytes as an integer.
MPQFileFlags: The file's flags as an integer. See the MPQFileFlag enum in
MPQSharedConstants.h for a list of valid bit values.
MPQFileLocale: The file's locale code as an integer. See the MPQLocale enum in
MPQSharedConstants.h for a list of valid values.
MPQFileHashA: The file's A hash as an integer. Mostly useless.
MPQFileHashB: The file's B hash as an integer. Mostly useless as well.
MPQFileHashPosition: The file's hash table position. Can be used as a unique key for that
particular file (in fact, a file's path is not a unique key, so this is the only unique key
for MPQ files).
File information dictionaries may also contain the following key:
MPQFileName: The file's path inside the MPQ archive. Note that the path separator is \.
Additionally, file information dictionaries may contain one or more MPQ file attribute keys.
Please refer to the documentation of the header MPQSharedConstants.h for a list of valid keys.
- position
- An integer specifying the position of the file you wish information about. Must not be out of bounds.
fileList |
( NSArray *) fileList;
Each MPQArchive instance has a list of the paths of the files inside the
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
fileListWithFilter |
( NSArray *) fileListWithFilter:
(NSString *) filter;
Each MPQArchive instance has a list of the paths of the files inside the
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
WARNING: CURRENTLY NOT IMPLEMENTED. WILL SIMPLY RETURN THE RESULT OF fileList.
fileListWithFilter: |
( NSArray *) fileListWithFilter:
(NSString *) filter;
Each MPQArchive instance has a list of the paths of the files inside the
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
WARNING: CURRENTLY NOT IMPLEMENTED. WILL SIMPLY RETURN THE RESULT OF fileList.
- filter
- The regular expression upon which the known paths will be tested.
fileOpenCount |
( unsigned long ) fileOpenCount:
(unsigned long ) position;
There must be no open files prior to saving the archive.
fileOpenCount: |
( unsigned long ) fileOpenCount:
(unsigned long ) position;
There must be no open files prior to saving the archive.
- position
- The hash table position of the desired file. May be obtained by the information methods of MPQArchive and MPQFile.
header |
( NSData *) header;
MPQ archives can be embedded in other files at 512 bytes padded addresses. This function will return any data that was found before the archive when it was loaded.
initWithFileLimit |
( id ) initWithFileLimit:
(unsigned ) limit header :
(NSData *) headerData;
This is the core way of loading an existing archive from disk. Depending on where it is stored and what permissions the archive file has, you may or may not be able to modify the archive.
initWithFileLimit:header: |
( id ) initWithFileLimit:
(unsigned ) limit header :
(NSData *) headerData;
This is the core way of loading an existing archive from disk. Depending on where it is stored and what permissions the archive file has, you may or may not be able to modify the archive.
- limit
- An integer indicating the maximum number of files the new archive may contain. Minimum value is 16, maximum value is 0x80000. If you pass 0, MPQArchive will set this parameter to the default value of 1024. The file limit must be a power of 2 and will automatically be rounded off to one, so you may safely pass any integer.
- headerData
- An NSData instance containing bytes that will be saved before the archive at save time. Note that MPQ archives must be embedded at 512 bytes offsets, so the data that you pass will be padded to the nearest multiple of 512. Header data cannot be changed beyond initialization because of offset-adjusted files.
initWithPath |
( id ) initWithPath:
(NSString *) mpqPath;
Creates and returns an MPQArchive instance initialized with the archive at the specified path.
initWithPath: |
( id ) initWithPath:
(NSString *) mpqPath;
Creates and returns an MPQArchive instance initialized with the archive at the specified path.
- mpqPath
- The POSIX path to the archive. Must be a fully expanded path. Must not be nil.
loadListfile |
( void ) loadListfile;
Each MPQArchive instance has a list of the paths of the files inside its associated
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
This method attemps to read the archive's (listfile) and add its content to the instance's internal list
of files. MPQArchive will make sure each entry in the listfile actually exists inside the archive
before adding it to the list.
maxFileCount |
( unsigned long ) maxFileCount;
There is no way to augment this limit past the creation of an archive. Ergo if an archive is full, you may have to delete some files or create a bigger archive and copy every file from one to the other, which you may not be able to do if you don't know the file name of every file. This limit is inherent to the MPQ format and not this framework.
modified |
( BOOL ) modified;
This will always return NO if the archive is read-only. When an archive was just opened, this should always return NO.
openFile |
( MPQFile *) openFile:
(NSString *) lpszFileName;
MPQFile objects are useful for streaming a file's data. For one-time data reading,
you may use the dataForFile methods.
Note that this method simply calls openFile:locale: with MPQNeutral as the locale.
openFile |
( MPQFile *) openFile:
(NSString *) lpszFileName locale :
(MPQLocale ) wLocale;
MPQFile objects are useful for streaming a file's data. For one-time data reading, you may use the dataForFile methods.
openFile: |
( MPQFile *) openFile:
(NSString *) lpszFileName;
MPQFile objects are useful for streaming a file's data. For one-time data reading,
you may use the dataForFile methods.
Note that this method simply calls openFile:locale: with MPQNeutral as the locale.
- lpszFileName
- The path of the MPQ file to open. Note that the path separator MUST be \. Must not be nil.
openFile:locale: |
( MPQFile *) openFile:
(NSString *) lpszFileName locale :
(MPQLocale ) wLocale;
MPQFile objects are useful for streaming a file's data. For one-time data reading, you may use the dataForFile methods.
- lpszFileName
- The path of the MPQ file to open. Note that the path separator MUST be \. Must not be nil.
- wLocale
- The old and new file's locale code. See the MPQLocale enum in MPQSharedConstants.h for a list of valid values.
openFiles |
( unsigned long ) openFiles;
There must be no open files prior to saving the archive.
path |
( NSString *) path;
May be nil if the instance was initialized with archiveWithFileLimit: or initWithFileLimit: and the archive was never saved yet.
readOnly |
( BOOL ) readOnly;
This will always return YES for new archives. This may return NO for existing archives depending on what permissions the archive file has and on what type of media it is stored.
renameFile |
( BOOL ) renameFile:
(NSString *) lpszOldFileName as :
(NSString *) lpszNewFileName;
Renaming isn't as simple as it sounds. Indeed, since a file's hash table position
and file key are based on its file name (MPQ file path), renaming involves reading the
file's data, deleting the old file and adding a new one with the file's data under the
new name.
Note that this method simply calls renameFile:as:locale: with MPQNeutral as the locale.
renameFile |
( BOOL ) renameFile:
(NSString *) lpszOldFileName as :
(NSString *) lpszNewFileName locale :
(MPQLocale ) wLocale;
Renaming isn't as simple as it sounds. Indeed, since a file's hash table position and file key are based on its file name (MPQ file path), renaming involves reading the file's data, deleting the old file and adding a new one with the file's data under the new name.
renameFile:as: |
( BOOL ) renameFile:
(NSString *) lpszOldFileName as :
(NSString *) lpszNewFileName;
Renaming isn't as simple as it sounds. Indeed, since a file's hash table position
and file key are based on its file name (MPQ file path), renaming involves reading the
file's data, deleting the old file and adding a new one with the file's data under the
new name.
Note that this method simply calls renameFile:as:locale: with MPQNeutral as the locale.
- lpszOldFileName
- The path of the MPQ file to rename. Note that the path separator MUST be \. Must not be nil.
- lpszNewFileName
- The new path of the MPQ file. Note that the path separator MUST be \. Must not be nil.
renameFile:as:locale: |
( BOOL ) renameFile:
(NSString *) lpszOldFileName as :
(NSString *) lpszNewFileName locale :
(MPQLocale ) wLocale;
Renaming isn't as simple as it sounds. Indeed, since a file's hash table position and file key are based on its file name (MPQ file path), renaming involves reading the file's data, deleting the old file and adding a new one with the file's data under the new name.
- lpszOldFileName
- The path of the MPQ file to rename. Note that the path separator MUST be \. Must not be nil.
- lpszNewFileName
- The new path of the MPQ file. Note that the path separator MUST be \. Must not be nil.
- wLocale
- The old and new file's locale code. See the MPQLocale enum in MPQSharedConstants.h for a list of valid values.
setCompressor |
( BOOL ) setCompressor:
(MPQCompressionType ) compressor;
Generally speaking, DCL is more backward-compatible while zlib offers better speed and compression.
setCompressor: |
( BOOL ) setCompressor:
(MPQCompressionType ) compressor;
Generally speaking, DCL is more backward-compatible while zlib offers better speed and compression.
- compressor
- An MPQCompressionType constant. May only be MPQZLIBCompression, MPQDCLCompression or MPQDiabloCompression.
setDelegate |
( void ) setDelegate:
(id ) anObject;
MPQArchive principally notifies its delegate about operations that are about to be performed or that finished performing, and also to control operations (allow or disallow).
setDelegate: |
( void ) setDelegate:
(id ) anObject;
MPQArchive principally notifies its delegate about operations that are about to be performed or that finished performing, and also to control operations (allow or disallow).
setStoresListfile |
( void ) setStoresListfile:
(BOOL ) bStore;
Each MPQArchive instance has a list of the paths of the files inside its associated
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
It is recommended to save the listfile.
setStoresListfile: |
( void ) setStoresListfile:
(BOOL ) bStore;
Each MPQArchive instance has a list of the paths of the files inside its associated
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
It is recommended to save the listfile.
- bStore
- YES to make the instance save the listfile at save time or NO to prevent it from doing so.
storesListfile |
( BOOL ) storesListfile;
Each MPQArchive instance has a list of the paths of the files inside its associated
MPQ archive. Because MPQs don't inherently store the list of files they contain, MPQ editors have gone
around this by manually managing a file inside MPQ archives called (listfile).
There are several advantages to having the path of a file, such as being able to re-compress it and/or re-encrypt it in
operations such as compaction. Without the path, it would be quasi-impossible to perform those operations.
Note that whenever you try to open a file of the archive, the MPQArchive instance will add the path
you used to open the file to its internal list of files if the file is actually found. You may also
add external listfiles (available from the web) to the instance's internal list of files using
the addListfileToFileList: and addArrayToFileList: methods.
The default behavior is to save the listfile at save time.
usedFileCount |
( unsigned long ) usedFileCount;
This includes every file, even if the file name is not known.
writeToFile |
( BOOL ) writeToFile:
(NSString *) path atomically :
(BOOL ) flag;
Attempts to save the archive at path. If path is the same
as the path that was used to initialize the instance, the archive file is modified directly.
If path is different than the path used to initialize the instance, a new file is created
at path and the archive is saved there (save-as operation). Furthermore, the archive path of
the instance is changed to the new path and the old archive is closed.
If the archive was not initialized with a path, a new file is created at path and the path of the
instance is set to path.
In all cases, setting flag to YES makes the instance close any
currently open archive and create a new temporary archive file which will be
moved to path after saving is done. Note that the temporary file is actually a
copy of the original archive file, so if the archive is embedded in some
other file, all data not belonging to the archive is preserved.
In all cases, if the method returns NO, the instance will be exactly like it was prior to the save
attempt.
writeToFile:atomically: |
( BOOL ) writeToFile:
(NSString *) path atomically :
(BOOL ) flag;
Attempts to save the archive at path. If path is the same
as the path that was used to initialize the instance, the archive file is modified directly.
If path is different than the path used to initialize the instance, a new file is created
at path and the archive is saved there (save-as operation). Furthermore, the archive path of
the instance is changed to the new path and the old archive is closed.
If the archive was not initialized with a path, a new file is created at path and the path of the
instance is set to path.
In all cases, setting flag to YES makes the instance close any
currently open archive and create a new temporary archive file which will be
moved to path after saving is done. Note that the temporary file is actually a
copy of the original archive file, so if the archive is embedded in some
other file, all data not belonging to the archive is preserved.
In all cases, if the method returns NO, the instance will be exactly like it was prior to the save
attempt.
- path
- The location where to save the archive. Must not be nil.
- flag
- If flag is YES, the instance closes any currently open archive and makes a new temporary archive which is used for the save operation and is moved to path after saving is done.
(Last Updated 5/8/2004)