Ejemplo n.º 1
0
        private void menuSave_Click(object sender, EventArgs e)
        {
            _saveCurrentIcon();

            var tga = new Targa();

            try
            {
                var images = _getImagesFromList();

                // generate full tga image
                var data = tga.CreateTga(images);
                // get icons
                var icons = _getIconItemsFromList();

                // save to file
                var bni = new BniFile();
                bni.Save(icons, data, FileName);

                HasModified = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void menuSaveAs_Click(object sender, EventArgs e)
        {
            _saveCurrentIcon();

            var d = new SaveFileDialog();

            d.InitialDirectory = Environment.CurrentDirectory;
            d.Filter           = "BNI Archive (*.bni)|*.bni";
            d.CheckPathExists  = true;

            if (d.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var fileName = d.FileName;

            var tga = new Targa();

            try
            {
                var images = _getImagesFromList();

                // generate full tga image
                var data = tga.CreateTga(images);
                // get icons
                var icons = _getIconItemsFromList();

                // save to file
                var bni = new BniFile();
                bni.Save(icons, data, fileName);

                HasModified = false;
                MessageBox.Show(string.Format("File saved to {0}", fileName), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }