private MpqArchive(string filePath, MpqArchiveVersion version, MpqFileStreamAttributes listfileAttributes, MpqFileStreamAttributes attributesFileAttributes, int maxFileCount) { if (maxFileCount < 0) { throw new ArgumentException("maxFileCount"); } SFileOpenArchiveFlags flags = SFileOpenArchiveFlags.TypeIsFile | SFileOpenArchiveFlags.AccessReadWriteShare; flags |= (SFileOpenArchiveFlags)version; //SFILE_CREATE_MPQ create = new SFILE_CREATE_MPQ() //{ // cbSize = unchecked((uint)Marshal.SizeOf(typeof(SFILE_CREATE_MPQ))), // dwMaxFileCount = unchecked((uint)maxFileCount), // dwMpqVersion = (uint)version, // dwFileFlags1 = (uint)listfileAttributes, // dwFileFlags2 = (uint)attributesFileAttributes, // dwStreamFlags = (uint)flags, //}; //if (!NativeMethods.SFileCreateArchive2(filePath, ref create, out _handle)) // throw new Win32Exception(); if (!NativeMethods.SFileCreateArchive(filePath, (uint)flags, int.MaxValue, out _handle)) { throw new Win32Exception(); } }
private MpqArchive(string filePath, MpqArchiveVersion version, MpqFileStreamAttributes listfileAttributes, MpqFileStreamAttributes attributesFileAttributes, int maxFileCount) { if (maxFileCount < 0) { throw new ArgumentException("maxFileCount"); } SFileOpenArchiveFlags flags = SFileOpenArchiveFlags.TypeIsFile | SFileOpenArchiveFlags.AccessReadWriteShare; flags |= (SFileOpenArchiveFlags)version; if (!NativeMethods.SFileCreateArchive(filePath, (uint)flags, int.MaxValue, out _handle)) { throw new Win32Exception(); } }
#pragma warning disable IDE0060 // Remove unused parameter private MpqArchive(string filePath, MpqArchiveVersion version, MpqFileStreamAttributes listfileAttributes, MpqFileStreamAttributes attributesFileAttributes, int maxFileCount) : this() #pragma warning restore IDE0060 // Remove unused parameter { if (maxFileCount < 0) { throw new ArgumentException(null, nameof(maxFileCount)); } var flags = SFileOpenArchiveFlags.TypeIsFile | SFileOpenArchiveFlags.AccessReadWriteShare; flags |= (SFileOpenArchiveFlags)version; if (!NativeMethods.SFileCreateArchive(filePath, (uint)flags, int.MaxValue, out _handle)) { throw new Win32Exception(); } }
public static MpqArchive CreateNew(string mpqPath, MpqArchiveVersion version, MpqFileStreamAttributes listfileAttributes, MpqFileStreamAttributes attributesFileAttributes, int maxFileCount) { return new MpqArchive(mpqPath, version, listfileAttributes, attributesFileAttributes, maxFileCount); }
private MpqArchive(string filePath, MpqArchiveVersion version, MpqFileStreamAttributes listfileAttributes, MpqFileStreamAttributes attributesFileAttributes, int maxFileCount) { if (maxFileCount < 0) throw new ArgumentException("maxFileCount"); SFileOpenArchiveFlags flags = SFileOpenArchiveFlags.TypeIsFile | SFileOpenArchiveFlags.AccessReadWriteShare; flags |= (SFileOpenArchiveFlags)version; //SFILE_CREATE_MPQ create = new SFILE_CREATE_MPQ() //{ // cbSize = unchecked((uint)Marshal.SizeOf(typeof(SFILE_CREATE_MPQ))), // dwMaxFileCount = unchecked((uint)maxFileCount), // dwMpqVersion = (uint)version, // dwFileFlags1 = (uint)listfileAttributes, // dwFileFlags2 = (uint)attributesFileAttributes, // dwStreamFlags = (uint)flags, //}; //if (!NativeMethods.SFileCreateArchive2(filePath, ref create, out _handle)) // throw new Win32Exception(); if (!NativeMethods.SFileCreateArchive(filePath, (uint)flags, int.MaxValue, out _handle)) throw new Win32Exception(); }
public static MpqArchive CreateNew(string mpqPath, MpqArchiveVersion version, MpqFileStreamAttributes listfileAttributes, MpqFileStreamAttributes attributesFileAttributes, int maxFileCount) { return(new MpqArchive(mpqPath, version, listfileAttributes, attributesFileAttributes, maxFileCount)); }