示例#1
0
        public void MergePacks(string[] files)
        {
            string type = Path.GetExtension(files[0]);

            if (type == ".ispk")
            {
                CIndexSpritePack respack = new CIndexSpritePack();

                foreach (string f in files)
                {
                    CIndexSpritePack pack = CIndexSpritePackHelper.LoadFromFile(f);

                    foreach (CIndexSprite s in pack.Sprites)
                    {
                        respack.Sprites.Add(s);
                    }
                }

                saveFileDialog.Filter       = "ISPK File|*.ispk";
                saveFileDialog.AddExtension = true;
                saveFileDialog.DefaultExt   = ".ispk";

                saveFileDialog.InitialDirectory = Path.GetDirectoryName(files[0]);
                saveFileDialog.FileName         = "new index.ispk";

                if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    respack.SaveToFile(saveFileDialog.FileName);
                }
            }
        }
        public frmIndexSpritePackBrowser(string title)
        {
            InitializeComponent();

            this.loadedISPK = new CIndexSpritePack();

            this.Text = WindowManager.GetTitle(title, WindowManager.WindowType.ISPKWindow);
        }
示例#3
0
        private void GenerateIndexFile(string[] files)
        {
            string type = Path.GetExtension(files[0]);

            if (type == ".aspk")
            {
                CAlphaSpritePack[] pkarray = new CAlphaSpritePack[files.Length];

                for (int i = 0; i < files.Length; i++)
                {
                    pkarray[i] = CAlphaSpritePackHelper.LoadFromFile(files[i]);
                }

                saveFileDialog.Filter       = "ASPKI File|*.aspki";
                saveFileDialog.AddExtension = true;
                saveFileDialog.DefaultExt   = ".aspki";

                saveFileDialog.InitialDirectory = Path.GetDirectoryName(files[0]);
                saveFileDialog.FileName         = "new index.aspki";

                if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    File.WriteAllBytes(saveFileDialog.FileName, CAlphaSpritePackHelper.GenerateIndexFile(ref pkarray));
                }
            }

            if (type == ".ispk")
            {
                CIndexSpritePack[] pkarray = new CIndexSpritePack[files.Length];

                for (int i = 0; i < files.Length; i++)
                {
                    pkarray[i] = CIndexSpritePackHelper.LoadFromFile(files[i]);
                }

                saveFileDialog.Filter       = "ISPKI File|*.ispki";
                saveFileDialog.AddExtension = true;
                saveFileDialog.DefaultExt   = ".ispki";

                saveFileDialog.InitialDirectory = Path.GetDirectoryName(files[0]);
                saveFileDialog.FileName         = "new index.ispki";

                if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    File.WriteAllBytes(saveFileDialog.FileName, CIndexSpritePackHelper.GenerateIndexFile(ref pkarray));
                }
            }
        }
        public frmIndexSpritePackBrowser(CIndexSpritePack ispk, string filename)
        {
            InitializeComponent();

            loadedISPK = ispk;
            dirInfo    = new DirectoryInfo(filename);
            Text       = WindowManager.GetTitle(dirInfo.Name, WindowManager.WindowType.ISPKWindow);

            pbSprite.Image = loadedISPK.Sprites[0].ToImage();

            foreach (CIndexSprite spr in loadedISPK.Sprites)
            {
                lbSprites.Items.Add(spr.Name);
            }

            lbSprites.SelectedIndices.Add(0);

            UpdateStatusLabel();
        }
示例#5
0
        private void OpenSpritePackage(string filename)
        {
            string ext = Path.GetExtension(filename);

            if (ext == ".spk" || ext == ".ispk" || ext == ".sspk" || ext == ".aspk")
            {
                tsStatusLabel.Text = "Loading " + filename + ". Please wait...";
                this.Refresh();

                if (ext == ".spk")
                {
                    CSpritePack spk = CSpritePackHelper.LoadFromFile(filename);

                    if (spk.Initialized)
                    {
                        frmSpritePackBrowser spkbrowser = new frmSpritePackBrowser(spk, filename);

                        WindowManager.spkWindows.Add(spkbrowser);

                        spkbrowser.MdiParent = this;
                        spkbrowser.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Sprite.");

                        return;
                    }
                }

                if (ext == ".ispk")
                {
                    CIndexSpritePack ispk = CIndexSpritePackHelper.LoadFromFile(filename);

                    if (ispk.Initialized)
                    {
                        frmIndexSpritePackBrowser ispkbrowser = new frmIndexSpritePackBrowser(ispk, filename);

                        WindowManager.ispkWindows.Add(ispkbrowser);

                        ispkbrowser.MdiParent = this;
                        ispkbrowser.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Sprite.");

                        return;
                    }
                }

                if (ext == ".sspk")
                {
                    CShadowSpritePack sspk = CShadowSpritePackHelper.LoadFromFile(filename);

                    if (sspk.Initialized)
                    {
                        frmShadowSpritePackBrowser sspkbrowser = new frmShadowSpritePackBrowser(sspk, filename);

                        WindowManager.sspkWindows.Add(sspkbrowser);

                        sspkbrowser.MdiParent = this;
                        sspkbrowser.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Sprite.");

                        return;
                    }
                }

                if (ext == ".aspk")
                {
                    CAlphaSpritePack aspk = CAlphaSpritePackHelper.LoadFromFile(filename);

                    if (aspk.Initialized)
                    {
                        frmAlphaSpritePackBrowser aspkbrowser = new frmAlphaSpritePackBrowser(aspk, filename);

                        WindowManager.aspkWindows.Add(aspkbrowser);

                        aspkbrowser.MdiParent = this;
                        aspkbrowser.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Sprite.");

                        return;
                    }
                }

                tsStatusLabel.Text = "";
            }
        }