Exemple #1
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex < 0)
            {
                return;
            }

            ZipReader.ZipEntryFull ent = _tpf.GetEntry(listBox1.SelectedIndex);

            rtb2.Text = ent.Filename + "\n\nCompressed Length: " + ent.ComprSize + "\nUncompressed Length: " + ent.UncomprSize + "\nCompression Ratio: " +
                        ((float)ent.ComprSize / ent.UncomprSize) + "\nCRC-32: " + BitConverter.ToString(BitConverter.GetBytes(ent.CRC)) + "\nComment:\n";
            if (String.IsNullOrEmpty(ent.Comment))
            {
                rtb2.Text += "None";
            }
            else
            {
                rtb2.Text += ent.Comment;
            }

            if (!_autoPreview)
            {
                return;
            }

            String extension = Path.GetExtension(ent.Filename);

            if (String.Compare(extension, ".def", true) != 0)
            {
                SearchHash(listBox1.SelectedIndex);
            }
            if (String.Compare(extension, ".dds", true) == 0)
            {
                PreviewTex(ent, true);
            }
            else if (String.Compare(extension, ".tga", true) == 0)
            {
                PreviewTex(ent, false);
            }
            else if (String.Compare(extension, ".def", true) == 0)
            {
                PreviewDef(ent);
            }
            else if (String.Compare(extension, ".jpg", true) == 0 || String.Compare(extension, ".gif", true) == 0 || String.Compare(extension, ".png", true) == 0)
            {
                PreviewImg(ent);
            }
        }
        public TPFView(TPFExtract tpf)
        {
            InitializeComponent();

            _tpf = tpf;
            for (int i = 0; i < _tpf.GetNumEntries(); i++)
            {
                listBox1.Items.Add(_tpf.GetEntry(i).Filename);
            }

            uint unc = 0;
            uint cpr = 0;
            for (int i = 0; i < _tpf.GetNumEntries(); i++)
            {
                unc += _tpf.GetEntry(i).UncomprSize;
                cpr += _tpf.GetEntry(i).ComprSize;
            }
            rtb4.Text = "TPF File Info\n\nFilename: " + _tpf.GetFilename() + "\nStored Files: " + _tpf.GetNumEntries() + "\nAverage Compression Ratio: " +
                ((float)cpr / unc) + "\nComment:\n" + _tpf.GetComment();
        }
Exemple #3
0
        public TPFView(TPFExtract tpf)
        {
            InitializeComponent();

            _tpf = tpf;
            for (int i = 0; i < _tpf.GetNumEntries(); i++)
            {
                listBox1.Items.Add(_tpf.GetEntry(i).Filename);
            }

            uint unc = 0;
            uint cpr = 0;

            for (int i = 0; i < _tpf.GetNumEntries(); i++)
            {
                unc += _tpf.GetEntry(i).UncomprSize;
                cpr += _tpf.GetEntry(i).ComprSize;
            }
            rtb4.Text = "TPF File Info\n\nFilename: " + _tpf.GetFilename() + "\nStored Files: " + _tpf.GetNumEntries() + "\nAverage Compression Ratio: " +
                        ((float)cpr / unc) + "\nComment:\n" + _tpf.GetComment();
        }