/// <summary>
        /// Initializes a new instance of CShadowSpritePack from a file stream.
        /// </summary>
        /// <param name="file">The file stream as it would be read by DarkEden.</param>
        public CShadowSpritePack(ref FileStream file, string name = null)
        {
            if (file.Length == 0) return;

            if (name != null) this.Name = name;

            Sprites = new List<CShadowSprite>();

            byte[] _spc = new byte[2];

            file.Read(_spc, 0, 2);

            UInt16 spritecount = BitConverter.ToUInt16(_spc, 0);

            for (int i = 0; i < spritecount; i++)
            {

                string str_sprname = "{0}[{1}]";
                object[] objs_sprname = { this.Name, i };

                CShadowSprite ssp = new CShadowSprite(ref file, String.Format(str_sprname, objs_sprname));

                Sprites.Add(ssp);
            }

            this.Initialized = true;
        }
        public void AddSprite(CShadowSprite spr)
        {
            loadedSSPK.Sprites.Add(spr);

            lbSprites.Items.Add(spr.Name);
            lbSprites.SelectedItems.Clear();
        }
        /// <summary>
        /// Initializes a new instance of CShadowSpritePack from a file stream.
        /// </summary>
        /// <param name="file">The file stream as it would be read by DarkEden.</param>
        public CShadowSpritePack(ref FileStream file, string name = null)
        {
            if (file.Length == 0)
            {
                return;
            }

            if (name != null)
            {
                this.Name = name;
            }

            Sprites = new List <CShadowSprite>();

            byte[] _spc = new byte[2];

            file.Read(_spc, 0, 2);

            UInt16 spritecount = BitConverter.ToUInt16(_spc, 0);

            for (int i = 0; i < spritecount; i++)
            {
                string   str_sprname  = "{0}[{1}]";
                object[] objs_sprname = { this.Name, i };

                CShadowSprite ssp = new CShadowSprite(ref file, String.Format(str_sprname, objs_sprname));

                Sprites.Add(ssp);
            }

            this.Initialized = true;
        }
        private void tsmiEditImportImage_Click(object sender, EventArgs e)
        {
            openFileDialog.Filter = "PNG Files|*.png|TIFF Files|*.tiff|BMP Files|*.bmp";
            openFileDialog.Multiselect = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (openFileDialog.FileNames.Length == 1)
                {
                    DirectoryInfo dir = new DirectoryInfo(openFileDialog.FileName);

                    Image img = Image.FromFile(openFileDialog.FileName);
                    CShadowSprite spr = new CShadowSprite(img);

                    spr.Name = dir.Name;

                    loadedSSPK.Sprites.Add(spr);
                    lbSprites.Items.Add(spr.Name);
                }
                else
                {
                    foreach (string fn in openFileDialog.FileNames)
                    {
                        DirectoryInfo dir = new DirectoryInfo(fn);

                        Image img = Image.FromFile(fn);
                        CShadowSprite spr = new CShadowSprite(img);

                        spr.Name = dir.Name;

                        loadedSSPK.Sprites.Add(spr);
                        lbSprites.Items.Add(spr.Name);
                    }
                }
            }
            openFileDialog.Multiselect = false;
        }