Exemple #1
0
        public void Load(string filename)
        {
            ArchivePath = filename;
            IsMultiPart = filename.EndsWith("_dir.vpk");
            if (IsMultiPart)
            {
                LoadParts(filename);
            }
            _reader = new VpkReaderV1(filename);
            var hdr = _reader.ReadArchiveHeader();

            if (!hdr.Verify())
            {
                throw new ArchiveParsingException("Invalid archive header");
            }
            Directories.AddRange(_reader.ReadDirectories(this));
        }
Exemple #2
0
        public void Load(byte[] file, VpkVersions.Versions version = VpkVersions.Versions.V1)
        {
            if (version == VpkVersions.Versions.V1)
            {
                _reader = new VpkReaderV1(file);
            }
            else if (version == VpkVersions.Versions.V2)
            {
                _reader = new V2.VpkReaderV2(file);
            }
            var hdr = _reader.ReadArchiveHeader();

            if (!hdr.Verify())
            {
                throw new ArchiveParsingException("Invalid archive header");
            }
            Directories.AddRange(_reader.ReadDirectories(this));
        }