MpqLib Question.

Get help with just about anything and everything NOT Warcraft related. Computers, consoles, phones, whatever!
owner123
Super Moderator
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm

MpqLib Question.

Post by owner123 »

I am using MPQLib for a VB.NET application. Its made in C++, but works for any .NET app. ImportFile won't work. Heres some of the code I am using.

Declaring vararchive

Code: Select all

Dim vararchive As New MpqLib.Mpq.CArchive("MY FOLDER\MY ARCHIVE")

Then I can use this to extract a file.

Code: Select all

vararchive.ExportFile(NAME OF FILE IN ARCHIVE", "MY FOLDER\MY DOCUMENT")


This works very well untill I get into the re-importing. I didn't know how to do this, so I opened it in the object browser and found this.
Spoiler:

Code: Select all

Public Sub ImportFile(ByVal FileName As String, ByVal FileData As Byte( ))
    Member of MpqLib.Mpq.CArchive

Summary:
Imports a file to the archive.

[size=150]Thanks to help from fatherspace on chat, I no longer need help on this.[/size]


Parameters:
FileName: The filename to save as in the archive
FileData: The file to import, stored in a buffer


So I think that it should be able to be used like this.

Code: Select all

vararchive.ImportFile("NAME OF IMPORT INTO ARCHIVE", "NAME OF FILE TO BE IMPORTED")


but when it gets to this point I get error

Code: Select all

Unable to import

Code: Select all

IOException was unhandled.

Please tell me what i'm doing wrong!


EXTRA- the mpq lib website
http://home.magosx.com/index.php?topic=77.0

Thanks to fatherspace helping on chat, I no longer need help.