public frmInterpolateDialog(DPOW.Reader.DPOWObject dpow, DPOW.Reader.Animation animation)
        {
            InitializeComponent();

            refDpow = dpow;

            cmbAnimations.Enabled = false;
            activeAnimation       = animation;

            refreshControls();
        }
        public frmInterpolateDialog(DPOW.Reader.DPOWObject dpow)
        {
            InitializeComponent();

            refDpow = dpow;

            for (int i = 0; i < dpow.Animations.Length; i++)
            {
                cmbAnimations.Items.Add(dpow.Animations[i].Name);
            }
        }
Beispiel #3
0
        private void openfile(string filename)
        {
            openedFile = filename;
            PESTool.Tools pestools  = new PESTool.Tools();
            MemoryStream  memstream = new MemoryStream();

            pestools.decompresstoMemory(filename, memstream);
            MemoryStream[] subfiles = pestools.splitmultifile(memstream, false);

            List <string> availabledpows = new List <string>();

            for (int i = 0; i < subfiles.Length; i++)
            {
                byte[] buffer = new byte[4];
                subfiles[i].Read(buffer, 0, 4);
                if (System.Text.Encoding.ASCII.GetString(buffer) == "DPOW")
                {
                    availabledpows.Add(pestools.fnames[i]);
                }
                subfiles[i].Seek(0, SeekOrigin.Begin);
            }

            int    k           = 0;
            string openingfile = "";

            if (availabledpows.Count == 0)
            {
                MessageBox.Show("No DPOWs on this file");
                return;
            }
            else if (availabledpows.Count > 1)
            {
                frmSelectSubfile frmPickFile = new frmSelectSubfile();
                frmPickFile.subfiles = availabledpows.ToArray();
                frmPickFile.ShowDialog();
                openingfile = frmPickFile.cmbSubfile.Text;
            }
            else
            {
                openingfile = availabledpows[0];
            }

            for (int i = 0; i < subfiles.Length; i++)
            {
                if (pestools.fnames[i] == openingfile)
                {
                    k = i;
                }
            }
            dpow          = new DPOW.Reader.DPOWObject(subfiles[k]);
            openedSubFile = k;

            init3D();

            refreshLists();

            string dir = Path.GetDirectoryName(filename);

            for (int i = 0; i < dpow.Textures.Length; i++)
            {
                if (File.Exists(dir + "\\" + dpow.Textures[i] + ".png"))
                {
                    createMaterial(dpow.Textures[i], System.Drawing.Image.FromFile(dir + "\\" + dpow.Textures[i] + ".png"));

                    imlTextures.Images.Add(dpow.Textures[i], System.Drawing.Image.FromFile(dir + "\\" + dpow.Textures[i] + ".png"));
                    lstTextures.Items[i].ImageKey = dpow.Textures[i];
                }
            }

            lstTextures.Refresh();
        }