GetGump() public static method

Returns Bitmap of index and if verdata patched
public static GetGump ( int index ) : Bitmap
index int
return System.Drawing.Bitmap
Exemplo n.º 1
0
        private void OnClickCopy(object sender, EventArgs e)
        {
            if (listBox2.SelectedIndex == -1)
            {
                return;
            }
            int i = (int)listBox2.Items[listBox2.SelectedIndex];

            if (!SecondGump.IsValidIndex(i))
            {
                return;
            }
            Bitmap copy = new Bitmap(SecondGump.GetGump(i));

            Ultima.Gumps.ReplaceGump(i, copy);
            FiddlerControls.Options.ChangedUltimaClass["Gumps"] = true;
            FiddlerControls.Events.FireGumpChangeEvent(this, i);
            m_Compare[i] = true;
            listBox1.BeginUpdate();
            bool done = false;

            for (int id = 0; id < 0x10000; id++)
            {
                if (id > i)
                {
                    listBox1.Items.Insert(id, i);
                    done = true;
                    break;
                }
                if (id == i)
                {
                    done = true;
                    break;
                }
            }
            if (!done)
            {
                listBox1.Items.Add(i);
            }
            listBox1.EndUpdate();
            listBox1.Invalidate();
            listBox2.Invalidate();
            listbox_SelectedChange(listBox1, null);
        }
Exemplo n.º 2
0
        private void Export_Tiff(object sender, EventArgs e)
        {
            if (listBox2.SelectedIndex == -1)
            {
                return;
            }
            int i = int.Parse(listBox2.Items[listBox2.SelectedIndex].ToString());

            if (!SecondGump.IsValidIndex(i))
            {
                return;
            }
            string path     = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            string FileName = Path.Combine(path, String.Format("Gump(Sec) 0x{0:X}.tiff", i));

            SecondGump.GetGump(i).Save(FileName, ImageFormat.Tiff);
            MessageBox.Show(
                String.Format("Gump saved to {0}", FileName),
                "Saved",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information,
                MessageBoxDefaultButton.Button1);
        }
Exemplo n.º 3
0
        private void Export_Bmp(object sender, EventArgs e)
        {
            if (listBox2.SelectedIndex == -1)
            {
                return;
            }
            int i = int.Parse(listBox2.Items[listBox2.SelectedIndex].ToString());

            if (!SecondGump.IsValidIndex(i))
            {
                return;
            }
            string path     = FiddlerControls.Options.OutputPath;
            string FileName = Path.Combine(path, String.Format("Gump(Sec) 0x{0:X}.bmp", i));

            SecondGump.GetGump(i).Save(FileName, ImageFormat.Bmp);
            MessageBox.Show(
                String.Format("Gump saved to {0}", FileName),
                "Saved",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information,
                MessageBoxDefaultButton.Button1);
        }
Exemplo n.º 4
0
        private void listbox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            ListBox listBox = (ListBox)sender;

            if (e.Index < 0)
            {
                return;
            }
            Brush fontBrush = Brushes.Gray;

            int i = (int)listBox.Items[e.Index];

            if (listBox.SelectedIndex == e.Index)
            {
                e.Graphics.FillRectangle(Brushes.LightSteelBlue, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
            }
            bool valid;

            if ((int)listBox.Tag == 1)
            {
                valid = Gumps.IsValidIndex(i);
            }
            else
            {
                valid = SecondGump.IsValidIndex(i);
            }

            if (valid)
            {
                Bitmap bmp;
                if ((int)listBox.Tag == 1)
                {
                    bmp = Gumps.GetGump(i);
                }
                else
                {
                    bmp = SecondGump.GetGump(i);
                }

                if (bmp != null)
                {
                    if (listBox2.Items.Count > 0)
                    {
                        if (!Compare(i))
                        {
                            fontBrush = Brushes.Blue;
                        }
                    }
                    int width  = bmp.Width > 80 ? 80 : bmp.Width;
                    int height = bmp.Height > 54 ? 54 : bmp.Height;

                    e.Graphics.DrawImage(bmp, new Rectangle(e.Bounds.X + 3, e.Bounds.Y + 3, width, height));
                }
                else
                {
                    fontBrush = Brushes.Red;
                }
            }
            else
            {
                fontBrush = Brushes.Red;
            }

            e.Graphics.DrawString(String.Format("0x{0:X}", i), Font, fontBrush,
                                  new PointF((float)85,
                                             e.Bounds.Y + ((e.Bounds.Height / 2) -
                                                           (e.Graphics.MeasureString(String.Format("0x{0:X}", i), Font).Height / 2))));
        }
Exemplo n.º 5
0
        private void listbox_SelectedChange(object sender, EventArgs e)
        {
            ListBox listBox = (ListBox)sender;

            if (listBox.SelectedIndex == -1)
            {
                return;
            }

            int  i = (int)listBox.Items[listBox.SelectedIndex];
            bool valid;

            if ((int)listBox.Tag == 1)
            {
                valid = Gumps.IsValidIndex(i);
                if (listBox2.Items.Count > 0)
                {
                    listBox2.SelectedIndex = listBox2.Items.IndexOf(i);
                }
            }
            else
            {
                valid = SecondGump.IsValidIndex(i);
                listBox1.SelectedIndex = listBox1.Items.IndexOf(i);
            }
            if (valid)
            {
                Bitmap bmp;
                if ((int)listBox.Tag == 1)
                {
                    bmp = Gumps.GetGump(i);
                }
                else
                {
                    bmp = SecondGump.GetGump(i);
                }

                if (bmp != null)
                {
                    if ((int)listBox.Tag == 1)
                    {
                        pictureBox1.BackgroundImage = bmp;
                    }
                    else
                    {
                        pictureBox2.BackgroundImage = bmp;
                    }
                }
                else
                {
                    if ((int)listBox.Tag == 1)
                    {
                        pictureBox1.BackgroundImage = null;
                    }
                    else
                    {
                        pictureBox2.BackgroundImage = null;
                    }
                }
            }
            else
            {
                if ((int)listBox.Tag == 1)
                {
                    pictureBox1.BackgroundImage = null;
                }
                else
                {
                    pictureBox2.BackgroundImage = null;
                }
            }
            listBox.Invalidate();
        }