Example #1
0
 private void SetPickedFormat(BSAVELoader.FragmentColorPackingEnum format)
 {
     var i = 0;
     foreach (ToolStripItem item in pixelFormatToolStripMenuItem.DropDownItems)
     {
         if (i == (int)format)
             ((ToolStripMenuItem)item).Checked = true;
         else
             ((ToolStripMenuItem)item).Checked = false;
         i++;
     }
 }
Example #2
0
        private void LoadAndRasterizeCurrentFile()
        {
            toolStripStatusText.Text = "Loading " + currFilePath;

            byte[] data = File.ReadAllBytes(currFilePath);
            try
            {
                loader = new BSAVELoader(data, GetPickedFormat(), GetPickedPalette());
                toolStripStatusText.Text = "Loaded " + currFilePath + " Type: " + loader.ImageType.ToString() + " Dim: " + loader.GetBitmapWidth() + ", " + loader.GetBitmapHeight();
                labelFileInfo.Text = loader.ToString();
                SetPickedFormat(loader.FragmentColorPacking);

                EGAimage = new Bitmap(loader.GetBitmapWidth(), loader.GetBitmapHeight());
                loader.ConvertToBitmap(EGAimage);
                AutoScaleImage();
            }
            catch (Exception ep)
            {
                labelFileInfo.Text = "N/A";
                Console.WriteLine("ERROR: " + ep.Message);
                Console.WriteLine("ERROR: " + ep.StackTrace);
                toolStripStatusText.Text = "ERROR: " + ep.Message;

                EGAimage = new Bitmap(7, 7, PixelFormat.Format32bppArgb);
                CreateErrorImage();
                AutoScaleImage();
            }
        }