Пример #1
0
        private void Button_parse_Click(object sender, EventArgs e)
        {
            if (listView_lumps_index < 0)
            {
                return;
            }
            var lump     = bsp.Header.lumps[listView_lumps_index];
            var lumptype = SourceBSPStructs.GetLump(listView_lumps_index);

            if (lumptype == SourceBSPStructs.Lumps.LUMP_ENTITIES) //Lump 0
            {
                bsp.BR.BaseStream.Seek(lump.fileofs, SeekOrigin.Begin);
                new FormEntityList(Encoding.ASCII.GetString(bsp.BR.ReadBytes(lump.filelen))).ShowDialog();
            }
            else if (lumptype == SourceBSPStructs.Lumps.LUMP_PAKFILE) //Lump 40
            {
                //SharpVPK.VpkArchive vpk = new SharpVPK.VpkArchive();
                //vpk.Load(lump.Parse<byte>(bsp.BR), SharpVPK.VpkVersions.Versions.V1);
                bsp.BR.BaseStream.Seek(lump.fileofs, SeekOrigin.Begin);
                new FormFileBrowser(bsp.BR.ReadBytes(lump.filelen)).ShowDialog();
            }
            else
            {
                var table = new FormShowTable();
                if (CreateLumpTable(lump, lumptype, table))
                {
                    table.ShowDialog();
                }
                else
                {
                    MessageBox.Show("This lump is not supported yet.");
                    table.Dispose();
                }
            }

            GC.Collect();
        }