diff --git a/src/StormLibSharp/MpqArchive.cs b/src/StormLibSharp/MpqArchive.cs
index 4585dc5..038985d 100644
--- a/src/StormLibSharp/MpqArchive.cs
+++ b/src/StormLibSharp/MpqArchive.cs
@@ -159,6 +159,14 @@ public void AddFileFromDisk(string filePath, string archiveName)
throw new Win32Exception();
}
+ public void AddFileFromDiskWithCompression(string filePath, string archiveName, MpqCompressionTypeFlags compressionFlags)
+ {
+ VerifyHandle();
+
+ if(!NativeMethods.SFileAddFileEx(_handle, filePath, archiveName, (uint)SFileAddFileFlags.MPQ_FILE_COMPRESS, (uint)compressionFlags, (uint)compressionFlags))
+ throw new Win32Exception();
+ }
+
public void Compact(string listfile)
{
VerifyHandle();
diff --git a/src/StormLibSharp/Native/MPQCompressionTypeFlags.cs b/src/StormLibSharp/Native/MPQCompressionTypeFlags.cs
new file mode 100644
index 0000000..4381f18
--- /dev/null
+++ b/src/StormLibSharp/Native/MPQCompressionTypeFlags.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace StormLibSharp
+{
+ ///
+ /// Compression types for multiple compressions
+ ///
+ [Flags]
+ public enum MpqCompressionTypeFlags : uint
+ {
+ ///
+ /// Huffmann compression (used on WAVE files only)
+ ///
+ MPQ_COMPRESSION_HUFFMANN = 0x01,
+
+ ///
+ /// ZLIB compression
+ ///
+ MPQ_COMPRESSION_ZLIB = 0x02,
+
+ ///
+ /// PKWARE DCL compression
+ ///
+ MPQ_COMPRESSION_PKWARE = 0x08,
+
+ ///
+ /// BZIP2 compression (added in Warcraft III)
+ ///
+ MPQ_COMPRESSION_BZIP2 = 0x10,
+
+ ///
+ /// Sparse compression (added in Starcraft 2)
+ ///
+ MPQ_COMPRESSION_SPARSE = 0x20,
+
+ ///
+ /// IMA ADPCM compression (mono)
+ ///
+ MPQ_COMPRESSION_ADPCM_MONO = 0x40,
+
+ ///
+ /// IMA ADPCM compression (stereo)
+ ///
+ MPQ_COMPRESSION_ADPCM_STEREO = 0x80,
+
+ ///
+ /// LZMA compression. Added in Starcraft 2. This value is NOT a combination of flags.
+ ///
+ MPQ_COMPRESSION_LZMA = 0x12,
+
+ ///
+ /// Same compression
+ ///
+ MPQ_COMPRESSION_NEXT_SAME = 0xFFFFFFFF
+ }
+}
diff --git a/src/StormLibSharp/Native/SFileAddFileFlags.cs b/src/StormLibSharp/Native/SFileAddFileFlags.cs
new file mode 100644
index 0000000..7457666
--- /dev/null
+++ b/src/StormLibSharp/Native/SFileAddFileFlags.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace StormLibSharp.Native
+{
+ ///
+ /// Flags enumeration for SFileAddFile and SFileAddFileEx.
+ ///
+ [Flags]
+ internal enum SFileAddFileFlags : uint
+ {
+ ///
+ /// Implode method (By PKWARE Data Compression Library)
+ ///
+ MPQ_FILE_IMPLODE = 0x00000100,
+
+ ///
+ /// Compress methods (By multiple methods)
+ ///
+ MPQ_FILE_COMPRESS = 0x00000200,
+
+ ///
+ /// Indicates whether file is encrypted
+ ///
+ MPQ_FILE_ENCRYPTED = 0x00010000,
+
+ ///
+ /// File decryption key has to be fixed
+ ///
+ MPQ_FILE_FIX_KEY = 0x00020000,
+
+ ///
+ /// The file is a patch file. Raw file data begin with TPatchInfo structure
+ ///
+ MPQ_FILE_PATCH_FILE = 0x00100000,
+
+ ///
+ /// File is stored as a single unit, rather than split into sectors (Thx, Quantam)
+ ///
+ MPQ_FILE_SINGLE_UNIT = 0x01000000,
+
+ ///
+ /// File is a deletion marker. Used in MPQ patches, indicating that the file no longer exists.
+ ///
+ MPQ_FILE_DELETE_MARKER = 0x02000000,
+
+ ///
+ /// File has checksums for each sector.
+ ///
+ MPQ_FILE_SECTOR_CRC = 0x04000000
+ }
+}
diff --git a/src/StormLibSharp/StormLibSharp.csproj b/src/StormLibSharp/StormLibSharp.csproj
index 942e926..61e9e9c 100644
--- a/src/StormLibSharp/StormLibSharp.csproj
+++ b/src/StormLibSharp/StormLibSharp.csproj
@@ -46,8 +46,10 @@
+
+