Beispiel #1
0
            public static int Open(string fileName)
            {
                int ret    = -1;
                int result = -1;

                if (ShadowFlare.ArchiveOpen(fileName, 0, 0, ref result))
                {
                    ret = result;
                }

                return(ret);
            }
Beispiel #2
0
            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);
            }
Beispiel #3
0
            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);
            }
Beispiel #4
0
 public static bool AddFile(string source, string dest, int hMPQ)
 {
     return(ShadowFlare.AddFile(hMPQ, source, dest, ArchiveFlag.MAFA_REPLACE_EXISTING + ArchiveFlag.MAFA_COMPRESS));
 }
Beispiel #5
0
 public static int OpenForUdate(string fileName)
 {
     return(ShadowFlare.OpenArchiveForUpdate(fileName, 0x20, 8192));
 }
Beispiel #6
0
 public static void Close(int hMPQ)
 {
     ShadowFlare.ArchiveClose(hMPQ);
 }