public static int Open(string fileName) { int ret = -1; int result = -1; if (ShadowFlare.ArchiveOpen(fileName, 0, 0, ref result)) { ret = result; } return(ret); }
public static float Size(string fileName, int hMPQ) { uint fileSize = 0; int hFile = -1; if (ShadowFlare.OpenFile(fileName, ref hFile)) { uint fileSizeHigh = 0; fileSize = ShadowFlare.FileSize(hFile, ref fileSizeHigh); } return(Convert.ToSingle(fileSize) / 1000f); }
public static byte[] Read(string fileName, int hMPQ) { int hFile = -1; if (ShadowFlare.OpenFile(fileName, ref hFile)) { uint fileSizeHigh = 0; uint fileSize = ShadowFlare.FileSize(hFile, ref fileSizeHigh); if ((fileSizeHigh == 0) && (fileSize > 0)) { byte[] result = new byte[fileSize]; uint countRead = 0; ShadowFlare.ReadFile(hFile, result, fileSize, ref countRead, 0); ShadowFlare.CloseFile(hFile); return(result); } } return(null); }
public static bool AddFile(string source, string dest, int hMPQ) { return(ShadowFlare.AddFile(hMPQ, source, dest, ArchiveFlag.MAFA_REPLACE_EXISTING + ArchiveFlag.MAFA_COMPRESS)); }
public static int OpenForUdate(string fileName) { return(ShadowFlare.OpenArchiveForUpdate(fileName, 0x20, 8192)); }
public static void Close(int hMPQ) { ShadowFlare.ArchiveClose(hMPQ); }