using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MPQ.FileSystem;
using CommonUI_Unity3D.Src.M3Z;
using System.IO;

namespace MPQFileSystemTest
{
    public partial class FormEntry : Form
    {
        public FormEntry(MPQFileSystem.MPQFileEntry e, MPQFileSystem fs)
        {
            InitializeComponent();

            this.Text = e.Key;

            if (e.Key.ToLower().EndsWith(".m3z"))
            {
                byte[] data = fs.getData(e.Key);
                using (MemoryStream stream = new MemoryStream(data))
                {
                    M3ZHeader m3z = new M3ZHeader(stream);
                    this.propertyGrid1.SelectedObject = m3z;
                }
            }
            else
            {
                this.propertyGrid1.SelectedObject = e;
            }
        }
    }
}