private MpqHash(ulong name, MpqLocale locale, uint blockIndex) : this() { Name = name; Locale = locale; BlockIndex = blockIndex; }
private MpqHash(uint name1, uint name2, MpqLocale locale, uint blockIndex) : this() { Name1 = name1; Name2 = name2; Locale = locale; BlockIndex = blockIndex; }
internal MpqFile(ulong?hashedName, MpqStream mpqStream, MpqFileFlags flags, MpqLocale locale, bool leaveOpen) { _name = hashedName; _mpqStream = mpqStream ?? throw new ArgumentNullException(nameof(mpqStream)); _isStreamOwner = !leaveOpen; _flags = flags; _locale = locale; _compressionType = MpqCompressionType.ZLib; }
// public MpqArchive Archive => _archive; /*public void AddToArchive( MpqArchive archive ) * { * if ( _archive != null ) * { * throw new InvalidOperationException(); * } * * _archive = archive; * _entry.SetPos( 0 ); * }*/ public void AddToArchive(uint headerOffset, uint index, uint filePos, MpqLocale locale, uint mask) { _entry.SetPos(headerOffset, filePos); // This file came from another archive, and has an unknown filename. if (_hash.HasValue) { // Overwrite blockIndex from old archive. var hash = _hash.Value; _hash = new MpqHash(hash.Name1, hash.Name2, hash.Locale, index, hash.Mask); } else { _hash = new MpqHash(_fileName, mask, locale, index); _hashIndex = MpqHash.GetIndex(_fileName, mask); } }
public void AddToArchive(uint headerOffset, uint index, uint filePos, MpqLocale locale, uint mask) { // TODO: verify that blocksize of mpqfile and mpqarchive to which it gets added are the same, otherwise throw an exception _entry.SetPos(headerOffset, filePos); // This file came from another archive, and has an unknown filename. if (_hash.HasValue) { // Overwrite blockIndex from old archive. var hash = _hash.Value; _hash = new MpqHash(hash.Name1, hash.Name2, hash.Locale, index, hash.Mask); } else { _hash = new MpqHash(_fileName, mask, locale, index); _hashIndex = MpqHash.GetIndex(_fileName, mask); } }
/// <summary> /// Initializes a new instance of the <see cref="MpqKnownFile"/> class. /// </summary> internal MpqKnownFile(string fileName, MpqStream mpqStream, MpqFileFlags flags, MpqLocale locale, bool leaveOpen = false) : base(MpqHash.GetHashedFileName(fileName), mpqStream, flags, locale, leaveOpen) { _fileName = fileName; }
/// <summary> /// Initializes a new instance of the <see cref="MpqHash"/> struct. /// </summary> /// <param name="fileName"></param> /// <param name="mask"></param> /// <param name="locale"></param> /// <param name="blockIndex"></param> public MpqHash(string fileName, uint mask, MpqLocale locale, uint blockIndex) : this(StormBuffer.HashString(fileName, 0x100), StormBuffer.HashString(fileName, 0x200), locale, blockIndex, mask) { }
/// <summary> /// Initializes a new instance of the <see cref="MpqHash"/> struct. /// </summary> /// <param name="name1"></param> /// <param name="name2"></param> /// <param name="locale"></param> /// <param name="blockIndex"></param> /// <param name="mask"></param> public MpqHash(uint name1, uint name2, MpqLocale locale, uint blockIndex, uint mask) : this(name1, name2, locale, blockIndex) { Mask = mask; }
/// <summary> /// Initializes a new instance of the <see cref="MpqHash"/> struct. /// </summary> public MpqHash(string fileName, uint mask, MpqLocale locale, uint blockIndex) : this(GetHashedFileName(fileName), locale, blockIndex, mask) { }
/// <summary> /// Initializes a new instance of the <see cref="MpqHash"/> struct. /// </summary> public MpqHash(ulong name, MpqLocale locale, uint blockIndex, uint mask) : this(name, locale, blockIndex) { Mask = mask; }